/* =============================================================================
   GATEWAY PRO — GLOBAL CUSTOM STYLESHEET
   Estate Access Management System (c:/laragon/www/perfex/)
   Loaded universally by Perfex CRM across: Admin, Client/Resident, & Guard portals.
   ─────────────────────────────────────────────────────────────────────────────
   ARCHITECTURE:
   ① Global Design Token Anchors
   ② Absolute Width Defense — Kill Horizontal Scrollbars at Root
   ③ DataTables Scroll Container Suppression
   ④ Master Responsive Interceptor (≤1024px)
      └─ Responsive Card Matrix Transposition
         ├─ Grid Deconstruction (table → block)
         ├─ Header Suppression
         ├─ Row → Floating Asset Card
         ├─ Cell → Key-Value Row (flex)
         └─ Dynamic Context Labels (:before pseudo-elements)
   ⑤ Per-Table Column Label Maps (nth-child)
      ├─ Admin: Master Visitor Ledger  (.metrics-table-layout)
      ├─ Admin: Estate Unit Registry   (.dt-table.scroll-responsive — units)
      ├─ Admin: Security Roster        (.dt-table.scroll-responsive — security)
      ├─ Admin: Gate Settings          (.dt-table.scroll-responsive — settings)
      ├─ Guard: Expected Arrivals      (.dt-arrivals-table)
      └─ Guard: Access Ledger          (shared .dt-table via terminal/logs)
   ⑥ DataTables Control Bar Responsive Fixes
   ⑦ Utility Fine-Tuning
   ============================================================================= */


/* ─────────────────────────────────────────────────────────────────────────────
   ① GLOBAL DESIGN TOKEN ANCHORS
   Mirrors the Deep Teal colour system used across all portals so that
   pseudo-element labels remain visually consistent everywhere.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    --gp-teal-dark:    #0f766e;
    --gp-teal-hover:   #0d9488;
    --gp-teal-light:   #f0fdfa;
    --gp-surface:      #ffffff;
    --gp-canvas:       #f8fafc;
    --gp-border:       #e2e8f0;
    --gp-border-light: #f1f5f9;
    --gp-text-main:    #0f172a;
    --gp-text-body:    #334155;
    --gp-text-muted:   #64748b;
    --gp-shadow-soft:  0 1px 3px rgba(15, 23, 42, 0.02);
    --gp-radius-card:  12px;
    --gp-radius-row:   10px;
    --gp-font-display: 'Outfit', sans-serif;
    --gp-font-body:    'Inter', sans-serif;
    --gp-label-color:  #475569;
    --gp-label-size:   10px;
}


/* ─────────────────────────────────────────────────────────────────────────────
   ② ABSOLUTE WIDTH DEFENSE — Kill Horizontal Scrollbars at Root Layer
   Targets every scroll container class that DataTables and Bootstrap
   inject into the DOM, forcing them to be strictly viewport-width contained.
   ───────────────────────────────────────────────────────────────────────────── */
.dataTables_wrapper,
.dataTables_scrollBody,
.dataTables_scrollHead,
.dataTables_scrollHeadInner,
.table-responsive {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Prevent bare tables from punching through their containers */
.dataTables_wrapper table,
.table-responsive table {
    table-layout: auto;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}


/* ─────────────────────────────────────────────────────────────────────────────
   ③ DATATABLES SCROLL CONTAINER SUPPRESSION
   DataTables with scrollX enabled builds its own scroll wrapper DOM nodes.
   Flatten them all so no stray horizontal bar can appear.
   ───────────────────────────────────────────────────────────────────────────── */
.dataTables_scrollBody::-webkit-scrollbar,
.dataTables_scrollHead::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.dataTables_scrollBody,
.dataTables_scrollHead {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}


/* ─────────────────────────────────────────────────────────────────────────────
   ④ MASTER RESPONSIVE INTERCEPTOR  @media ≤ 1024px
   ─────────────────────────────────────────────────────────────────────────────
   At this breakpoint (split-pane tablet width and below) ALL DataTables /
   Bootstrap tables are transposed from a wide horizontal grid into a
   vertically-stacked Responsive Card Matrix.

   The transformation cascade:
   ┌─ thead / .dataTables_scrollHead → HIDDEN
   ├─ table / tbody / tr → display:block (collapse the grid)
   ├─ tr → styled as a floating card panel
   └─ td → display:flex key-value row with :before label injection
   ───────────────────────────────────────────────────────────────────────────── */
@media screen and (max-width: 1024px) {

    /* ── Wrapper containers: absolutely no horizontal overflow ── */
    .dataTables_wrapper,
    .dataTables_scrollBody,
    .dataTables_scrollHead,
    .dataTables_scrollHeadInner,
    .table-responsive {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* ── STEP 1: Suppress All Table Header Zones ── */
    .table-responsive table thead,
    .dataTables_wrapper table thead,
    table.dataTable thead,
    .dataTables_scrollHead,
    .dataTables_scrollHeadInner {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* ── STEP 2: Deconstruct the Native Grid ──
       Force table, tbody, tr, td into full-width block layout.
       This completely collapses horizontal table columns into a vertical stack. */
    .table-responsive table,
    .dataTables_wrapper table,
    table.dataTable,
    table.dt-table,
    table.dt-arrivals-table,
    table.saas-table,
    .table-responsive tbody,
    .dataTables_wrapper tbody,
    table.dataTable tbody,
    table.dt-table tbody,
    table.dt-arrivals-table tbody,
    table.saas-table tbody {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: none !important;
    }

    /* ── STEP 3: Transform Rows into Unified Asset Cards ──
       Each <tr> becomes a self-contained floating card that matches
       our Deep Teal design system's floating component panels. */
    .table-responsive table tbody tr,
    .dataTables_wrapper table tbody tr,
    table.dataTable tbody tr,
    table.dt-table tbody tr,
    table.dt-arrivals-table tbody tr,
    table.saas-table tbody tr {
        display: block !important;
        width: 100% !important;
        background: var(--gp-surface) !important;
        border: 1px solid var(--gp-border) !important;
        border-radius: var(--gp-radius-row) !important;
        padding: 12px 16px !important;
        margin-bottom: 12px !important;
        box-shadow: var(--gp-shadow-soft) !important;
        box-sizing: border-box !important;
        /* Smooth appearance on reflow */
        transition: box-shadow 0.15s ease, border-color 0.15s ease !important;
    }

    .table-responsive table tbody tr:hover,
    .dataTables_wrapper table tbody tr:hover,
    table.dataTable tbody tr:hover,
    table.dt-table tbody tr:hover,
    table.dt-arrivals-table tbody tr:hover {
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
        border-color: #cbd5e1 !important;
    }

    /* Remove the last card's bottom margin to avoid extra trailing space */
    .table-responsive table tbody tr:last-child,
    .dataTables_wrapper table tbody tr:last-child,
    table.dataTable tbody tr:last-child,
    table.dt-table tbody tr:last-child {
        margin-bottom: 0 !important;
    }

    /* ── STEP 4: Key-Value Cell Realignment ──
       Each <td> becomes a horizontal key-value row:
       [LABEL (bold, left)]   [VALUE (right-aligned or natural)] */
    .table-responsive table tbody tr td,
    .dataTables_wrapper table tbody tr td,
    table.dataTable tbody tr td,
    table.dt-table tbody tr td,
    table.dt-arrivals-table tbody tr td,
    table.saas-table tbody tr td {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        width: 100% !important;
        padding: 8px 0 !important;
        border: none !important;
        border-bottom: 1px solid var(--gp-border-light) !important;
        box-sizing: border-box !important;
        text-align: left !important;
        font-size: 13.5px !important;
        color: var(--gp-text-body) !important;
        min-height: auto !important;
        white-space: normal !important; /* Allow wrapping on mobile */
        word-break: break-word !important;
    }

    /* Remove bottom border on the very last cell so card feels clean */
    .table-responsive table tbody tr td:last-child,
    .dataTables_wrapper table tbody tr td:last-child,
    table.dataTable tbody tr td:last-child,
    table.dt-table tbody tr td:last-child,
    table.dt-arrivals-table tbody tr td:last-child {
        border-bottom: none !important;
        padding-bottom: 4px !important;
    }

    /* Override any text-right alignment set on columns — cards handle it via flex */
    .table-responsive table tbody tr td.text-right,
    table.dataTable tbody tr td.text-right,
    table.dt-table tbody tr td.text-right {
        text-align: left !important;
    }

    /* ── STEP 5: Dynamic Context Labels — :before pseudo-elements ──
       Since headers are hidden, CSS :before injects the field name inline
       on the left margin of every cell row, creating a live key-value map.

       General shared rule — :before is the label "key" node.
       Each terminal-specific section below maps nth-child → column name. */
    .table-responsive table tbody tr td:before,
    .dataTables_wrapper table tbody tr td:before,
    table.dataTable tbody tr td:before,
    table.dt-table tbody tr td:before,
    table.dt-arrivals-table tbody tr td:before,
    table.saas-table tbody tr td:before {
        content: attr(data-label);  /* Falls back to data-label if present */
        font-family: var(--gp-font-display) !important;
        font-size: var(--gp-label-size) !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.07em !important;
        color: var(--gp-label-color) !important;
        margin-bottom: 4px !important;
        margin-right: 0 !important;
        line-height: 1.2 !important;
        text-align: left !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        display: block !important;
    }

    /* Empty-state / colspan cells should never show a label */
    .table-responsive table tbody tr td[colspan]:before,
    table.dataTable tbody tr td[colspan]:before,
    table.dt-table tbody tr td[colspan]:before,
    table.dt-arrivals-table tbody tr td[colspan]:before {
        content: '' !important;
        display: none !important;
    }

    /* Cells that hold action buttons should show ACTIONS label above them */
    .table-responsive table tbody tr td.not-export:before,
    table.dataTable tbody tr td:last-child:before {
        content: 'ACTIONS:' !important;
        display: block !important;
        margin-bottom: 4px !important;
    }

} /* end @media ≤1024px */


/* ─────────────────────────────────────────────────────────────────────────────
   ⑤ PER-TABLE COLUMN LABEL MAPS (nth-child selectors)
   ─────────────────────────────────────────────────────────────────────────────
   We use nth-child(n) to target specific columns because CSS :before
   cannot read DOM text content at run-time — the column index is the
   only reliable hook when data-label attributes are not set.

   Structure: td:nth-child(N):before { content: 'LABEL:'; }
   ───────────────────────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────
   A) MASTER VISITOR LEDGER  (.metrics-table-layout & .terminal-main-content-pool table.dt-table)
   Admin Portal → Access → Visitor Ledger
   Guard Portal → Access Ledger
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    /* Tab 1: All Activity */
    #all_activity table.metrics-table-layout tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(3):before { content: 'LICENSE PLATE:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(4):before { content: 'RESIDENT & UNIT:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(6):before { content: 'TIMELOG:' !important; }
    #all_activity table.metrics-table-layout tbody tr td:nth-child(7):before { content: 'ACTIONS:' !important; }

    /* Tab 2: Currently Inside */
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(3):before { content: 'LICENSE PLATE:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(4):before { content: 'RESIDENT & UNIT:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(6):before { content: 'CHECK-IN:' !important; }
    #currently_inside_tab table.metrics-table-layout tbody tr td:nth-child(7):before { content: 'ACTIONS:' !important; }

    /* Tab 3: Overstays */
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(3):before { content: 'LICENSE PLATE:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(4):before { content: 'RESIDENT & UNIT:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(6):before { content: 'OVERSTAY TIME:' !important; }
    #overstays_tab table.metrics-table-layout tbody tr td:nth-child(7):before { content: 'ACTIONS:' !important; }

    /* Tab 4: Denial Ledger */
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(3):before { content: 'CHECKPOINT / GUARD:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(4):before { content: 'RESIDENT & UNIT:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(6):before { content: 'DENIAL REASON:' !important; }
    #denial_ledger_tab table.metrics-table-layout tbody tr td:nth-child(7):before { content: 'REJECTION TIME:' !important; }

    /* Guard terminal Access Ledger */
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(3):before { content: 'LICENSE PLATE:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(4):before { content: 'RESIDENT & UNIT:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(6):before { content: 'TIMELOG:' !important; }
    .terminal-main-content-pool table.dt-table tbody tr td:nth-child(7):before { content: 'ACTIONS:' !important; }

    /* Status-colored row cards */
    .table-responsive table tbody tr.ledger-row-card,
    .dataTables_wrapper table tbody tr.ledger-row-card {
        border-left: 4px solid var(--gp-border) !important;
        position: relative !important;
    }
    
    /* Inside / Active (Teal border) */
    .table-responsive table tbody tr.ledger-row-card.badge-status-inside,
    .dataTables_wrapper table tbody tr.ledger-row-card.badge-status-inside {
        border-left: 4px solid var(--gp-teal-dark) !important;
    }
    
    /* Denied / Expired / Overstays (Danger red border) */
    .table-responsive table tbody tr.ledger-row-card.badge-status-denied,
    .dataTables_wrapper table tbody tr.ledger-row-card.badge-status-denied {
        border-left: 4px solid #ef4444 !important;
    }
    
    /* Checked Out / Pending (Muted gray border) */
    .table-responsive table tbody tr.ledger-row-card.badge-status-out,
    .dataTables_wrapper table tbody tr.ledger-row-card.badge-status-out {
        border-left: 4px solid var(--gp-text-muted) !important;
    }
    
    /* Header background status styling for first child (Pass Code cell) */
    table.metrics-table-layout tbody tr.ledger-row-card td:first-child {
        background-color: var(--gp-teal-light) !important;
        margin: -12px -16px 12px -16px !important;
        padding: 12px 16px !important;
        border-top-left-radius: var(--gp-radius-row) !important;
        border-top-right-radius: var(--gp-radius-row) !important;
        border-bottom: 1px solid var(--gp-border) !important;
        width: calc(100% + 32px) !important;
        display: block !important;
    }
    table.metrics-table-layout tbody tr.ledger-row-card td:first-child:before {
        display: block !important;
        margin-bottom: 6px !important;
    }
    table.metrics-table-layout tbody tr.ledger-row-card td:first-child > div {
        display: inline-flex !important;
        vertical-align: middle !important;
        align-items: center !important;
        margin-top: 0 !important;
    }
    table.metrics-table-layout tbody tr.ledger-row-card td:first-child > div + div {
        margin-left: 8px !important;
    }
    
    /* Specific header colors per status */
    table.metrics-table-layout tbody tr.ledger-row-card.badge-status-inside td:first-child {
        background-color: #ecfdf5 !important;
        border-bottom-color: #a7f3d0 !important;
    }
    table.metrics-table-layout tbody tr.ledger-row-card.badge-status-denied td:first-child {
        background-color: #fef2f2 !important;
        border-bottom-color: #fecaca !important;
    }
    table.metrics-table-layout tbody tr.ledger-row-card.badge-status-out td:first-child {
        background-color: var(--gp-border-light) !important;
        border-bottom-color: var(--gp-border) !important;
    }

    /* Enforce 44px click target on action buttons inside logs cards */
    .table-responsive table tbody tr td .action-icon-btn,
    table.dataTable tbody tr td .action-icon-btn,
    table.dt-table tbody tr td .action-icon-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 4px 0 !important;
    }
}

/* ──────────────────────────────────────────
   B) ESTATE UNIT REGISTRY  (table.units-table)
   Admin Portal → Access → Estate Unit Registry
   Columns: Unit Address | Block | Unit Type | Resident Account | Occupancy | Actions
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    table.units-table tbody tr td:nth-child(1):before { content: 'ADDRESS:' !important; }
    table.units-table tbody tr td:nth-child(2):before { content: 'BLOCK:' !important; }
    table.units-table tbody tr td:nth-child(3):before { content: 'UNIT TYPE:' !important; }
    table.units-table tbody tr td:nth-child(4):before { content: 'RESIDENT:' !important; }
    table.units-table tbody tr td:nth-child(5):before { content: 'OCCUPANCY:' !important; }
    table.units-table tbody tr td:nth-child(6):before { content: 'ACTIONS:' !important; }
}

/* ──────────────────────────────────────────
   C) SECURITY STAFF ROSTER  (table.security-roster-table)
   Admin Portal → Access → Security Staff
   Columns: Guard Name | Email Address | Status | Assigned Checkpoint
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    table.security-roster-table tbody tr td:nth-child(1):before { content: 'GUARD NAME:' !important; }
    table.security-roster-table tbody tr td:nth-child(2):before { content: 'EMAIL:' !important; }
    table.security-roster-table tbody tr td:nth-child(3):before { content: 'STATUS:' !important; }
    table.security-roster-table tbody tr td:nth-child(4):before { content: 'CHECKPOINT:' !important; }
}

/* ──────────────────────────────────────────
   D) GATE CHECKPOINTS SETTINGS TABLE  (table.checkpoints-table)
   Admin Portal → Access → Settings → Gatehouse Rules
   Columns: Checkpoint Name | Status | Actions
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    table.checkpoints-table tbody tr td:nth-child(1):before { content: 'CHECKPOINT:' !important; }
    table.checkpoints-table tbody tr td:nth-child(2):before { content: 'STATUS:' !important; }
    table.checkpoints-table tbody tr td:nth-child(3):before { content: 'ACTIONS:' !important; }
}

/* ──────────────────────────────────────────
   E) GUARD TERMINAL — EXPECTED ARRIVALS  (table.dt-arrivals-table)
   Guard Portal → Expected Arrivals
   Columns: Pass Code | Visitor Details | License Plate |
            Destination (Host) | Status | Valid Until | Action
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    table.dt-arrivals-table tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(3):before { content: 'LICENSE PLATE:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(4):before { content: 'DESTINATION:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(5):before { content: 'STATUS:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(6):before { content: 'VALID UNTIL:' !important; }
    table.dt-arrivals-table tbody tr td:nth-child(7):before { content: 'ACTION:' !important; }
}

/* ──────────────────────────────────────────
   G) DASHBOARD ACTIVITY TABLE  (table#dashboard_activity_table)
   Admin Portal → Overview Dashboard → Recent Activity
   Columns: Checkbox (Hidden) | Visitor | Host | Unit | Code | Time | Gate | Status
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    table#dashboard_activity_table tbody tr td:nth-child(1) {
        display: none !important;
    }
    table#dashboard_activity_table tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(3):before { content: 'HOST:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(4):before { content: 'UNIT:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(5):before { content: 'PASS CODE:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(6):before { content: 'TIME:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(7):before { content: 'GATE:' !important; }
    table#dashboard_activity_table tbody tr td:nth-child(8):before { content: 'STATUS:' !important; }
}

/* ──────────────────────────────────────────
   H) RESIDENT PORTAL — GATEPASS TABLE (household / history views)
   Resident Portal → Access History
   Generic positional labels for any table in resident layout
   ────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
    .resident-main-content-pool table tbody tr td:nth-child(1):before { content: 'PASS CODE:' !important; }
    .resident-main-content-pool table tbody tr td:nth-child(2):before { content: 'VISITOR:' !important; }
    .resident-main-content-pool table tbody tr td:nth-child(3):before { content: 'STATUS:' !important; }
    .resident-main-content-pool table tbody tr td:nth-child(4):before { content: 'ISSUED:' !important; }
    .resident-main-content-pool table tbody tr td:nth-child(5):before { content: 'EXPIRES:' !important; }
    .resident-main-content-pool table tbody tr td:nth-child(6):before { content: 'ACTIONS:' !important; }
}


/* ─────────────────────────────────────────────────────────────────────────────
   ⑥ DATATABLES CONTROL BAR RESPONSIVE FIXES
   DataTables appends its own .dataTables_wrapper layout with length + filter
   bars. These need to reflow on mobile so they don't overflow their container.
   ───────────────────────────────────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
    /* Length selector + search box: stack vertically */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none !important;
        text-align: left !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        box-sizing: border-box !important;
    }

    .dataTables_wrapper .dataTables_length select {
        width: auto !important;
        min-width: 60px !important;
    }

    /* Pagination: allow wrapping instead of breaking layout */
    .dataTables_wrapper .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        margin-top: 12px !important;
    }

    /* Info text: full width */
    .dataTables_wrapper .dataTables_info {
        float: none !important;
        text-align: center !important;
        margin-top: 8px !important;
        font-size: 12px !important;
    }

    /* Swipeable filter tab pills on mobile screens */
    .pill-filter-group {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        width: 100% !important;
        padding: 4px 0 8px 0 !important;
        gap: 8px !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .pill-filter-group::-webkit-scrollbar {
        display: none !important;
    }
    .filter-pill-btn {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    /* Flatten table wrappers and container cards inside tab sheets on mobile */
    .tab-content .ops-center-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .tab-content .table-responsive, 
    .tab-content .dataTables_wrapper {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}

/* Extra tight clamp for very narrow screens (≤480px) */
@media screen and (max-width: 480px) {
    /* Card cards get tighter padding on phones */
    .table-responsive table tbody tr,
    .dataTables_wrapper table tbody tr,
    table.dataTable tbody tr,
    table.dt-table tbody tr,
    table.dt-arrivals-table tbody tr {
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    .table-responsive table tbody tr td,
    .dataTables_wrapper table tbody tr td,
    table.dataTable tbody tr td,
    table.dt-table tbody tr td,
    table.dt-arrivals-table tbody tr td {
        font-size: 12.5px !important;
        padding: 6px 0 !important;
        min-height: 32px !important;
    }

    .table-responsive table tbody tr td:before,
    .dataTables_wrapper table tbody tr td:before,
    table.dataTable tbody tr td:before,
    table.dt-table tbody tr td:before,
    table.dt-arrivals-table tbody tr td:before {
        font-size: 9px !important;
        margin-right: 8px !important;
    }
}


/* ─────────────────────────────────────────────────────────────────────────────
   ⑦ UTILITY FINE-TUNING
   ───────────────────────────────────────────────────────────────────────────── */

/* Ensure action icon buttons inside cards don't break the flex row */
@media screen and (max-width: 1024px) {
    .table-responsive table tbody tr td .action-icon-btn,
    table.dataTable tbody tr td .action-icon-btn,
    table.dt-table tbody tr td .action-icon-btn,
    .table-responsive table tbody tr td .btn-unit-action,
    table.dt-table tbody tr td .btn-unit-action,
    .table-responsive table tbody tr td .btn,
    table.dataTable tbody tr td .btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    /* Prevent badge pill wrapping inside narrow card cells */
    .table-responsive table tbody tr td .badge-ops-pill,
    table.dt-table tbody tr td .badge-ops-pill,
    table.dt-arrivals-table tbody tr td .badge-status-expected {
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    /* Stacked text blocks (two-line cells): keep stacked inside flex column */
    .table-responsive table tbody tr td .stacked-primary-text,
    table.dt-table tbody tr td .stacked-primary-text,
    table.dt-arrivals-table tbody tr td div {
        text-align: left !important;
    }

    /* Monospace codes: stay readable at left-edge */
    .table-responsive table tbody tr td .stacked-primary-text[style*="monospace"],
    table.dt-table tbody tr td div[style*="monospace"],
    table.dt-arrivals-table tbody tr td .monospace-badge {
        font-family: monospace !important;
        letter-spacing: 0.04em !important;
        font-weight: 600 !important;
        font-size: 13px !important;
        text-align: left !important;
    }

    /* Forms embedded in table cells (gate assignment dropdowns) */
    .table-responsive table tbody tr td .form-inline-assignment,
    table.dt-table tbody tr td .form-inline-assignment {
        width: 100% !important;
        text-align: left !important;
    }

    .table-responsive table tbody tr td .gate-select-wrapper,
    table.dt-table tbody tr td .gate-select-wrapper {
        width: 100% !important;
    }

    .table-responsive table tbody tr td .gate-select-wrapper .selectpicker,
    table.dt-table tbody tr td .gate-select-wrapper select {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }

    /* Empty-state rows: centre everything, no flex justification */
    .table-responsive table tbody tr td[colspan],
    table.dataTable tbody tr td[colspan],
    table.dt-table tbody tr td[colspan],
    table.dt-arrivals-table tbody tr td[colspan] {
        display: block !important;
        text-align: center !important;
        justify-content: center !important;
        border-bottom: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 24px 16px !important;
    }
}

/* ─── Ensure the .saas-table-container containing the dashboard activity
       table does not create its own horizontal scroll ─── */
.saas-table-container {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

.metrics-toggle-bar-mobile,
.segmented-capsule-nav {
    display: none !important;
}

/* =============================================================================
   ⑧ MOBILE-FIRST WEB APP OVERRIDES (<768px)
   ============================================================================= */
@media screen and (max-width: 767px) {
    /* Hide desktop sidebars, mobile drawers, and native headers */
    /* Admin sidebar and header */
    #menu.sidebar,
    #setup-menu-wrapper,
    #header,
    .premium-global-header {
        display: none !important;
    }
    /* Resident sidebar and drawer */
    .desktop-resident-sidebar,
    .mobile-menu-trigger,
    .mobile-nav-drawer,
    .drawer-overlay,
    .resident-nav-bar {
        display: none !important;
    }
    /* Guard sidebar */
    .terminal-left-sidebar,
    .guard-mobile-header,
    .guard-mobile-drawer,
    .guard-drawer-overlay-shield {
        display: none !important;
    }

    /* Content offsets calibration */
    #wrapper,
    .resident-main-content-pool,
    .terminal-main-content-pool {
        margin-left: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        padding: 16px 16px 80px 16px !important; /* bottom padding clears the 64px nav bar */
        background-color: #F8FAFC !important;
    }

    /* Flatten Content Canvas Backdrops */
    .panel_s, 
    .panel-body,
    .premium-terminal-card,
    .resident-welcome-card,
    .invite-item-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 20px !important;
    }

    /* Let individual element cards float directly on the slate-gray background canvas (#F8FAFC) */
    .card, 
    .panel_s {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Outer screen container padding reduction to 16px */
    .container, 
    .container-fluid {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Ensure table wrappers look like clean cards floating on F8FAFC */
    .table-responsive, 
    .dataTables_wrapper {
        background: #FFFFFF !important;
        border: 1px solid #E2E8F0 !important;
        border-radius: 12px !important;
        padding: 16px !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02) !important;
    }

    /* Fixed Bottom Navigation Bar */
    .gp-mobile-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 64px !important;
        background: #FFFFFF !important;
        border-top: 1px solid #E2E8F0 !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        box-shadow: 0 -4px 10px rgba(15, 23, 42, 0.03) !important;
        box-sizing: border-box !important;
    }

    /* Nav Item Touchpoints */
    .gp-mobile-bottom-nav .nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        height: 100% !important;
        color: #64748B !important;
        text-decoration: none !important;
        font-family: 'Inter', sans-serif !important;
        font-size: 10px !important;
        font-weight: 500 !important;
        gap: 0 !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .gp-mobile-bottom-nav .nav-item svg,
    .gp-mobile-bottom-nav .nav-item i {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 2 !important;
        transition: stroke 0.2s ease !important;
        margin: 0 !important;
    }

    .gp-mobile-bottom-nav .nav-item:hover,
    .gp-mobile-bottom-nav .nav-item.active {
        color: #0f766e !important; /* Deep Teal matching design tokens */
    }

    /* Prominent Center Action Button in Bottom Nav */
    .gp-mobile-bottom-nav .nav-item.center-action-btn {
        flex: 1 !important;
        position: relative !important;
    }

    .gp-mobile-bottom-nav .nav-item.center-action-btn .center-btn-inner {
        width: 48px !important;
        height: 48px !important;
        border-radius: 50% !important;
        background: #0f766e !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #FFFFFF !important;
        box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3) !important;
        margin-top: -20px !important; /* Floats slightly above the bar */
        border: 4px solid #FFFFFF !important;
        transition: all 0.2s ease !important;
    }

    .gp-mobile-bottom-nav .nav-item.center-action-btn .center-btn-inner svg {
        width: 20px !important;
        height: 20px !important;
        color: #FFFFFF !important;
    }

    .gp-mobile-bottom-nav .nav-item.center-action-btn:hover .center-btn-inner {
        background: #0d9488 !important;
        transform: scale(1.05) !important;
    }

    /* Floating Action Button (FAB) */
    .gp-mobile-fab {
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        background: #0F172A !important; /* Dark Slate Gray */
        position: fixed !important;
        bottom: 80px !important;
        right: 16px !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #FFFFFF !important;
        border: none !important;
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25) !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        outline: none !important;
    }

    .gp-mobile-fab svg {
        width: 24px !important;
        height: 24px !important;
        color: #FFFFFF !important;
    }

    .gp-mobile-fab:hover {
        background: #1E293B !important;
        transform: scale(1.05) !important;
    }

    /* Transition to Iconic Components */
    /* Strip out text string actions on mobile widths */
    .res-btn-remove span,
    .tray-action-btn span,
    .btn-edit-unit span,
    .btn-delete-unit span,
    .btn-edit-gate span,
    .btn-delete-gate span,
    .btn-action-text {
        display: none !important;
    }
    
    /* Ensure all mobile buttons enforce an absolute minimum touch target boundary of 44px x 44px */
    .res-btn-remove,
    .tray-action-btn,
    .btn-unit-action,
    .btn-edit-unit,
    .btn-delete-unit,
    .btn-gate-action,
    .btn-edit-gate,
    .btn-delete-gate,
    table.dataTable tbody tr td .btn,
    table.dt-table tbody tr td .btn,
    table.dt-arrivals-table tbody tr td .btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important; /* Circular for native feel */
        box-sizing: border-box !important;
        margin: 4px !important;
    }

    .res-btn-remove i,
    .tray-action-btn i,
    .btn-unit-action i,
    .btn-edit-unit i,
    .btn-delete-unit i,
    table.dataTable tbody tr td .btn i,
    table.dt-table tbody tr td .btn i {
        margin: 0 !important;
        font-size: 16px !important;
    }

    /* Condense Status Indicators */
    .status-pill,
    .resident-pill-badge,
    .gate-status-badge,
    .badge-active,
    .badge-offline,
    .badge-occupied,
    .badge-vacant {
        font-size: 0 !important; /* Hide label text */
        padding: 0 !important;
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: none !important;
        line-height: 0 !important;
        box-shadow: none !important;
    }
    
    .status-pill::before,
    .resident-pill-badge::before,
    .gate-status-badge::before,
    .badge-active::before,
    .badge-offline::before,
    .badge-occupied::before,
    .badge-vacant::before {
        content: "●" !important;
        font-size: 12px !important;
        line-height: 1 !important;
    }

    /* Force specific background/colors for dots on mobile viewports */
    .res-pill-inside, .approved, .badge-active, .badge-occupied {
        background-color: #ECFDF5 !important;
        color: #10B981 !important;
    }
    .res-pill-expected {
        background-color: #f0fdfa !important;
        color: #0d9488 !important;
    }
    .res-pill-denied, .denied {
        background-color: #FEF2F2 !important;
        color: #EF4444 !important;
    }
    .res-pill-checkout, .expired, .revoked, .badge-offline, .badge-vacant {
        background-color: #F1F5F9 !important;
        color: #64748B !important;
    }
}

/* =============================================================================
   ADMIN MOBILE BOTTOM NAVIGATION BAR & HUB
   ============================================================================= */

/* Main fixed wrapper */
.mobile-footer-navbar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 64px !important;
    background-color: #FFFFFF !important;
    border-top: 1px solid #E2E8F0 !important;
    z-index: 99999 !important;
    display: none !important; /* Hidden on desktop, shown on mobile */
    justify-content: space-around !important;
    align-items: center !important;
    box-shadow: 0 -4px 6px -1px rgba(15, 23, 42, 0.03) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    box-sizing: border-box !important;
}

/* Individual nav slots */
.mobile-footer-navbar .nav-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #1E293B !important; /* Slate-800 for high contrast/UX ease */
    width: 25% !important;
    height: 100% !important;
    transition: all 0.2s ease-in-out !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.mobile-footer-navbar .nav-slot i,
.mobile-footer-navbar .nav-slot svg {
    width: 28px !important; /* Bigger for UX ease */
    height: 28px !important;
    stroke-width: 2.2 !important; /* Darker outline stroke */
    transition: all 0.2s ease-in-out !important;
}

/* Zoom effect on hover */
.mobile-footer-navbar .nav-slot:hover i,
.mobile-footer-navbar .nav-slot:hover svg {
    transform: scale(1.1) !important;
    color: #0f766e !important;
}

/* Active states for slots */
.mobile-footer-navbar .nav-slot.active {
    color: #0f766e !important; /* Signature teal */
}

.mobile-footer-navbar .nav-slot.active i,
.mobile-footer-navbar .nav-slot.active svg {
    stroke: #0f766e !important;
    transform: scale(1.05) !important;
}

/* Floating Action Button (FAB) */
.mobile-urgent-pass-fab {
    position: fixed !important;
    bottom: 80px !important;
    right: 20px !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background-color: #0f766e !important; /* Brand Teal */
    color: #FFFFFF !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3) !important;
    display: none !important; /* Hidden on desktop */
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 99999 !important;
    transition: all 0.2s ease-in-out !important;
    outline: none !important;
}

.mobile-urgent-pass-fab:hover,
.mobile-urgent-pass-fab:active {
    background-color: #0d9488 !important;
    box-shadow: 0 6px 18px rgba(15, 118, 110, 0.4) !important;
    transform: scale(1.08) !important;
}

.mobile-urgent-pass-fab i,
.mobile-urgent-pass-fab svg {
    width: 26px !important;
    height: 26px !important;
    stroke: #FFFFFF !important;
    stroke-width: 2.5 !important;
}

/* --- QUICK ACTIONS DRAWER OVERLAY --- */
.drawer-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(15, 23, 42, 0.5) !important; /* Faded background mask to 50% */
    z-index: 99998 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out !important;
}

.drawer-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- THE SLIDE-UP DRAWER --- */
.quick-actions-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background-color: #FFFFFF !important;
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
    box-shadow: 0 -10px 25px -5px rgba(15, 23, 42, 0.1) !important;
    z-index: 99999 !important;
    transform: translateY(100%) !important; /* Hidden below viewport boundary */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
}

.quick-actions-drawer.drawer-open {
    transform: translateY(0) !important; /* Slide up cleanly */
}

/* Handle bar wrapper */
.quick-actions-drawer .drawer-handle-wrap {
    width: 100% !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: grab !important;
}

.quick-actions-drawer .drawer-handle {
    width: 40px !important;
    height: 4px !important;
    background-color: #E2E8F0 !important;
    border-radius: 2px !important;
}

/* Drawer content */
.quick-actions-drawer .drawer-content {
    padding: 0 24px 8px 24px !important;
}

.quick-actions-drawer .drawer-title {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #0F172A !important;
    margin-top: 0 !important;
    margin-bottom: 16px !important;
    text-align: center !important;
}

.quick-actions-drawer .drawer-content .drawer-actions-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

/* Actions buttons inside drawer */
.quick-actions-drawer .drawer-action-btn {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 14px 16px !important;
    background-color: #F8FAFC !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
    text-align: left !important;
    outline: none !important;
}

.quick-actions-drawer .drawer-action-btn:hover,
.quick-actions-drawer .drawer-action-btn:active {
    background-color: #f0fdfa !important; /* light teal */
    border-color: #0f766e !important;
    color: #0f766e !important;
}

/* Responsive display rule: Show bottom nav only on mobile screen <= 768px */
@media screen and (max-width: 768px) {
    .mobile-footer-navbar {
        display: flex !important;
    }

    .mobile-urgent-pass-fab {
        display: flex !important;
    }
    
    /* Push content up to avoid being hidden behind bottom footer navbar */
    body.admin {
        padding-bottom: 80px !important;
    }
    
    /* Hide the old bottom nav bar if it is present */
    .gp-mobile-bottom-nav,
    .gp-mobile-fab {
        display: none !important;
        visibility: hidden !important;
    }
}

/* --- METRIC CARDS TOGGLE HOVER EFFECT & INTERACTION --- */
.ops-center-card.metric-toggle-card {
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.2s ease-in-out !important;
}

.ops-center-card.metric-toggle-card:hover {
    border-color: var(--gp-teal-dark) !important;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.08) !important;
}

.ops-center-card.metric-toggle-card:hover .metric-toggle-icon {
    color: var(--gp-teal-dark) !important;
    transform: scale(1.1) !important;
}

/* --- MOBILE LOGS CARD LIST (MINIMALISTIC REDESIGN) --- */
@media screen and (max-width: 768px) {
    /* Hide desktop table structure completely on mobile for visitor logs tabs */
    .tab-content .table-responsive,
    .tab-content table.dataTable,
    .tab-content .dataTables_info,
    .tab-content .dataTables_paginate,
    .pill-filter-group {
        display: none !important;
    }

    .mobile-logs-list {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 4px 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .mobile-log-card-row {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 56px !important;
        max-height: 56px !important;
        background: #FFFFFF !important;
        border-radius: 12px !important;
        padding: 0 14px !important;
        box-sizing: border-box !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
        border: 1px solid var(--gp-border-light) !important;
        cursor: pointer !important;
        transition: box-shadow 0.15s ease, border-color 0.15s ease !important;
        overflow: hidden !important;
        gap: 10px !important;
    }

    .mobile-log-card-row:hover {
        border-color: var(--gp-teal-dark) !important;
        box-shadow: 0 3px 10px -3px rgba(15, 118, 110, 0.15) !important;
    }

    /* Stacked info layout for name & code subtext */
    .mc-info-stack {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    .mc-info-stack .mc-name {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #0F172A !important;
        line-height: 1.3 !important;
        font-family: var(--gp-font-display) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    .mc-info-stack .mc-subtext {
        font-size: 11px !important;
        color: #64748B !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        line-height: 1.2 !important;
    }

    /* Target status dots specifically for mobile logs */
    .mc-dot-wrap {
        flex-shrink: 0 !important;
        width: 20px !important;
        height: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
    }

    .mc-dot {
        width: 8px !important;
        height: 8px !important;
        border-radius: 50% !important;
        display: block !important;
    }

    .mc-dot.dot-active {
        background: #22c55e !important;
    }

    .mc-dot.dot-inactive {
        background: #94a3b8 !important;
    }

    .mc-dot.dot-danger {
        background: #ef4444 !important;
    }

    /* --- MOBILE METRIC SWITCHER --- */
    .metrics-toggle-bar-mobile {
        display: flex !important;
        background: #FFFFFF !important;
        border: 1px solid #E2E8F0 !important;
        border-radius: 12px !important;
        padding: 4px !important;
        gap: 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 16px !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02) !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        background: transparent !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 10px 8px !important;
        color: #64748B !important;
        font-family: 'Outfit', sans-serif !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        outline: none !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn svg {
        width: 16px !important;
        height: 16px !important;
        stroke-width: 2.2 !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn .btn-indicator {
        width: 6px !important;
        height: 6px !important;
        border-radius: 50% !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn .btn-count {
        font-size: 10px !important;
        font-weight: 800 !important;
        background: #F1F5F9 !important;
        color: #475569 !important;
        padding: 2px 6px !important;
        border-radius: 10px !important;
        transition: all 0.2s ease !important;
        line-height: 1 !important;
    }

    /* Button Active states with matching metric colors */
    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="0"].active {
        background: #ECFDF5 !important;
        color: #065F46 !important;
    }
    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="0"].active .btn-count {
        background: #D1FAE5 !important;
        color: #065F46 !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="1"].active {
        background: #FEF2F2 !important;
        color: #991B1B !important;
    }
    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="1"].active .btn-count {
        background: #FEE2E2 !important;
        color: #991B1B !important;
    }

    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="2"].active {
        background: #FFFBEB !important;
        color: #92400E !important;
    }
    .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="2"].active .btn-count {
        background: #FEF3C7 !important;
        color: #92400E !important;
    }

    /* Hide cards by default on mobile unless active */
    .traffic-metrics-grid .ops-center-card {
        display: none !important;
    }
    .traffic-metrics-grid .ops-center-card.active-mobile-card {
        display: flex !important;
    }

    /* --- SEGMENTED CAPSULE NAV (MOBILE FILTER) --- */
    .segmented-capsule-nav {
        display: flex !important;
        background: #FFFFFF !important;
        border: 1px solid #E2E8F0 !important;
        border-radius: 30px !important;
        padding: 4px !important;
        gap: 2px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 12px !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02) !important;
    }

    .segmented-capsule-nav .segmented-nav-item {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        background: transparent !important;
        border: none !important;
        border-radius: 24px !important;
        padding: 10px 4px !important;
        color: #64748B !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        cursor: pointer !important;
        outline: none !important;
    }

    .segmented-capsule-nav .segmented-nav-item svg {
        width: 18px !important;
        height: 18px !important;
        stroke-width: 2.2 !important;
    }

    .segmented-capsule-nav .segmented-nav-item .nav-count {
        font-size: 9px !important;
        font-weight: 800 !important;
        background: #F1F5F9 !important;
        color: #475569 !important;
        padding: 2px 5px !important;
        border-radius: 8px !important;
        margin-left: 4px !important;
        line-height: 1 !important;
    }

    /* Active State for Capsule Segments */
    .segmented-capsule-nav .segmented-nav-item.active {
        background: #0f766e !important;
        color: #FFFFFF !important;
        box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25) !important;
    }

    .segmented-capsule-nav .segmented-nav-item.active .nav-count {
        background: rgba(255, 255, 255, 0.2) !important;
        color: #FFFFFF !important;
    }

    /* --- ESTATE UNITS MOBILE SWITCHER & FILTERING --- */
    .estate-units-container .metrics-toggle-bar-mobile {
        display: flex !important;
        background: #FFFFFF !important;
        border: 1px solid #E2E8F0 !important;
        border-radius: 12px !important;
        padding: 4px !important;
        gap: 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 16px !important;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02) !important;
    }

    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        background: transparent !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 10px 8px !important;
        color: #64748B !important;
        font-family: 'Outfit', sans-serif !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        outline: none !important;
    }

    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn svg {
        width: 16px !important;
        height: 16px !important;
        stroke-width: 2.2 !important;
    }

    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn .btn-count {
        font-size: 10px !important;
        font-weight: 800 !important;
        background: #F1F5F9 !important;
        color: #475569 !important;
        padding: 2px 6px !important;
        border-radius: 10px !important;
        transition: all 0.2s ease !important;
        line-height: 1 !important;
    }

    /* Active switcher button colors */
    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="0"].active {
        background: #EFF6FF !important;
        color: #1D4ED8 !important;
    }
    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="0"].active .btn-count {
        background: #DBEAFE !important;
        color: #1D4ED8 !important;
    }

    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="1"].active {
        background: #ECFDF5 !important;
        color: #047857 !important;
    }
    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="1"].active .btn-count {
        background: #D1FAE5 !important;
        color: #047857 !important;
    }

    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="2"].active {
        background: #F1F5F9 !important;
        color: #475569 !important;
    }
    .estate-units-container .metrics-toggle-bar-mobile .metric-toggle-btn[data-metric-index="2"].active .btn-count {
        background: #E2E8F0 !important;
        color: #475569 !important;
    }

    /* Hide metric cards on mobile by default unless active-mobile-card */
    .estate-units-container .roster-summary-grid .premium-unit-card {
        display: none !important;
    }
    .estate-units-container .roster-summary-grid .premium-unit-card.active-mobile-card {
        display: flex !important;
    }

    /* --- MOBILE FLOATING ACTION BUTTON (FAB) --- */
    .mobile-unit-fab {
        position: fixed !important;
        bottom: 80px !important;
        right: 20px !important;
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        background-color: #0f766e !important; /* Signature Teal */
        color: #FFFFFF !important;
        border: none !important;
        box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        z-index: 99999 !important;
        transition: all 0.2s ease-in-out !important;
        outline: none !important;
    }

    .mobile-unit-fab:hover,
    .mobile-unit-fab:active {
        background-color: #0d9488 !important;
        box-shadow: 0 6px 18px rgba(15, 118, 110, 0.4) !important;
        transform: scale(1.08) !important;
    }

    .mobile-unit-fab i,
    .mobile-unit-fab svg {
        width: 26px !important;
        height: 26px !important;
        stroke: #FFFFFF !important;
        stroke-width: 2.5 !important;
    }

    /* --- MOBILE UNIT CARD DETAILS & OCCUPANCY HIGHLIGHTS --- */
    .units-table tbody tr.unit-row-card {
        border-left: 4px solid var(--gp-border) !important;
        position: relative !important;
    }
    
    .units-table tbody tr.unit-occupied {
        border-left: 4px solid #10b981 !important; /* Emerald */
    }
    
    .units-table tbody tr.unit-vacant {
        border-left: 4px solid #64748b !important; /* Slate */
    }

    /* First column cell transposition to a beautiful header card block */
    .units-table tbody tr.unit-row-card td:first-child {
        margin: -12px -16px 12px -16px !important;
        padding: 12px 16px !important;
        border-top-left-radius: var(--gp-radius-row) !important;
        border-top-right-radius: var(--gp-radius-row) !important;
        border-bottom: 1px solid var(--gp-border) !important;
        width: calc(100% + 32px) !important;
        display: block !important;
    }

    .units-table tbody tr.unit-occupied td:first-child {
        background-color: #ecfdf5 !important; /* Light green */
        border-bottom-color: #a7f3d0 !important;
    }
    
    .units-table tbody tr.unit-vacant td:first-child {
        background-color: #f1f5f9 !important; /* Light slate */
        border-bottom-color: var(--gp-border) !important;
    }

    /* Override dynamic pseudo label for first-child cell header block */
    .units-table tbody tr.unit-row-card td:first-child:before {
        content: 'UNIT ADDRESS:' !important;
        display: block !important;
        margin-bottom: 6px !important;
    }

    /* Enforce 44px circular design for the occupancy toggle btn on mobile */
    .units-table tbody tr td .occupancy-toggle-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        box-sizing: border-box !important;
        margin: 4px !important;
    }

    .units-table tbody tr td .occupancy-toggle-btn i {
        margin: 0 !important;
        font-size: 16px !important;
    }

    /* --- SLIDE-UP BOTTOM SHEET FOR UNIT MODAL --- */
    #unitModal.modal.fade .modal-dialog,
    #unitPreviewModal.modal.fade .modal-dialog {
        margin: 0 !important;
        position: fixed !important;
        bottom: -100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        transition: bottom 0.3s ease-out !important;
        z-index: 99999 !important;
    }

    #unitModal.modal.in .modal-dialog,
    #unitPreviewModal.modal.in .modal-dialog {
        bottom: 0 !important;
    }

    #unitModal .modal-content,
    #unitPreviewModal .modal-content {
        border-radius: 20px 20px 0 0 !important;
        border: none !important;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.15) !important;
    }

    #unitModal .bottom-sheet-handle,
    #unitPreviewModal .bottom-sheet-handle {
        display: block !important;
        width: 40px !important;
        height: 4px !important;
        background-color: #e2e8f0 !important;
        border-radius: 9999px !important;
        margin: 10px auto 0 auto !important;
    }
}

/* Estate Unit Registry Desktop/Global Hide Rules */
.mobile-unit-fab,
#unitModal .bottom-sheet-handle,
#unitPreviewModal .bottom-sheet-handle {
    display: none !important;
}


