/* =========================================
       1. DESKTOP SAAS DESIGN TOKENS
       ========================================= */
:root {
    --bg-main: #F4F5F7;
    --sidebar-bg: #0A0A0A;
    --sidebar-hover: #1A1A1A;
    --sidebar-text: #A1A1AA;
    --card-bg: #FFFFFF;
    --card-border: #E5E7EB;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
    --text-main: #111827;
    --text-muted: #6B7280;
    --separator: #F3F4F6;
    --accent-blue: #2563EB;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-orange: #F59E0B;
}

body.dark {
    --bg-main: #0F1115;
    --card-bg: #181A1F;
    --card-border: #272A30;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --separator: #272A30;
}

/* =========================================
   PREMIUM THEME TRANSITION ENGINE
   ========================================= */
body,
body * {
    transition-property: background-color, background, color, border-color, box-shadow, fill, stroke;
    transition-duration: 0.4s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Protect the horizontal profile menu animation from being overwritten */
#inlineProfileMenu {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    transition: background-color 0.3s;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    border-radius: 16px;
    transition: 0.3s;
}

/* =========================================
       2. DESKTOP LAYOUT ARCHITECTURE
       ========================================= */
#desktopAppLayout {
    display: none;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1F2937;
    z-index: 50;
}

.brand {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #1F2937;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    color: white;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.nav-menu {
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-label {
    font-size: 11px;
    font-weight: 700;
    color: #4B5563;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 12px 0 8px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

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

.nav-item.active {
    background: #1F2937;
    color: white;
    font-weight: 600;
}

.nav-item.active svg {
    stroke: var(--accent-blue);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #1F2937;
}

/* MAIN WORKSPACE */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    overflow: hidden;
}

/* TOP BAR */
.top-bar {
    height: 80px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 40;
    transition: 0.3s;
}

.search-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border: 1px solid var(--separator);
    padding: 10px 16px;
    border-radius: 12px;
    width: 350px;
    transition: 0.3s;
}

.search-wrap:focus-within {
    border-color: var(--accent-blue);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-wrap input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    width: 100%;
    margin-left: 10px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.time-widget {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: 0.2s;
}

.user-profile-btn:hover {
    background: var(--separator);
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--text-main);
    color: var(--bg-main);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* VIEWS CONTAINER */
.views-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    padding: 32px;
    z-index: 10;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    z-index: 20;
}

#loginView {
    background: var(--bg-main);
    z-index: 3000;
}

#loginView.active {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* =========================================
       3. COMPONENT STYLES
       ========================================= */
.inset-group {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    min-height: 60px;
}

.input-row:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 0;
    height: 1px;
    background: var(--separator);
}

.input-row input,
.input-row select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 20px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

.input-row label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 16px;
    white-space: nowrap;
}

.input-row input.rtl {
    text-align: right;
    color: var(--text-main);
    font-weight: 700;
    font-size: 16px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--text-main);
    color: var(--bg-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.dark .btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.btn-green {
    background: var(--accent-green);
    color: white;
}

.btn-gray {
    background: var(--separator);
    color: var(--text-main);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-logout:hover {
    background: var(--accent-red);
    color: white;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch .slider {
    position: absolute;
    inset: 0;
    background-color: var(--separator);
    border-radius: 30px;
    transition: 0.4s;
    cursor: pointer;
    border: 1px solid var(--card-border);
}

.theme-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.4s;
}

.theme-switch input:checked+.slider {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.theme-switch input:checked+.slider:before {
    transform: translateX(20px);
    background: white;
}

/* =========================================
       FINTECH DASHBOARD GRIDS
       ========================================= */
.fintech-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.ft-widget {
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ft-widget.span-2 {
    grid-column: span 2;
}

.ft-widget.span-4 {
    grid-column: span 4;
}

.ft-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.ft-stat-box {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-main);
    border: 1px solid var(--separator);
    text-align: center;
}

.ft-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 4px;
}

.ft-stat-lbl {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Monotone Charting */
.ft-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ft-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    font-family: monospace;
}

.ft-bar-track {
    height: 6px;
    background: var(--separator);
    border-radius: 4px;
    overflow: hidden;
}

.ft-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--text-main);
    transition: width 1s ease-out;
}

/* =========================================
       4. MODULES (TROLLEY, INVENTORY, ETC)
       ========================================= */
/* Trolley */
.trolley-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.trolley-box {
    background: var(--card-bg);
    padding: 14px 0;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
    color: var(--text-muted);
}

.trolley-box:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.checked-red {
    background: var(--accent-red) !important;
    color: #fff !important;
    border-color: var(--accent-red) !important;
}

.checked-blue {
    background: var(--accent-blue) !important;
    color: #fff !important;
    border-color: var(--accent-blue) !important;
}

.stat-bar {
    height: 6px;
    background: var(--separator);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.stat-fill {
    height: 100%;
    transition: width 0.4s;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

/* Inventory */
.table-container {
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--bg-main);
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    border-bottom: 1px solid var(--separator);
    letter-spacing: 0.5px;
}

td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--separator);
    color: var(--text-main);
    font-weight: 500;
}

td[contenteditable="true"]:focus {
    background: rgba(37, 99, 235, 0.05);
    box-shadow: inset 0 0 0 2px var(--accent-blue);
    outline: none;
    border-radius: 6px;
}

.disabled-cell {
    color: var(--text-muted);
    opacity: 0.6;
    pointer-events: none;
}

.exp-cell {
    color: var(--accent-blue);
    font-weight: 600;
    cursor: pointer;
}

.locked td {
    opacity: 0.5;
    pointer-events: none;
}

.locked td:last-child {
    pointer-events: auto;
    opacity: 1;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
}

.badge-deposit {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.badge-return {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.badge-temp {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.badge-none {
    background: var(--separator);
    color: var(--text-muted);
}

/* Schedule */
.schedule-toggle {
    display: flex;
    padding: 4px;
    gap: 4px;
    border-radius: 12px;
}

.sch-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}

.sch-toggle-btn:hover {
    color: var(--text-main);
}

.sch-toggle-btn.active {
    background: var(--bg-main);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-weight: 700;
}

body.dark .sch-toggle-btn.active {
    background: #272A30;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    text-align: center;
}

.day-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Bigger, sleeker days for Month View */
.cal-day {
    background: var(--bg-main);
    border: 1px solid var(--separator);
    border-radius: 12px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-main);
    position: relative;
}

.cal-day:hover {
    border-color: var(--text-muted);
}

.cal-day.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: var(--card-bg);
}

/* Notification Dots inside Calendar Days */
.day-dots {
    display: flex;
    gap: 4px;
    margin-top: auto;
    padding-top: 8px;
    flex-wrap: wrap;
}

.dot-event {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dot-red {
    background: var(--accent-red);
}

/* Holidays */
.dot-blue {
    background: var(--accent-blue);
}

/* Notes */
.dot-orange {
    background: var(--accent-orange);
}

/* Shifts */

/* Mini Calendar for Year View */
.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    margin-top: 12px;
}

.mini-cal-day {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 0;
    border-radius: 4px;
    cursor: pointer;
}

.mini-cal-day:hover {
    background: var(--separator);
    color: var(--text-main);
}

.mini-cal-day.has-event {
    color: var(--accent-red);
    font-weight: 700;
}

.full-sch-table th,
.full-sch-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--separator);
    white-space: nowrap;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 13px;
}

.full-sch-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
}

.full-sch-table th.sticky-col,
.full-sch-table td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 4;
    text-align: left;
    padding: 12px 24px;
    font-weight: 600;
    border-right: 1px solid var(--separator);
}

.full-sch-table tr:hover td {
    background: var(--bg-main);
}

/* Highlight row on hover */

/* Master Gift */
.promo-widget {
    border: 1px solid var(--accent-green);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    background: rgba(16, 185, 129, 0.02);
}

.promo-w-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.promo-w-mech {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.25s;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 400px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-box.large {
    width: 90vw;
    max-width: 1000px;
    max-height: 90vh;
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.btn-close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--separator);
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 100;
}

.btn-close-modal:hover {
    background: var(--card-border);
}

/* Dropdowns */
.mg-dropdown {
    display: none;
    position: absolute;
    z-index: 100;
    border-radius: 10px;
    padding: 6px;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
    background: var(--card-bg);
}

.mg-drop-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
}

.mg-drop-item:hover {
    background: var(--separator);
}

/* =========================================
       5. TROLLEY RECAP ANALYTICS 
       ========================================= */
.recap-dash-container {
    display: flex;
    height: 100%;
    width: 100%;
    text-align: left;
}

.recap-dash-left {
    flex: 0 0 300px;
    border-right: 1px solid var(--separator);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    background: var(--bg-main);
    overflow-y: auto;
}

.recap-dash-right.adaptive-columns {
    flex: 1;
    padding: 32px;
    display: flex;
    flex-direction: row;
    gap: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: flex-start;
    background: var(--card-bg);
}

.trolley-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 24px;
    height: auto;
}

.data-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    height: auto;
    box-shadow: var(--shadow-soft);
}

.data-box-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-box-content {
    font-family: monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.8;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    width: 100%;
    height: auto;
    overflow: visible;
}

.theme-checked-red {
    border-top: 3px solid var(--accent-red);
}

.theme-checked-blue {
    border-top: 3px solid var(--accent-blue);
}

.theme-missing-red {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.02);
}

.theme-missing-blue {
    border: 1px solid rgba(37, 99, 235, 0.3);
    background: rgba(37, 99, 235, 0.02);
}

.theme-missing-red .data-box-content,
.theme-missing-blue .data-box-content {
    color: var(--text-main);
    font-weight: 600;
}

.ring-chart {
    width: 180px;
    height: 180px;
    position: relative;
}

.ring-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.ring-bg {
    fill: none;
    stroke: var(--separator);
    stroke-width: 3;
}

.ring-fill {
    fill: none;
    stroke: var(--accent-green);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1.5s ease-out;
}

.ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-val {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -1.5px;
}

.ring-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Profile Dropdown Animation */
.profile-dropdown {
    position: absolute;
    top: 56px;
    /* FIX: Safely pushes the menu exactly below the header */
    right: 0;
    width: 240px;
    background: var(--card-bg);
    border: 1px solid var(--separator);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-15px) scale(0.95);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2000;
    transform-origin: top right;
}

.profile-dropdown.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-profile-btn:hover {
    background: var(--separator);
}

/* Sidebar Monotone Fintech Override */
.sidebar .nav-item.active {
    background: var(--separator) !important;
    color: var(--text-main) !important;
    font-weight: 700 !important;
}

.sidebar .nav-item.active svg {
    stroke: var(--text-main) !important;
    opacity: 1 !important;
}

/* Fix for filled SVG icons in active state */
.sidebar .nav-item.active svg path,
.sidebar .nav-item.active svg rect,
.sidebar .nav-item.active svg circle {
    fill: var(--text-main);
}

/* Vaporize the old redundant in-page headers */
.page-header {
    display: none !important;
}

/* Premium Loading Spinner */
.enterprise-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--separator);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================
   SCI-FI AUTH & GALAXY ENGINE (V2: EXTREME)
   ========================================= */

/* 1. The Red Error Shake */
@keyframes violentShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px) rotate(-2deg);
    }

    40%,
    80% {
        transform: translateX(8px) rotate(2deg);
    }
}

.auth-input-error input {
    color: var(--accent-red) !important;
}

.auth-input-error {
    animation: violentShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    border-color: var(--accent-red) !important;
    background: rgba(239, 68, 68, 0.1) !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* 2. The True Milky Way Starfield */
.galaxy-matrix-bg {
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background-color: #02040a;
    /* Layered CSS stars! */
    background-image:
        radial-gradient(circle, white, rgba(255, 255, 255, .2) 2px, transparent 3px),
        radial-gradient(circle, rgba(37, 99, 235, 0.8), rgba(37, 99, 235, .15) 1px, transparent 2px),
        radial-gradient(circle, white, rgba(255, 255, 255, .1) 2px, transparent 3px);
    background-size: 350px 350px, 200px 200px, 150px 150px;
    background-position: 0 0, 40px 60px, 130px 270px;
    animation: galaxyRotate 90s linear infinite;
    z-index: 1;
}

/* Cryptic pulsing system code in the background */
.galaxy-matrix-bg::after {
    content: "SYSTEM OFFLINE \\A AWAITING AUTHORIZATION \\A 01001001 01001110 01001001 01010100";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: monospace;
    font-size: 16px;
    color: rgba(37, 99, 235, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: pre;
    line-height: 2.5;
    letter-spacing: 12px;
    z-index: 2;
    animation: pulseCode 3s ease-in-out infinite;
}

@keyframes galaxyRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulseCode {

    0%,
    100% {
        opacity: 0.1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.02);
    }
}

/* 3. The Light-Speed Hyperspace Jump */
.hyperspace-warp {
    animation: warpDrive 1.2s cubic-bezier(0.7, 0, 0.1, 1) forwards;
}

@keyframes warpDrive {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0) brightness(1);
    }

    50% {
        filter: blur(8px) brightness(3);
    }

    100% {
        transform: scale(40);
        opacity: 0;
        filter: blur(30px) brightness(10);
    }
}

/* =========================================
   ENTERPRISE ORBITAL UI & ANIMATIONS
   ========================================= */

/* 1. Cinematic Planet Background (pointer-events: none fixes the click bug!) */
.deep-space-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* Pure CSS Starfield */
.space-stars {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image:
        radial-gradient(1.5px 1.5px at 40px 60px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 120px 180px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 250px 340px, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 300px 100px, rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 80px 300px, #fff, rgba(0, 0, 0, 0));
    background-size: 350px 350px;
    animation: slowDrift 120s linear infinite;
    opacity: 0.4;
}

/* Giant Dark Planet at the bottom */
.planet-horizon {
    position: absolute;
    bottom: -60vh;
    left: -50vw;
    width: 200vw;
    height: 200vw;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 0%, #0f172a 0%, #020617 50%);
    box-shadow: 0 -3px 30px rgba(56, 189, 248, 0.15), inset 0 5px 50px rgba(56, 189, 248, 0.05);
}

@keyframes slowDrift {
    100% {
        transform: rotate(360deg);
    }
}

/* 2. Sleek 2D Form Box */
.enterprise-reg-box {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* 3. Flat Minimal Inputs */
.flat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flat-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.flat-input:focus {
    border-color: var(--accent-blue);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
}

/* 4. Minimal Buttons */
.flat-btn-primary {
    width: 100%;
    padding: 14px;
    margin-top: 32px;
    border: none;
    border-radius: 10px;
    background: var(--text-main);
    color: var(--bg-main);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.flat-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.flat-btn-secondary {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.flat-btn-secondary:hover {
    color: #fff;
}

/* 5. The Animations */
.warp-in {
    animation: warpInAnim 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes warpInAnim {
    0% {
        transform: scale(0.8);
        filter: blur(10px);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        filter: blur(0);
        opacity: 1;
    }
}

/* The Clean Data-Wipe Exit */
.quantum-dissolve {
    animation: cleanWipe 0.7s cubic-bezier(0.8, 0, 0.2, 1) forwards;
}

@keyframes cleanWipe {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }

    40% {
        transform: scale(1.05, 0.02);
        opacity: 0.8;
        filter: blur(2px);
        background: #fff;
    }

    100% {
        transform: scale(3, 0);
        opacity: 0;
        filter: blur(10px);
    }
}

.hyperspace-warp {
    animation: warpDrive 1.2s cubic-bezier(0.7, 0, 0.1, 1) forwards;
}

@keyframes warpDrive {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }

    50% {
        filter: blur(8px);
    }

    100% {
        transform: scale(15);
        opacity: 0;
        filter: blur(20px);
    }
}

/* =========================================
   📱 MASTER NATIVE MOBILE OVERRIDE ENGINE
   ========================================= */
/* =========================================
       MAP DASHBOARD TWEAKS
       ========================================= */
#baliMap {
    /* This binds the Leaflet container to your theme variables */
    background: var(--bg-main) !important;
    transition: background 0.4s;
}

/* Hide Leaflet watermark for enterprise cleanliness */
.leaflet-control-attribution {
    display: none !important;
}

/* Hover effect for Member table location buttons */
.loc-hover-box:hover {
    background: rgba(37, 99, 235, 0.05);
    border-color: rgba(37, 99, 235, 0.3) !important;
}

/* =========================================
       ENTERPRISE AUTO-HIDE SIDEBAR (DESKTOP)
       ========================================= */

/* FIX 1: NUKE WINDOWS SCROLLBARS BUT KEEP SCROLLING ENABLED */
.sidebar,
.nav-menu {
    -ms-overflow-style: none !important;
    /* IE and Edge */
    scrollbar-width: none !important;
    /* Firefox */
}

.sidebar::-webkit-scrollbar,
.nav-menu::-webkit-scrollbar {
    display: none !important;
    /* Chrome, Safari and Opera */
    width: 0 !important;
    height: 0 !important;
}

@media (min-width: 769px) {
    .sidebar {
        width: 80px !important;
        transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
        overflow-x: hidden !important;
        overflow-y: hidden !important;
        /* Let .nav-menu handle vertical scrolling */
        white-space: nowrap !important;
        cursor: pointer;
        z-index: 1000;
        position: relative !important;
    }

    /* FIX 2: ENFORCE ROLE SECURITY (Blocks CSS from overriding JS hidden apps) */
    .sidebar .nav-item[style*="display: none"] {
        display: none !important;
    }

    .sidebar.expanded {
        width: 260px !important;
        cursor: default;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.15);
    }

    .sidebar .brand {
        position: relative;
    }

    .sidebar .brand-text {
        transition: opacity 0.2s;
    }

    .sidebar:not(.expanded) .brand-text {
        opacity: 0;
        pointer-events: none;
    }

    /* Always-Visible MS Logo */
    .sidebar::after {
        content: 'MS';
        position: absolute;
        top: 28px;
        left: 0;
        width: 80px;
        text-align: center;
        font-size: 24px;
        font-weight: 800;
        color: #FFFFFF !important;
        opacity: 0;
        transition: opacity 0.3s;
        pointer-events: none;
    }

    .sidebar:not(.expanded)::after {
        opacity: 1;
    }

    .sidebar:not(.expanded) .nav-label {
        opacity: 0;
        pointer-events: none;
        margin: 0;
        height: 0;
        padding: 0;
    }

    .sidebar:not(.expanded) .sidebar-footer {
        opacity: 0;
        pointer-events: none;
    }

    .sidebar:not(.expanded) .nav-item {
        font-size: 0px !important;
        padding: 16px 0 !important;
        /* Notice 'display: flex !important;' is gone so Javascript can hide the icons */
        justify-content: center !important;
        align-items: center !important;
        gap: 0 !important;
    }

    .sidebar:not(.expanded) .nav-item svg {
        margin: 0 !important;
        transform: scale(1.2);
        display: block;
    }

    .sidebar .nav-item.active svg {
        filter: none !important;
        transform: scale(1.2) !important;
        animation: none !important;
    }

    /* Allow the Main Dashboard to smoothly stretch and fill the empty space */
    .main-wrapper {
        transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
        width: calc(100vw - 80px) !important;
    }

    .sidebar.expanded~.main-wrapper {
        width: calc(100vw - 260px) !important;
    }
}

@media (max-width: 768px) {

    /* --- 1. CORE VIEWPORT & APP SHELL --- */
    body,
    html {
        overflow: hidden !important;
        height: 100dvh !important;
        position: fixed !important;
        width: 100vw !important;
    }

    /* FIX 1: Removed 'display: flex !important' so it stays properly hidden on the Login Screen */
    #desktopAppLayout {
        height: 100dvh !important;
        flex-direction: column !important;
    }

    /* FIX 2: Killed the massive 32px desktop padding to free up horizontal space */
    .view {
        padding: 16px 12px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .main-wrapper {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 90px !important;
        /* Adjusted for sleek nav */
        margin-left: 0 !important;
        padding: 0 !important;
        /* Removed duplicate inner padding */
    }

    .top-bar {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 12px 16px 16px 16px !important;
        height: auto !important;
        border-bottom: none !important;
    }

    #topBarTitle {
        font-size: 22px !important;
    }

    #topBarDesc {
        display: none !important;
    }

    #inlineProfileMenu {
        display: none !important;
    }

    .user-profile-btn {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .user-profile-btn>div:first-child {
        display: none !important;
    }

    #userAvatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    /* --- 2. BOTTOM NAVIGATION TABS (ICONS ONLY, SLEEK) --- */
    .sidebar {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw !important;
        height: 75px !important;
        flex-direction: row !important;
        padding: 0 !important;
        background: rgba(255, 255, 255, 0.92) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--separator) !important;
        border-right: none !important;
        z-index: 9999;
    }

    body.dark .sidebar {
        background: rgba(15, 23, 42, 0.92) !important;
    }

    .brand,
    .sidebar-footer,
    .nav-label {
        display: none !important;
    }

    /* FIX 3: Hide text, enlarge icons, add smooth horizontal swiping */
    .nav-menu {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        height: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 16px 16px 16px !important;
        gap: 28px !important;
        margin: 0 !important;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        height: 100% !important;
        padding: 0 !important;
        border-radius: 0 !important;
        min-width: auto !important;
        font-size: 0 !important;
        /* MAGIC TRICK: This completely vaporizes the text labels */
    }

    .nav-item svg {
        margin: 0 !important;
        width: 26px !important;
        height: 26px !important;
        stroke: var(--text-muted) !important;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
        /* Premium bouncy animation */
    }

    .nav-item.active {
        background: transparent !important;
        box-shadow: none !important;
    }

    .nav-item.active svg {
        stroke: var(--accent-blue) !important;
        transform: translateY(-6px) scale(1.15) !important;
        /* Lifts the active icon up */
    }

    /* --- 3. SURGICAL INLINE-STYLE NUKER (Fixes the Squishing) --- */
    /* Destroys hardcoded 3-col and 4-col grids across all apps */
    div[style*="grid-template-columns: 1fr 1fr 1.5fr"],
    div[style*="grid-template-columns: repeat(4, 1fr)"],
    div[style*="grid-template-columns: 1fr 1fr 1.5fr 1.5fr"],
    div[style*="grid-template-columns: 1fr 1fr; gap: 32px;"],
    div[style*="grid-template-columns: 1fr 1fr; gap: 24px;"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* Force Filter and Action Button Bars to Stack */
    div[style*="display: flex; gap: 16px; margin-bottom: 24px;"],
    div[style*="display: flex; gap: 12px; margin-bottom: 16px;"],
    div[style*="display: flex; gap: 12px; align-items: center;"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    /* Make inputs/dropdowns inside those bars take full width */
    .search-wrap {
        width: 100% !important;
        max-width: none !important;
    }

    #trolleyReportPeriod,
    select.flat-input {
        width: 100% !important;
    }

    .page-header {
        display: none !important;
    }

    /* Hide redundant titles */

    /* --- 4. BENTO BOX UI (Dashboard Specifics) --- */
    .fintech-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .ft-widget {
        width: 100% !important;
        padding: 16px !important;
        border-radius: 22px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        justify-content: space-between !important;
        overflow: hidden !important;
    }

    .ft-widget.span-2 {
        grid-column: span 2 !important;
    }

    .ft-widget.span-4 {
        grid-column: span 2 !important;
    }

    .ft-widget:nth-child(1) {
        grid-column: span 2 !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: linear-gradient(135deg, var(--accent-blue), #1e3a8a) !important;
        color: #fff !important;
        padding: 20px 24px !important;
        border: none !important;
    }

    #ftTimeHrMin {
        font-size: 38px !important;
        letter-spacing: -2px !important;
        font-weight: 800 !important;
    }

    #ftAmPm {
        font-size: 14px !important;
        font-weight: 700 !important;
        opacity: 0.9;
    }

    #ftDate {
        font-size: 13px !important;
        opacity: 0.8;
        margin-top: 0 !important;
        text-align: right;
    }

    .ft-title {
        font-size: 11px !important;
        margin-bottom: 12px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }

    .ft-widget>div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .ft-stat-box {
        padding: 12px 6px !important;
        border-radius: 12px !important;
        background: rgba(0, 0, 0, 0.02) !important;
        border: 1px solid rgba(0, 0, 0, 0.04) !important;
    }

    body.dark .ft-stat-box {
        background: rgba(255, 255, 255, 0.03) !important;
        border-color: rgba(255, 255, 255, 0.05) !important;
    }

    .ft-stat-val {
        font-size: 18px !important;
        margin-bottom: 2px !important;
    }

    .ft-stat-lbl {
        font-size: 8px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #ftInvCrit {
        font-size: 32px !important;
    }

    #ftPromoBar,
    #ftPluLegend,
    #ftTrolleyResult {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px !important;
        align-items: stretch !important;
        padding-bottom: 4px;
    }

    #ftPromoBar::-webkit-scrollbar,
    #ftPluLegend::-webkit-scrollbar,
    #ftTrolleyResult::-webkit-scrollbar {
        display: none;
    }

    #ftPromoBar>div,
    #ftPluLegend>div,
    #ftTrolleyResult>div {
        flex: 0 0 80% !important;
        background: var(--bg-main) !important;
        padding: 16px !important;
        border-radius: 16px !important;
        border: 1px solid var(--separator) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #ftPluDonut {
        width: 60px !important;
        height: 60px !important;
        flex-shrink: 0;
    }

    .ft-widget>div[style*="align-items: center; gap: 32px"] {
        gap: 16px !important;
    }

    /* --- 5. SETTINGS / CONFIG VIEW RESCUE --- */
    #configView>.glass-panel {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    #configView>.glass-panel>div:first-child {
        width: 100% !important;
        border-right: none !important;
        padding: 16px !important;
        background: var(--card-bg) !important;
        border: 1px solid var(--separator) !important;
        border-radius: 16px !important;
        margin-bottom: 24px !important;
    }

    #configView>.glass-panel>div:last-child {
        padding: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .settings-nav-btn {
        background: var(--bg-main) !important;
        border: 1px solid var(--separator) !important;
        margin-bottom: 8px !important;
        border-radius: 12px !important;
    }

    .settings-nav-btn.active {
        background: rgba(37, 99, 235, 0.1) !important;
        border-color: rgba(37, 99, 235, 0.3) !important;
        color: var(--accent-blue) !important;
    }

    /* --- 6. SCHEDULE CALENDAR FIX --- */
    #schMonthLayout .glass-panel:first-child {
        padding: 16px !important;
    }

    .calendar-grid {
        gap: 4px !important;
    }

    .cal-day {
        padding: 4px !important;
        min-height: 60px !important;
        font-size: 12px !important;
    }

    .schedule-toggle {
        flex-direction: column !important;
    }

    /* --- 7. TABLE-TO-CARD CONVERTER --- */
    .table-container {
        width: 100% !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    table {
        display: block !important;
        width: 100% !important;
    }

    thead {
        display: none !important;
    }

    tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    tr {
        display: flex !important;
        flex-direction: column !important;
        background: var(--card-bg) !important;
        border: 1px solid var(--separator) !important;
        border-radius: 20px !important;
        padding: 16px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    }

    td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid var(--separator) !important;
        text-align: right !important;
        font-size: 13px !important;
        gap: 16px !important;
    }

    td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        justify-content: center !important;
        margin-top: 8px !important;
    }

    /* Dynamic Labels */
    #invDataTable td::before,
    #memDataTable td::before,
    #chkTableBody td::before {
        font-weight: 800;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 10px;
        flex-shrink: 0;
    }

    /* Inventory Labels */
    #invDataTable td:nth-child(1) {
        display: none !important;
    }

    #invDataTable td:nth-child(2)::before {
        content: "PLU / BRC";
    }

    #invDataTable td:nth-child(3)::before {
        content: "DESC";
    }

    #invDataTable td:nth-child(4)::before {
        content: "REMARKS";
    }

    #invDataTable td:nth-child(5)::before {
        content: "QTY";
    }

    #invDataTable td:nth-child(6)::before {
        content: "UNIT";
    }

    #invDataTable td:nth-child(7)::before {
        content: "STATUS";
    }

    #invDataTable td:nth-child(8)::before {
        content: "EXP";
    }

    /* Member Labels */
    #memDataTable td:nth-child(1)::before {
        content: "PROFILE";
    }

    #memDataTable td:nth-child(2)::before {
        content: "LOCATION";
    }

    #memDataTable td:nth-child(3)::before {
        content: "SURVEY DATA";
    }

    #memDataTable td:nth-child(4)::before {
        content: "STATUS";
    }

    /* Checker Labels */
    #chkTableBody td:nth-child(1)::before {
        content: "KASIR ID";
    }

    #chkTableBody td:nth-child(2)::before {
        content: "NAMA";
    }

    #chkTableBody td:nth-child(3)::before {
        content: "PLU";
    }

    #chkTableBody td:nth-child(4)::before {
        content: "DESC";
    }

    #chkTableBody td:nth-child(5)::before {
        content: "QTY ERR";
    }

    #chkTableBody td:nth-child(6)::before {
        content: "HARGA";
    }

    #chkTableBody td:nth-child(7)::before {
        content: "LOSS (RP)";
    }

    #chkTableBody td:nth-child(8)::before {
        content: "CHECKER";
    }

    /* --- 8. BOTTOM SHEET MODALS --- */
    .modal-box {
        margin-top: auto !important;
        margin-bottom: 0 !important;
        border-radius: 24px 24px 0 0 !important;
        max-height: 90vh !important;
        animation: slideUpNative 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        width: 100vw !important;
    }

    @keyframes slideUpNative {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    /* --- 9. TROLLEY & ANALYTICS STACKING FIX --- */
    /* Forces the Rapid Check and Trolley Stats to stack vertically */
    #trolleyView>div[style*="align-items: stretch;"] {
        flex-direction: column !important;
        gap: 16px !important;
    }

    #trolleyView .glass-panel[style*="width: 300px"] {
        width: 100% !important;
    }

    /* Forces the Analytics Hub split-screen to stack */
    #analyticsHubView>div[style*="flex: 1; overflow: hidden;"] {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    #analyticsHubView .glass-panel[style*="width: 340px"] {
        width: 100% !important;
        flex: none !important;
        max-height: 280px !important;
        border-bottom: 1px solid var(--separator) !important;
    }

    /* Forces the Trolley Recap Detail Modal to stack */
    .recap-dash-container {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    .recap-dash-left {
        width: 100% !important;
        flex: none !important;
        border-right: none !important;
        border-bottom: 1px solid var(--separator) !important;
    }

    .recap-dash-right.adaptive-columns {
        flex-direction: column !important;
    }

    /* --- 10. ROSTER SPREADSHEET EXEMPTION --- */
    /* Protects the Full Schedule from turning into cards, allows horizontal scrolling */
    .full-sch-table {
        display: table !important;
        width: 100% !important;
    }

    .full-sch-table thead {
        display: table-header-group !important;
    }

    .full-sch-table tbody {
        display: table-row-group !important;
    }

    .full-sch-table tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    .full-sch-table th,
    .full-sch-table td {
        display: table-cell !important;
        text-align: center !important;
        border-bottom: 1px solid var(--separator) !important;
        padding: 12px 8px !important;
    }

    .full-sch-table td::before {
        display: none !important;
    }

    /* Hides dynamic labels */
    .full-sch-table .sticky-col {
        position: sticky !important;
        left: 0 !important;
        z-index: 4 !important;
        text-align: left !important;
        padding: 12px 24px !important;
        background: var(--card-bg) !important;
        border-right: 1px solid var(--separator) !important;
    }

    /* --- 11. MEMBER REGISTRATION AESTHETICS --- */
    /* Fixes the unreachable Finalize button by allowing the modal body to flex perfectly */
    .modal-box>div[style*="max-height: 70vh;"] {
        flex: 1 !important;
        max-height: none !important;
    }

    /* Realigns Member Cards so the Label is on top and Data spans full width below it */
    #memDataTable td {
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        gap: 8px !important;
    }

    #memDataTable td::before {
        margin-bottom: 4px !important;
        color: var(--accent-blue) !important;
    }

    #memDataTable td:last-child {
        flex-direction: row !important;
        justify-content: flex-end !important;
    }

    /* --- 12. MODAL Z-INDEX & CENTERING FIX --- */

    /* 1. Force the dark overlay ABOVE the bottom nav bar */
    .modal-overlay {
        z-index: 10000 !important;
    }

    /* 2. Center the modal perfectly in the middle of the screen */
    .modal-box {
        margin: auto !important;
        border-radius: 20px !important;
        width: 92vw !important;
        /* Leaves a sleek gap on the sides */
        max-height: 85dvh !important;
        animation: popInNative 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    @keyframes popInNative {
        from {
            transform: scale(0.95);
            opacity: 0;
        }

        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    /* 3. Lock the Header and Footer, allow ONLY the middle content to scroll */
    .modal-box>div:nth-child(2) {
        flex: 1 1 auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* 4. Permanently dock the Submit button at the bottom of the card */
    .modal-box>div:last-child {
        flex-shrink: 0 !important;
    }

    /* --- 13. MOBILE ZEN MODE (Hide Analytics) --- */
    /* Hides the massive stat grids in Inventory and Member Reg */
    #inventoryView>div[style*="display: grid; grid-template-columns: 1fr 1fr 1.5fr;"],
    #memberRegView>div[style*="display: grid; grid-template-columns: 1fr 1fr 1.5fr 1.5fr;"] {
        display: none !important;
    }

    /* Hides the Analytics History button in Trolley so it's purely for scanning */
    #trolleyView button[onclick="openAnalyticsHub()"] {
        display: none !important;
    }

    /* --- 14. RESTORE DARK MODE TOGGLE --- */
    /* Forces the hidden profile menu to stay open, but ONLY shows the switch */
    #inlineProfileMenu {
        display: flex !important;
        width: auto !important;
        opacity: 1 !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        pointer-events: auto !important;
        position: static !important;
        margin-right: 8px !important;
    }

    /* Hides the Time, Date, Divider, and the word "DARK" */
    #inlineProfileMenu>div:first-child,
    #inlineProfileMenu>div:nth-child(2),
    #inlineProfileMenu>div:nth-child(3)>span {
        display: none !important;
    }

    /* Perfectly aligns the switch next to the avatar */
    #inlineProfileMenu .theme-switch {
        display: inline-block !important;
        margin: 0 !important;
    }

    /* --- 15. MEMBER REGISTRATION COMPACT ACCORDION --- */
    /* Collapse rows by default and add the "View Details" hint */
    #memDataTable tr {
        position: relative;
        padding-bottom: 36px !important;
    }

    #memDataTable tr::after {
        content: '▾ Tap to View Telemetry & Actions';
        position: absolute;
        bottom: 12px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 11px;
        font-weight: 800;
        color: var(--accent-blue);
        opacity: 0.8;
    }

    #memDataTable tr.expanded::after {
        content: '▴ Hide Details';
    }

    /* Hide the deep data columns initially */
    #memDataTable td:nth-child(2),
    #memDataTable td:nth-child(3),
    #memDataTable td:nth-child(4),
    #memDataTable td:nth-child(5) {
        display: none !important;
    }

    /* Reveal the columns instantly when tapped */
    #memDataTable tr.expanded td:nth-child(2),
    #memDataTable tr.expanded td:nth-child(3),
    #memDataTable tr.expanded td:nth-child(4),
    #memDataTable tr.expanded td:nth-child(5) {
        display: flex !important;
    }

    /* Fix spacing so the top "Summary" block looks clean */
    #memDataTable td:nth-child(1) {
        padding-bottom: 0 !important;
        border-bottom: none !important;
    }

    #memDataTable td:nth-child(1)::before {
        display: none !important;
    }

    /* Hide 'PROFILE' label */

    /* Make the action buttons span full width at the bottom of the expanded card */
    #memDataTable td:nth-child(5) {
        margin-top: 12px !important;
        border-top: 1px dashed var(--separator) !important;
        padding-top: 16px !important;
    }

    #memDataTable td:nth-child(5)>div {
        width: 100%;
        justify-content: space-between !important;
    }

    /* --- 16. MOBILE UX REFINEMENTS --- */

    /* FIX 1: Ensure scrolling reaches the absolute bottom past the nav bar */
    .view {
        padding: 16px 12px 100px 12px !important;
    }

    /* FIX 2: Show the standalone mobile logout icon */
    #mobileLogoutBtn {
        display: flex !important;
    }

    /* FIX 3: SO Trolley Team/User Alignment */
    #trolleyView .glass-panel>div:first-child[style*="margin-bottom: 24px"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    #trolleyUser,
    #trolleyUser+button {
        width: 100% !important;
        flex: none !important;
    }

    /* FIX 4: Stop Analytics from forcibly showing, respect the JS toggle */
    #memAnalyticsGrid[style*="display: none"] {
        display: none !important;
    }

    #memAnalyticsGrid[style*="display: grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* FIX 5: Clean up Settings User Management List */
    #userRosterContainer {
        grid-template-columns: 1fr !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #userRosterContainer>div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    #userRosterContainer>div>div {
        width: 100% !important;
    }

    #userRosterContainer button {
        width: 100% !important;
    }

    /* --- 17. APPLE-LIKE FLUID ANIMATIONS --- */

    /* 1. The iOS "Squish and Pop" Tab Bar Effect */
    .nav-item svg {
        /* The signature Apple spring curve */
        transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), stroke 0.3s ease !important;
    }

    /* Instantly squish down when the finger presses the glass */
    .nav-item:active svg {
        transform: scale(0.8) translateY(2px) !important;
        transition: transform 0.1s ease !important;
    }

    /* Spring up smoothly and cast a soft glow when active */
    .nav-item.active svg {
        transform: translateY(-5px) scale(1.2) !important;
        filter: drop-shadow(0 6px 8px rgba(37, 99, 235, 0.3)) !important;
    }

    /* 2. The iOS "Depth & Scale" App Switching Physics */
    .view {
        /* Outgoing apps shrink back and drop slightly */
        transform: scale(0.96) translateY(20px) !important;
        opacity: 0 !important;

        /* Hardware Acceleration (The Secret Sauce) */
        will-change: transform, opacity;
        pointer-events: none;

        /* Apple Spring Curve */
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease-out !important;
    }

    .view.active {
        /* Incoming apps scale up to 100% and snap to position */
        transform: scale(1) translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto;

        /* Snappy Enter Curve */
        transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1), opacity 0.4s ease-in !important;
    }

    /* FIX 7: Enforce Role-Based Access Control (RBAC) on Mobile Nav */
    .nav-item[style*="display: none"],
    .nav-item[style*="display: none;"] {
        display: none !important;
    }
}