/* FruitLive Farm Management - Theme System */

/* ============================================
   BASE CSS VARIABLES (Default: Irrigation Blue)
   ============================================ */
:root {
    /* Primary Colors */
    --phoenix-primary: #0077b6;
    --phoenix-primary-rgb: 0, 119, 182;
    --phoenix-secondary: #6b7280;
    --phoenix-secondary-rgb: 107, 114, 128;
    --phoenix-success: #38b000;
    --phoenix-success-rgb: 56, 176, 0;
    --phoenix-info: #00b4d8;
    --phoenix-info-rgb: 0, 180, 216;
    --phoenix-warning: #fbbf24;
    --phoenix-warning-rgb: 251, 191, 36;
    --phoenix-danger: #ef4444;
    --phoenix-danger-rgb: 239, 68, 68;
    --phoenix-light: #f0f9ff;
    --phoenix-light-rgb: 240, 249, 255;
    --phoenix-dark: #023e8a;
    --phoenix-dark-rgb: 2, 62, 138;
    
    /* Layout Colors */
    --phoenix-body-bg: #f0f9ff;
    --phoenix-card-bg: #ffffff;
    --phoenix-text-color: #1e3a5f;
    --phoenix-border-color: #bae6fd;
    
    /* Theme-specific Colors */
    --theme-sidebar-bg: #023e8a;
    --theme-sidebar-text: rgba(255, 255, 255, 0.85);
    --theme-sidebar-active: #48cae4;
    --theme-sidebar-hover: rgba(72, 202, 228, 0.15);
    --theme-navbar-gradient: linear-gradient(135deg, #0077b6, #48cae4);
    --theme-accent: #90e0ef;
    
    /* Static Variables */
    --phoenix-border-radius: 6px;
    --phoenix-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    --phoenix-box-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --phoenix-transition: all 0.15s ease-in-out;

    /* FruitLive / portal-style tokens (colour-agnostic; primaries stay theme-driven) */
    --phoenix-primary-hover: color-mix(in srgb, var(--phoenix-primary) 82%, #0f172a);
    --fl-font-ui: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --fl-font-body: "Century Gothic", "CenturyGothic", "AppleGothic", Calibri, "Segoe UI", Roboto, sans-serif;
    --fl-border-muted: rgba(0, 0, 0, 0.08);
    --fl-border-muted-2: rgba(0, 0, 0, 0.04);
    --fl-radius-sm: 6px;
    --fl-radius-md: 8px;
    --fl-radius-lg: 12px;
    --fl-shadow-1: 0 1px 4px rgba(0, 0, 0, 0.07);
    --fl-shadow-2: 0 4px 16px rgba(0, 0, 0, 0.1);
    --fl-navbar-h: 56px;
    --fl-input-bg: color-mix(in srgb, var(--phoenix-body-bg) 70%, #f8fafc);
}

/* ============================================
   THEME TRANSITION ANIMATION
   ============================================ */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease !important;
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
[data-theme-mode="dark"] {
    --phoenix-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    --phoenix-box-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.45);
    --fl-border-muted: rgba(255, 255, 255, 0.1);
    --fl-border-muted-2: rgba(255, 255, 255, 0.06);
    --fl-input-bg: color-mix(in srgb, var(--phoenix-card-bg) 88%, #ffffff 12%);
}

[data-theme-mode="dark"] .card {
    border-color: var(--phoenix-border-color);
}

[data-theme-mode="dark"] .table {
    --bs-table-bg: var(--phoenix-card-bg);
    --bs-table-color: var(--phoenix-text-color);
    --bs-table-border-color: var(--phoenix-border-color);
}

[data-theme-mode="dark"] .modal-content {
    background-color: var(--phoenix-card-bg);
    border-color: var(--phoenix-border-color);
}

[data-theme-mode="dark"] .dropdown-menu {
    background-color: var(--phoenix-card-bg);
    border-color: var(--phoenix-border-color);
}

[data-theme-mode="dark"] .dropdown-item {
    color: var(--phoenix-text-color);
}

[data-theme-mode="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme-mode="dark"] .form-control,
[data-theme-mode="dark"] .form-select {
    background-color: var(--fl-input-bg);
    border-color: var(--fl-border-muted);
    color: var(--phoenix-text-color);
}

[data-theme-mode="dark"] .text-muted {
    color: rgba(226, 232, 240, 0.6) !important;
}

[data-theme-mode="dark"] .text-dark {
    color: var(--phoenix-text-color) !important;
}

[data-theme-mode="dark"] .bg-light {
    background-color: var(--phoenix-light) !important;
}

[data-theme-mode="dark"] .border {
    border-color: var(--phoenix-border-color) !important;
}

/* Base Styles */
body {
    font-family: var(--fl-font-body);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--phoenix-body-bg);
    color: var(--phoenix-text-color);
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4 {
    font-family: var(--fl-font-ui);
    font-weight: 700;
}

.mt-navbar {
    margin-top: var(--fl-navbar-h);
}

/* Focus visible — ring uses current theme primary */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--phoenix-primary-rgb), 0.28);
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--phoenix-primary-rgb), 0.28);
}

/* Navbar — solid dark chrome (theme sidebar colour), calmer than gradient */
.navbar {
    font-family: var(--fl-font-ui);
    background: var(--theme-sidebar-bg) !important;
    background-image: none !important;
    border-bottom: 1px solid var(--fl-border-muted);
    box-shadow: var(--fl-shadow-1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    height: var(--fl-navbar-h);
    min-height: var(--fl-navbar-h);
}

.navbar-brand {
    font-weight: 700;
    color: #ffffff !important;
}

.navbar-brand:hover {
    color: rgba(255, 255, 255, 0.92) !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
    font-weight: 600;
    font-size: 0.8125rem;
    transition: var(--phoenix-transition);
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
}

.navbar-nav .nav-link.active {
    color: #fff !important;
}

.navbar-nav .btn-link.nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
}

.navbar-nav .btn-link.nav-link:hover {
    color: #fff !important;
}

/* Sidebar - Theme Integrated */
.sidebar {
    font-family: var(--fl-font-ui);
    position: fixed;
    top: var(--fl-navbar-h);
    bottom: 0;
    left: 0;
    z-index: 101;
    padding: 0;
    background-color: var(--theme-sidebar-bg);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--fl-shadow-1);
    transition: all 0.3s ease;
    width: 280px;
    height: calc(100vh - var(--fl-navbar-h));
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.65rem 0.5rem;
    text-align: center;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.sidebar.collapsed .nav-link .fa-chevron-down {
    display: none !important;
}

.sidebar.collapsed .collapse .nav-link {
    padding-left: 1.25rem !important;
    padding-right: 1rem !important;
    font-size: 0.9rem;
    white-space: nowrap;
    margin: 0.1rem 0 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    text-align: left !important;
    justify-content: flex-start !important;
}

.sidebar.collapsed .collapse .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.sidebar.collapsed .collapse .nav-link i {
    font-size: 0.9rem;
    margin-right: 0.75rem !important;
}

/* Hide text content in collapsed sidebar */
.sidebar.collapsed .nav-link::after {
    content: '';
}

/* Hide all text nodes and non-icon elements when collapsed */
.sidebar.collapsed .nav-link {
    font-size: 0;
}

.sidebar.collapsed .nav-link i {
    font-size: 1rem;
}

.sidebar.collapsed .nav-item:has([data-bs-toggle="collapse"]) {
    position: static;
}

/* When sidebar is collapsed, hide inline submenu and show as panel */
.sidebar.collapsed .nav-item:has([data-bs-toggle="collapse"]) > .collapse {
    position: fixed !important;
    left: 70px !important;
    top: auto !important;
    background-color: var(--theme-sidebar-bg) !important;
    min-width: 220px !important;
    box-shadow: 4px 0 15px rgba(15, 23, 42, 0.25) !important;
    border-radius: 0 8px 8px 0 !important;
    padding: 0.5rem 0 !important;
    z-index: 102 !important;
    display: none !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
}

.sidebar.collapsed .nav-item:has([data-bs-toggle="collapse"]) > .collapse.show {
    display: block !important;
}

.sidebar.collapsed .nav-item:has([data-bs-toggle="collapse"]) > .collapse ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    margin-left: 0 !important;
}

.sidebar.collapsed .nav-link[data-bs-toggle="collapse"] {
    position: relative;
}

.sidebar.collapsed .nav-link[data-bs-toggle="collapse"]::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.sidebar.collapsed .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
    transform: rotate(90deg);
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin-top: auto;
}

.sidebar-footer .btn-link {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    transition: var(--phoenix-transition);
}

.sidebar-footer .btn-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-footer .toggle-text {
    display: none;
}

.sidebar.collapsed .sidebar-footer .fa-chevron-left {
    transform: rotate(180deg);
}

.sidebar .sidebar-footer .fa-chevron-left {
    transition: transform 0.3s ease;
}

.sidebar .flex-grow-1 {
    overflow-y: visible;
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-inner {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar .nav-link {
    color: var(--theme-sidebar-text);
    padding: 0.65rem 1rem;
    border-radius: var(--fl-radius-sm);
    margin: 0.15rem 0.75rem;
    font-weight: 600;
    font-size: 0.8125rem;
    transition: var(--phoenix-transition);
    display: flex;
    align-items: center;
    text-decoration: none;
    position: relative;
}

.sidebar .nav-link:hover {
    background-color: var(--theme-sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background-color: var(--theme-sidebar-active);
    color: white;
    box-shadow: 0 8px 20px rgba(var(--phoenix-primary-rgb), 0.35);
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--phoenix-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* Sidebar Collapse Enhancements */
.sidebar .nav-link .fa-chevron-down {
    transition: transform 0.3s ease;
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.7;
}

.sidebar .nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar .collapse .nav-link {
    padding-left: 2.5rem;
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0.1rem 0.75rem;
    position: relative;
}

.sidebar .collapse .nav-link::before {
    content: none;
}

.sidebar .collapse .nav-link:hover {
    color: var(--phoenix-primary);
    background-color: rgba(var(--phoenix-primary-rgb), 0.1);
    transform: translateX(2px);
}

.sidebar .collapse .nav-link:hover::before {
    background-color: var(--phoenix-primary);
    opacity: 1;
}

.sidebar .collapse .nav-link.active {
    color: var(--phoenix-primary);
    background-color: rgba(var(--phoenix-primary-rgb), 0.1);
    font-weight: 600;
}

.sidebar .collapse .nav-link.active::before {
    background-color: var(--phoenix-primary);
    opacity: 1;
}

/* User Management Section Styling */
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background-color: var(--theme-sidebar-hover);
    border: 1px solid rgba(var(--phoenix-primary-rgb), 0.2);
}

.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link:hover {
    background-color: rgba(var(--phoenix-primary-rgb), 0.25);
    color: #fff;
    border-color: rgba(var(--phoenix-primary-rgb), 0.35);
}

.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link[aria-expanded="true"] {
    background-color: rgba(var(--phoenix-primary-rgb), 0.25);
    color: #fff;
    border-color: rgba(var(--phoenix-primary-rgb), 0.35);
}

/* Main Content Area */
.main-content {
    background-color: var(--phoenix-body-bg);
    min-height: 100vh;
    padding: 0.75rem 1.5rem 2rem;
    margin-left: 280px;
    transition: all 0.3s ease;
    width: calc(100% - 280px) !important;
    max-width: none !important;
    flex: 0 0 auto !important;
}

.main-content.sidebar-collapsed {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

/* Override Bootstrap column classes */
.main-content.col-md-9,
.main-content.col-lg-10 {
    flex: 0 0 auto !important;
    max-width: none !important;
}

/* Content Area - Remove any default padding */
#content-area {
    padding-top: 0;
    margin-top: 0;
}

/* Cards - Phoenix Style */
.card {
    border: 1px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-lg);
    box-shadow: var(--fl-shadow-1);
    background-color: var(--phoenix-card-bg);
    color: var(--phoenix-text-color);
    transition: var(--phoenix-transition);
}

.card:hover {
    box-shadow: var(--fl-shadow-2);
}

.card-header {
    background-color: var(--phoenix-light);
    border-bottom: 1px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-lg) var(--fl-radius-lg) 0 0 !important;
    font-family: var(--fl-font-ui);
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--phoenix-text-color);
}

[data-bs-theme="dark"] .card-header {
    background-color: var(--phoenix-dark);
}

/* Buttons - Phoenix Style. Pill-shaped (matches fl-btn-primary / fl-btn-ghost). */
.btn {
    font-family: var(--fl-font-ui);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.2;
    transition: var(--phoenix-transition);
    border: 1px solid transparent;
    padding: 0.45rem 1rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.55rem 1.15rem;
    font-size: 0.875rem;
}

.btn-primary {
    font-weight: 700;
    background-color: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: white;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--phoenix-primary-hover);
    border-color: var(--phoenix-primary-hover);
    color: #fff;
}

.btn-secondary {
    background-color: var(--phoenix-secondary);
    border-color: var(--phoenix-secondary);
    color: white;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background-color: color-mix(in srgb, var(--phoenix-secondary) 82%, #0f172a);
    border-color: color-mix(in srgb, var(--phoenix-secondary) 82%, #0f172a);
    color: white;
}

.btn-outline-primary {
    color: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    background-color: var(--phoenix-card-bg);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
    background-color: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: white;
}

.btn-outline-secondary {
    color: var(--phoenix-text-color);
    border: 1.5px solid var(--fl-border-muted);
    background-color: var(--phoenix-card-bg);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    background-color: var(--phoenix-body-bg);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--phoenix-text-color);
}

[data-theme-mode="dark"] .btn-outline-secondary:hover,
[data-theme-mode="dark"] .btn-outline-secondary:focus-visible {
    border-color: rgba(255, 255, 255, 0.14);
    background-color: rgba(255, 255, 255, 0.06);
}

/* Tables - Phoenix Style */
.table {
    --bs-table-bg: var(--phoenix-card-bg);
    --bs-table-color: var(--phoenix-text-color);
    --bs-table-border-color: var(--fl-border-muted);
    --bs-table-hover-bg: rgba(var(--phoenix-primary-rgb), 0.05);
}

.table thead {
    background-color: var(--phoenix-light);
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-bs-theme="dark"] .table thead {
    background-color: var(--phoenix-dark);
}

.table tbody tr:hover {
    background-color: rgba(var(--phoenix-primary-rgb), 0.05);
}

/* Forms - Phoenix Style */
.form-control,
.form-select {
    font-family: var(--fl-font-body);
    font-size: 13px;
    border: 1.5px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-sm);
    background-color: var(--fl-input-bg);
    color: var(--phoenix-text-color);
    min-height: 34px;
    padding: 0.45rem 0.75rem;
    transition: var(--phoenix-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--phoenix-primary);
    box-shadow: 0 0 0 3px rgba(var(--phoenix-primary-rgb), 0.2);
    background-color: var(--phoenix-card-bg);
    color: var(--phoenix-text-color);
}

.form-label {
    font-family: var(--fl-font-ui);
    color: var(--phoenix-secondary);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.35rem;
}

/* Badges - Phoenix Style */
.badge {
    font-family: var(--fl-font-ui);
    font-size: 0.625rem;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge.bg-primary {
    background-color: var(--phoenix-primary) !important;
}

.badge.bg-secondary {
    background-color: var(--phoenix-secondary) !important;
}

.badge.bg-success {
    background-color: var(--phoenix-success) !important;
}

.badge.bg-info {
    background-color: var(--phoenix-info) !important;
}

.badge.bg-warning {
    background-color: var(--phoenix-warning) !important;
    color: var(--phoenix-dark);
}

.badge.bg-danger {
    background-color: var(--phoenix-danger) !important;
}

/* Modals - Phoenix Style */
.modal-content {
    background-color: var(--phoenix-card-bg);
    border: 1px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-lg);
    box-shadow: var(--fl-shadow-2);
}

.modal-header {
    background-color: var(--phoenix-light);
    border-bottom: 1px solid var(--fl-border-muted);
    font-family: var(--fl-font-ui);
}

[data-bs-theme="dark"] .modal-header {
    background-color: var(--phoenix-dark);
}

.modal-title {
    color: var(--phoenix-text-color);
    font-weight: 600;
}

/* Bootstrap 5 modals: stack above fixed .navbar (1050), sidebar flyouts (1100), and toast stack (1200). */
.modal-backdrop {
    z-index: 1240 !important;
}
.modal {
    z-index: 1250 !important;
}

/* SweetAlert2's default z-index (1060) sits below our modals (1250), so any Swal.fire()
   confirm/prompt opened from inside a Bootstrap modal (a pattern used all over this app)
   renders behind it — clicks meant for the Swal buttons land on the modal content instead. */
.swal2-container {
    z-index: 1300 !important;
}
.modal-dialog {
    pointer-events: auto;
}

/* Alerts - Phoenix Style */
.alert {
    border: none;
    border-radius: var(--phoenix-border-radius);
    border-left: 4px solid;
}

.alert-warning {
    background-color: rgba(var(--phoenix-warning-rgb), 0.1);
    color: #856404;
    border-left-color: var(--phoenix-warning);
}

.alert-danger {
    background-color: rgba(var(--phoenix-danger-rgb), 0.1);
    color: #721c24;
    border-left-color: var(--phoenix-danger);
}

.alert-success {
    background-color: rgba(var(--phoenix-success-rgb), 0.1);
    color: #0f5132;
    border-left-color: var(--phoenix-success);
}

.alert-info {
    background-color: rgba(var(--phoenix-info-rgb), 0.1);
    color: #055160;
    border-left-color: var(--phoenix-info);
}

/* Pagination - Phoenix Style */
.pagination .page-link {
    color: var(--phoenix-primary);
    border-color: var(--fl-border-muted);
    background-color: var(--phoenix-card-bg);
    transition: var(--phoenix-transition);
}

.pagination .page-item.active .page-link {
    background-color: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: white;
}

.pagination .page-link:hover {
    color: var(--phoenix-primary);
    background-color: var(--phoenix-body-bg);
    border-color: var(--fl-border-muted);
}

/* Breadcrumbs - Phoenix Style */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: var(--phoenix-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--phoenix-secondary);
}

/* Loading States */
.spinner-border {
    color: var(--phoenix-primary);
}

/* Custom Scrollbar — compact (Jacana-style reference) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--phoenix-body-bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

[data-theme-mode="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

[data-theme-mode="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Sidebar Additional Enhancements */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--phoenix-border-color), transparent);
}

.sidebar .nav-item {
    position: relative;
}

.sidebar .nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background-color: rgba(var(--phoenix-border-color), 0.3);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 99px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .sidebar {
        top: var(--fl-navbar-h);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        z-index: 1050;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Defensive: on phones the sidebar is position:fixed and off-canvas,
       so the main column MUST own the full viewport regardless of which
       Bootstrap col-* or .sidebar-collapsed class the JS toggled. */
    .container-fluid > .row > .main-content,
    .main-content,
    .main-content.sidebar-collapsed,
    .main-content.col-md-9,
    .main-content.col-lg-10 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-top: 2rem !important;
    }

    /* And the nav must not take any flex row space when off-canvas. It is
       position:fixed, so flex-basis 0 is enough — do NOT clamp max-width,
       or the drawer renders 0px wide and translateX(-100%) becomes a no-op,
       leaving the module nav unreachable. See the drawer block at the end
       of this file. */
    .container-fluid > .row > .sidebar { flex: 0 0 0 !important; }

    /* Editorial landing: single column on phones, tighter padding. */
    .fl-home { padding: 1.5rem 0 2rem; }
    .fl-home-title { font-size: clamp(1.6rem, 8vw, 2.2rem); line-height: 1.15; }
    .fl-home-stats.fl-home-stats--liveops { grid-template-columns: 1fr !important; }

    .sidebar .nav-link {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .sidebar .collapse .nav-link {
        padding-left: 3.5rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
    }
}

@media (min-width: 992px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
    }
}

/* Avatar Styles */
.avatar {
    position: relative;
    display: inline-block;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
}

.avatar-md {
    width: 2.5rem;
    height: 2.5rem;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
}

.avatar-name {
    width: 100%;
    height: 100%;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Navbar Styling */
.navbar-brand {
    font-family: var(--fl-font-ui);
    font-size: 1.05rem;
    transition: var(--phoenix-transition);
}

.navbar-brand:hover {
    transform: translateY(-1px);
}

.navbar-brand .fa-gem {
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(180deg);
    }
}

/* Enhanced Dropdown Styling */
.dropdown-header {
    padding: 0.75rem 1rem;
    background-color: rgba(var(--phoenix-primary-rgb), 0.05);
    border-bottom: 1px solid var(--fl-border-muted);
    font-family: var(--fl-font-ui);
}

.dropdown-item {
    font-family: var(--fl-font-ui);
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    transition: var(--phoenix-transition);
}

.dropdown-item:hover {
    background-color: rgba(var(--phoenix-primary-rgb), 0.1);
    transform: translateX(2px);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(var(--phoenix-danger-rgb), 0.1);
    color: var(--phoenix-danger) !important;
}

.dropdown-menu {
    border: 1px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-md);
    box-shadow: var(--fl-shadow-2);
}

/* Navbar online indicator (replaces former PWA bundle styles) */
.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    transition: all 0.3s ease;
}

.online-indicator.online {
    background-color: #198754;
    box-shadow: 0 0 8px rgba(25, 135, 84, 0.6);
}

.online-indicator.offline {
    background-color: #dc3545;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.6);
    animation: fl-pulse-offline 2s infinite;
}

@keyframes fl-pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#offlineBadge {
    display: none;
    background: linear-gradient(135deg, #dc3545, #ff6b7a);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Page Header Enhancements */
.page-header {
    background: color-mix(in srgb, var(--phoenix-body-bg) 92%, var(--phoenix-primary));
    border-radius: var(--fl-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--fl-border-muted);
    box-shadow: var(--fl-shadow-1);
    font-family: var(--fl-font-ui);
}

/* Button Group Enhancements — pill ends, square inner edges. */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
}

/* Utility Classes */
.text-primary {
    color: var(--phoenix-primary) !important;
}

.text-secondary {
    color: var(--phoenix-secondary) !important;
}

.text-success {
    color: var(--phoenix-success) !important;
}

.text-info {
    color: var(--phoenix-info) !important;
}

.text-warning {
    color: var(--phoenix-warning) !important;
}

.text-danger {
    color: var(--phoenix-danger) !important;
}

.bg-primary {
    background-color: var(--phoenix-primary) !important;
}

.bg-secondary {
    background-color: var(--phoenix-secondary) !important;
}

.bg-success {
    background-color: var(--phoenix-success) !important;
}

.bg-info {
    background-color: var(--phoenix-info) !important;
}

.bg-warning {
    background-color: var(--phoenix-warning) !important;
}

.bg-danger {
    background-color: var(--phoenix-danger) !important;
}

/* Border Utilities */
.border-primary {
    border-color: var(--phoenix-primary) !important;
}

.border-secondary {
    border-color: var(--phoenix-secondary) !important;
}

.border-success {
    border-color: var(--phoenix-success) !important;
}

.border-info {
    border-color: var(--phoenix-info) !important;
}

.border-warning {
    border-color: var(--phoenix-warning) !important;
}

.border-danger {
    border-color: var(--phoenix-danger) !important;
}

/* Shadow Utilities */
.shadow {
    box-shadow: var(--phoenix-box-shadow) !important;
}

.shadow-lg {
    box-shadow: var(--phoenix-box-shadow-lg) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   THEME SELECTOR STYLES
   ============================================ */
#themeSelector .dropdown-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--fl-radius-sm);
    padding: 0.5rem 0.75rem;
    color: white;
    transition: var(--phoenix-transition);
}

#themeSelector .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

#themeSelector .dropdown-toggle::after {
    display: none;
}

#themeSelector .dropdown-menu {
    min-width: 280px;
    padding: 0.5rem;
    border-radius: var(--fl-radius-md);
    box-shadow: var(--fl-shadow-2);
    border: 1px solid var(--fl-border-muted);
    background-color: var(--phoenix-card-bg);
}

#themeSelector .theme-option {
    border-radius: var(--fl-radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    transition: var(--phoenix-transition);
    color: var(--phoenix-text-color);
}

#themeSelector .theme-option:last-child {
    margin-bottom: 0;
}

#themeSelector .theme-option:hover {
    background-color: rgba(var(--phoenix-primary-rgb), 0.1);
}

#themeSelector .theme-option .fa-check {
    color: var(--phoenix-success);
}

#themeSelector .theme-option small {
    font-size: 0.75rem;
}

/* Theme indicator dot */
.theme-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--phoenix-primary);
    display: inline-block;
    margin-right: 0.5rem;
}

/* ============================================
   SIGN-IN PAGE (scoped)
   ============================================ */
body.page-signin {
    min-height: 100vh;
    background: linear-gradient(
        135deg,
        rgba(var(--phoenix-primary-rgb), 0.06) 0%,
        rgba(var(--phoenix-success-rgb), 0.04) 50%,
        rgba(var(--phoenix-warning-rgb), 0.04) 100%
    );
    font-family: var(--fl-font-body);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

[data-theme-mode="dark"] body.page-signin {
    background: linear-gradient(
        135deg,
        rgba(var(--phoenix-primary-rgb), 0.18) 0%,
        var(--phoenix-body-bg) 100%
    );
}

body.page-signin .auth-container {
    min-height: 100vh;
    padding: 2rem 0;
    background: transparent;
}

body.page-signin .auth-card {
    background: var(--phoenix-card-bg);
    border-radius: var(--fl-radius-lg);
    overflow: hidden;
    border: 1px solid var(--fl-border-muted);
    box-shadow: var(--fl-shadow-2);
    transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

body.page-signin .auth-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

body.page-signin .logo-container {
    margin-bottom: 1.75rem;
}

body.page-signin .logo-image {
    width: 140px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
    border-radius: var(--fl-radius-md);
}

body.page-signin .brand-title {
    font-family: var(--fl-font-ui);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--phoenix-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

body.page-signin .brand-subtitle {
    font-family: var(--fl-font-ui);
    color: var(--phoenix-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

body.page-signin .welcome-text {
    color: var(--phoenix-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

body.page-signin .divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

body.page-signin .signin-form-label {
    font-family: var(--fl-font-ui);
    color: var(--phoenix-secondary);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.35rem;
    display: block;
}

body.page-signin .signin-form-control {
    border: 1.5px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 13px;
    min-height: 38px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: var(--fl-input-bg);
    color: var(--phoenix-text-color);
}

body.page-signin .signin-form-control:focus {
    border-color: var(--phoenix-primary);
    box-shadow: 0 0 0 3px rgba(var(--phoenix-primary-rgb), 0.2);
    background-color: var(--phoenix-card-bg);
}

body.page-signin .signin-btn-primary {
    font-family: var(--fl-font-ui);
    background: var(--phoenix-primary);
    border: none;
    border-radius: var(--fl-radius-sm);
    padding: 0.55rem 1.25rem;
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--fl-shadow-1);
    color: white;
}

body.page-signin .signin-btn-primary:hover,
body.page-signin .signin-btn-primary:focus-visible {
    background: var(--phoenix-primary-hover);
    color: #fff;
    box-shadow: var(--fl-shadow-2);
}

body.page-signin .divider::before,
body.page-signin .divider::after {
    border-bottom-width: 1px;
    border-bottom-color: var(--fl-border-muted);
}

body.page-signin .divider span {
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--phoenix-secondary);
}

body.page-signin .g_id_signin {
    border-radius: var(--fl-radius-sm) !important;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

body.page-signin a.text-decoration-none {
    font-family: var(--fl-font-ui);
    font-weight: 600;
    color: var(--phoenix-primary);
}

body.page-signin a.text-decoration-none:hover {
    color: var(--phoenix-primary-hover);
}

body.page-signin .form-check-input:checked {
    background-color: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
}

body.page-signin .modal-content {
    border-radius: var(--fl-radius-lg);
    border: 1px solid var(--fl-border-muted);
}

body.page-signin .modal-header {
    background: var(--phoenix-primary);
    color: #fff;
    border-radius: var(--fl-radius-lg) var(--fl-radius-lg) 0 0;
    padding: 1rem 1.25rem;
    font-family: var(--fl-font-ui);
}

body.page-signin .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

body.page-signin .auth-card {
    animation: flFadeIn 0.45s ease-out;
}

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

body.page-signin .auth-card .card-body {
    padding: 2rem 1.75rem !important;
}

body.page-signin .theme-toggle-signin {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    right: auto;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: padding 0.25s ease;
    overflow: visible;
}

body.page-signin .theme-picker-options {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin 0.25s ease;
    margin-right: 0;
}

body.page-signin .theme-toggle-signin.is-open .theme-picker-options {
    max-width: 600px;
    opacity: 1;
    margin-right: 0.25rem;
    /* Let hover-grown icons spill outside the pill once expansion has finished */
    overflow: visible;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                margin 0.25s ease,
                overflow 0s linear 0.35s;
}

body.page-signin .theme-picker-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--phoenix-secondary);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

body.page-signin .theme-picker-option:hover {
    background: var(--phoenix-card-bg);
    color: var(--phoenix-primary);
    transform: scale(1.6) translateY(-30%);
    border-color: var(--phoenix-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    z-index: 2;
}

body.page-signin .theme-picker-option.is-active {
    background: var(--phoenix-primary);
    color: #fff;
    border-color: var(--phoenix-primary);
}

body.page-signin .theme-toggle-btn {
    font-family: var(--fl-font-ui);
    background: var(--phoenix-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    color: #fff;
    font-size: 0.9rem;
    flex-shrink: 0;
    order: 99; /* keep current-theme button on the right of the pill */
}

body.page-signin .theme-toggle-btn:hover {
    background: var(--phoenix-primary-hover, var(--phoenix-dark));
    transform: scale(1.05);
}

body.page-signin .theme-toggle-signin .dropdown-menu {
    background-color: var(--phoenix-card-bg);
    border: 1px solid var(--fl-border-muted);
    border-radius: var(--fl-radius-md);
    box-shadow: var(--fl-shadow-2);
    min-width: 180px;
}

body.page-signin .theme-toggle-signin .dropdown-item {
    color: var(--phoenix-text-color);
    border-radius: var(--fl-radius-sm);
    margin: 0.2rem 0.4rem;
    font-family: var(--fl-font-ui);
    font-size: 0.8125rem;
}

body.page-signin .theme-toggle-signin .dropdown-item:hover {
    background-color: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
}

body.page-signin .theme-toggle-btn.dropdown-toggle::after {
    display: none;
}

@media (max-width: 576px) {
    body.page-signin .auth-card .card-body {
        padding: 1.5rem 1.25rem !important;
    }

    body.page-signin .logo-image {
        width: 100px;
    }

    body.page-signin .brand-title {
        font-size: 1.4rem;
    }
}

/* ============================================
   SIGN-IN: editorial layout
   Magazine-style: huge serif headline left, minimal underline-only form right,
   fruit outlines drifting behind the headline. "Playful elegance."
   ============================================ */

/* Fruit outline layer — sits behind everything */
body.page-signin .fruit-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

body.page-signin .fruit-bg .fruit {
    position: absolute;
    width: 96px;
    height: 96px;
    color: var(--phoenix-primary);
    opacity: 0.08;
    will-change: transform;
    animation: flFruitDrift 22s ease-in-out infinite;
}

[data-theme-mode="dark"] body.page-signin .fruit-bg .fruit {
    opacity: 0.12;
}

/* Positioned individually so they cover the canvas evenly (left half — editorial side) */
body.page-signin .fruit-peach       { top:  4%; left:  3%; width: 110px; animation-duration: 24s; animation-delay:  0s; }
body.page-signin .fruit-apple       { top:  8%; left: 78%; width:  88px; animation-duration: 28s; animation-delay: -3s; }
body.page-signin .fruit-pear        { top: 28%; left: 10%; width:  80px; animation-duration: 26s; animation-delay: -8s; }
body.page-signin .fruit-orange      { top: 38%; left: 86%; width: 104px; animation-duration: 30s; animation-delay: -5s; }
body.page-signin .fruit-lemon       { top: 74%; left:  6%; width:  92px; animation-duration: 25s; animation-delay: -12s; }
body.page-signin .fruit-grape       { top: 18%; left: 46%; width:  72px; animation-duration: 27s; animation-delay: -6s; }
body.page-signin .fruit-cherry      { top: 60%; left: 38%; width:  78px; animation-duration: 23s; animation-delay: -10s; }
body.page-signin .fruit-strawberry  { top:  2%; left: 58%; width:  84px; animation-duration: 29s; animation-delay: -2s; }
body.page-signin .fruit-pineapple   { top: 30%; left: 70%; width:  96px; animation-duration: 31s; animation-delay: -14s; }
body.page-signin .fruit-banana      { top: 50%; left: 24%; width: 100px; animation-duration: 26s; animation-delay: -16s; }
body.page-signin .fruit-watermelon  { top: 86%; left: 44%; width:  92px; animation-duration: 28s; animation-delay: -4s; }
body.page-signin .fruit-kiwi        { top: 12%; left: 28%; width:  72px; animation-duration: 24s; animation-delay: -7s; }
body.page-signin .fruit-fig         { top: 80%; left: 78%; width:  78px; animation-duration: 30s; animation-delay: -9s; }
body.page-signin .fruit-mango       { top: 56%; left: 64%; width:  96px; animation-duration: 25s; animation-delay: -11s; }
body.page-signin .fruit-pomegranate { top: 88%; left: 18%; width:  80px; animation-duration: 27s; animation-delay: -13s; }

/* Slow, restrained drift — feels alive, not bouncy */
@keyframes flFruitDrift {
    0%   { transform: translate3d(0, 0, 0)        rotate(-4deg); }
    50%  { transform: translate3d(18px, -22px, 0)  rotate(6deg); }
    100% { transform: translate3d(0, 0, 0)        rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
    body.page-signin .fruit-bg .fruit { animation: none; }
}

/* Keep content above the fruit layer (theme toggle stays fixed, just bump z-index) */
body.page-signin .auth-container { position: relative; z-index: 2; }
body.page-signin .theme-toggle-signin { z-index: 1000; }

/* Page background follows the active theme */
body.page-signin { background: var(--phoenix-body-bg) !important; }

/* Free inner Bootstrap column so form fills its 380px slot */
body.page-signin .auth-container .container > .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Editorial side: huge headline + tagline on the left half */
body.page-signin .auth-editorial {
    position: fixed;
    inset: 0 50% 0 0;
    padding: 4rem 4rem 3rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--phoenix-text-color);
}
body.page-signin .auth-editorial-eyebrow {
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
}
body.page-signin .auth-editorial-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 2rem 0;
    color: var(--phoenix-text-color);
}
body.page-signin .auth-editorial-title span { display: block; }
body.page-signin .auth-editorial-title .accent {
    font-style: italic;
    color: var(--phoenix-primary);
}
body.page-signin .auth-editorial-sub {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--phoenix-secondary);
    max-width: 420px;
}
body.page-signin .auth-editorial-foot {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    opacity: 0.7;
}

/* Form panel on the right, stripped of card chrome */
body.page-signin .auth-container {
    justify-content: flex-end !important;
    padding-right: 4rem;
}
body.page-signin .auth-container .container {
    max-width: 380px;
    margin-right: 4rem;
    margin-left: auto;
}
body.page-signin .auth-card,
body.page-signin .auth-card:hover {
    background: var(--phoenix-card-bg) !important;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06) !important;
    transform: none;
    position: relative;
}
body.page-signin .auth-card .card-body {
    padding: 2.5rem 2.25rem !important;
}
body.page-signin .logo-image {
    display: block;
    width: min(100%, 280px);
    height: auto;
    margin-bottom: 1.25rem;
    filter: none;
    border-radius: 0;
}
body.page-signin .logo-container { text-align: left !important; margin-bottom: 2rem; }
body.page-signin .brand-title { display: none; }
body.page-signin .brand-subtitle { display: none; }
body.page-signin .welcome-text {
    color: var(--phoenix-secondary);
    font-family: Georgia, serif;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Underline-only form fields */
body.page-signin .signin-form-control {
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 0;
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--phoenix-text-color);
}
body.page-signin .signin-form-control:focus {
    border-bottom-color: var(--phoenix-primary);
    box-shadow: none;
    background: transparent;
}

body.page-signin .signin-password-wrap {
    position: relative;
}

body.page-signin .signin-password-wrap .signin-form-control {
    padding-right: 2.25rem;
}

body.page-signin .signin-password-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--phoenix-secondary);
    padding: 0.25rem 0.35rem;
    line-height: 1;
    cursor: pointer;
}

body.page-signin .signin-password-toggle:hover,
body.page-signin .signin-password-toggle:focus-visible {
    color: var(--phoenix-primary);
    outline: none;
}

/* Kill Chrome autofill paint — match the active card bg */
body.page-signin .signin-form-control:-webkit-autofill,
body.page-signin .signin-form-control:-webkit-autofill:hover,
body.page-signin .signin-form-control:-webkit-autofill:focus,
body.page-signin .signin-form-control:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--phoenix-card-bg) inset !important;
    -webkit-text-fill-color: var(--phoenix-text-color) !important;
    caret-color: var(--phoenix-text-color);
    transition: background-color 9999s ease-in-out 0s;
}
body.page-signin .signin-form-label {
    color: var(--phoenix-secondary);
    font-size: 9.5px;
}
body.page-signin .signin-btn-primary {
    background: var(--phoenix-primary);
    border-radius: 0;
    width: 100%;
    padding: 0.85rem;
    font-family: Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    letter-spacing: 0;
    color: #fff;
}
body.page-signin .signin-btn-primary:hover {
    background: var(--phoenix-primary-hover, var(--phoenix-dark));
    color: #fff;
}
body.page-signin .divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}
body.page-signin .divider::before,
body.page-signin .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--phoenix-border-color, var(--fl-border-muted));
    display: block;
    border: none;
}
body.page-signin .divider span {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    text-transform: none;
    color: var(--phoenix-secondary);
    white-space: nowrap;
    background: transparent;
}

/* Fruits drift behind everything, full canvas. Color follows theme primary. */
body.page-signin .fruit-bg { inset: 0; }
body.page-signin .fruit-bg .fruit {
    color: var(--phoenix-primary);
    opacity: 0.08;
}

@media (max-width: 992px) {
    body.page-signin .auth-editorial { display: none; }
    body.page-signin .auth-container {
        justify-content: center !important;
        padding: 2rem;
    }
    body.page-signin .auth-container .container { margin: 0 auto; }
    body.page-signin .fruit-bg { inset: 0; }
}

/* ============================================
   DASHBOARD — editorial elegance
   Same vocabulary as sign-in: serif headline with italic accent,
   uppercase eyebrow, large stat numerals, generous whitespace.
   ============================================ */
.fl-dashboard {
    padding: 3.5rem 0 4rem;
    color: var(--phoenix-text-color);
}

.fl-dashboard-header {
    margin-bottom: 3rem;
    max-width: 760px;
}

.fl-dashboard-eyebrow {
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin-bottom: 1.25rem;
}

.fl-dashboard-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 5.5vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    margin: 0 0 1rem;
    color: var(--phoenix-text-color);
}

.fl-dashboard-title .accent {
    font-style: italic;
    color: var(--phoenix-primary);
}

.fl-dashboard-sub {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--phoenix-secondary);
    margin: 0;
}

/* Stat grid */
.fl-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.fl-stat {
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 4px;
    padding: 1.75rem 1.5rem 1.5rem;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fl-stat:hover {
    border-color: var(--phoenix-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.fl-stat-label {
    font-family: var(--fl-font-ui);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin-bottom: 1rem;
}

.fl-stat-value {
    font-family: Georgia, serif;
    font-size: 3rem;
    line-height: 1;
    font-weight: 400;
    letter-spacing: -0.03em;
    color: var(--phoenix-text-color);
    margin-bottom: 0.6rem;
}

.fl-stat-value small {
    font-size: 1.25rem;
    color: var(--phoenix-secondary);
    margin-left: 0.05em;
}

.fl-stat-meta {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--phoenix-secondary);
}

/* Accent variant — highlight one card per row */
.fl-stat-accent .fl-stat-value {
    color: var(--phoenix-primary);
    font-style: italic;
}

/* Editorial action button (matches sign-in submit) */
.fl-btn-editorial {
    background: var(--phoenix-primary);
    color: #fff;
    border: none;
    border-radius: 0;
    padding: 0.9rem 1.75rem;
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.fl-btn-editorial:hover {
    background: var(--phoenix-primary-hover, var(--phoenix-dark));
    color: #fff;
}

.fl-btn-editorial span { transition: transform 0.15s ease; }
.fl-btn-editorial:hover span { transform: translateX(4px); }

@media (max-width: 576px) {
    .fl-dashboard { padding: 2rem 0; }
    .fl-stat-value { font-size: 2.25rem; }
}

/* ============================================
   FRUITLIVE — Editorial landing (.fl-home)
   Quiet, magazine-style. Greeting, three stats,
   four quick-links, a recent activity column.
   ============================================ */
.fl-home {
    padding: 3rem 0 3rem;
    max-width: 1200px;
    margin: 0 auto;
    color: var(--phoenix-text-color);
}

.fl-home-header { margin-bottom: 2.75rem; max-width: 820px; }

.fl-home-eyebrow {
    font-family: var(--fl-font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin-bottom: 1rem;
}

.fl-home-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(2.4rem, 5vw, 4.25rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0 0 0.8rem;
    color: var(--phoenix-text-color);
}
.fl-home-title .accent {
    font-style: italic;
    color: var(--phoenix-primary);
}

.fl-home-sub {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    color: var(--phoenix-secondary);
    margin: 0;
}

/* Stat row */
.fl-home-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* Live-ops strip — 4 KPI tiles with mini-data per tile. Wider minmax
   so the chip / sparkline / progress meta lines breathe. */
.fl-home-stats--liveops {
    grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
    position: relative;
    padding-top: 1.5rem;
}

.fl-home-stats-eyebrow {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--phoenix-secondary, #64748b);
}
.fl-home-stats-eyebrow .fas { color: #16a34a; font-size: 0.5rem; }
.fl-home-stats-eyebrow strong {
    color: #b45309;
    background: #fef3c7;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.fl-home-stats--liveops .fl-stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.fl-home-stats--liveops .fl-stat-meta {
    min-height: 1.1rem;
}

/* Value variants */
.fl-stat-value-of {
    font-size: 0.95rem;
    color: var(--phoenix-secondary, #64748b);
    font-weight: 500;
    margin-left: 0.15rem;
}
.fl-stat-value--warn { color: #b45309; }

/* Sparkline (On the clock) — 5 stubby bars, last one accented as "now" */
.fl-stat-spark {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 28px;
    margin-top: 0.25rem;
}
.fl-stat-spark-bar {
    flex: 1;
    background: rgba(45, 106, 79, 0.25);
    border-radius: 2px;
}
.fl-stat-spark-bar--now { background: #2d6a4f; }

/* Site chip row (Sites active) */
.fl-stat-chiprow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}
.fl-stat-chip {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    white-space: nowrap;
}
.fl-stat-chip.is-on { background: #dcfce7; color: #166534; }

/* Pay-period progress bar */
.fl-stat-bar {
    height: 6px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.25rem;
}
.fl-stat-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2d6a4f, #16a34a);
    border-radius: 999px;
}
.fl-stat-bar-meta {
    font-size: 0.7rem;
    color: var(--phoenix-secondary, #64748b);
    margin-top: 0.15rem;
}

/* Field-clock pill row */
.fl-stat-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.25rem;
}
.fl-stat-pill {
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 500;
}
.fl-stat-pill.is-ok { background: #dcfce7; color: #166534; }
.fl-stat-pill.is-warn { background: #fef3c7; color: #92400e; }
.fl-stat-pill.is-ghost { background: #eef2f7; color: #64748b; }

/* Two-column body: quick links + activity */
.fl-home-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
@media (max-width: 900px) {
    .fl-home-row { grid-template-columns: 1fr; }
}

.fl-home-section-title {
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.4rem;
    color: var(--phoenix-text-color);
    margin: 0 0 1rem;
    letter-spacing: -0.01em;
}

/* Quick links — pill cards */
.fl-home-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.fl-home-quick-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-text-color);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.fl-home-quick-card:hover {
    border-color: var(--phoenix-primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
    color: var(--phoenix-text-color);
}

.fl-home-quick-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.fl-home-quick-card:hover .fl-home-quick-icon {
    background: var(--phoenix-primary);
    color: #fff;
}

.fl-home-quick-text { display: flex; flex-direction: column; min-width: 0; }
.fl-home-quick-title {
    font-family: var(--fl-font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--phoenix-text-color);
}
.fl-home-quick-sub {
    font-family: var(--fl-font-ui);
    font-size: 0.78rem;
    color: var(--phoenix-secondary);
}

/* Activity feed */
.fl-home-aside { min-width: 0; }
.fl-home-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    background: var(--phoenix-card-bg);
    overflow: hidden;
}
.fl-home-feed > li + li {
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}
.fl-home-feed-empty {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--phoenix-secondary);
    font-family: var(--fl-font-ui);
}
.fl-home-feed-empty i {
    font-size: 1.3rem;
    color: rgba(var(--phoenix-primary-rgb), 0.4);
    margin-bottom: 0.5rem;
    display: block;
}
.fl-home-feed-empty div {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--phoenix-text-color);
    margin-bottom: 0.2rem;
}
.fl-home-feed-empty small { font-size: 0.78rem; }

/* Closing footer line */
.fl-home-foot {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.78rem;
    color: var(--phoenix-secondary);
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}
.fl-home-foot-sep { margin: 0 0.5rem; opacity: 0.6; }

/* ============================================
   APP SHELL — radical editorial chrome
   Magazine-style table of contents in the sidebar; numbered routes,
   active row blooms into a large italic serif. Top navbar is a
   hairline strip — utilities only, no chrome. Cream sheet throughout.
   ============================================ */

/* ---- Top navbar: killed (brand + theme + user live in the sidebar dock) ---- */
.navbar { display: none !important; }
.container-fluid.mt-navbar { margin-top: 0 !important; }
.sidebar { top: 0 !important; height: 100vh !important; }
.main-content { padding-top: 1.5rem !important; }

.navbar-brand,
.navbar-brand:hover {
    color: var(--phoenix-text-color) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.navbar-brand .fa-leaf {
    color: var(--phoenix-primary);
    font-size: 0.9rem;
}

.navbar-brand small {
    font-family: Georgia, serif !important;
    font-style: italic;
    color: var(--phoenix-secondary) !important;
    opacity: 1 !important;
    font-size: 0.78rem;
    letter-spacing: 0;
    margin-left: 0.5rem !important;
}

.navbar-nav .nav-link,
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active,
.navbar-nav .btn-link.nav-link,
.navbar-nav .btn-link.nav-link:hover {
    color: var(--phoenix-secondary) !important;
    font-weight: 500;
}

.navbar-nav .nav-link:hover,
.navbar-nav .btn-link.nav-link:hover {
    color: var(--phoenix-primary) !important;
}

#userDisplayName {
    font-family: Georgia, serif;
    font-style: italic;
    color: var(--phoenix-text-color);
    font-weight: 400;
}

.navbar .avatar-name {
    background: var(--phoenix-card-bg) !important;
    color: var(--phoenix-primary) !important;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}

.navbar .dropdown-menu {
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 4px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}

.navbar .dropdown-item {
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
}

.navbar .dropdown-item:hover {
    background: rgba(var(--phoenix-primary-rgb), 0.08);
    color: var(--phoenix-primary);
}

/* ---- Sidebar: magazine table of contents ---- */
.sidebar {
    background-color: var(--phoenix-body-bg) !important;
    border-right: none !important;
    box-shadow: none !important;
    width: 320px !important;
}
.main-content { margin-left: 320px !important; width: calc(100% - 320px) !important; }

.sidebar .flex-grow-1 {
    padding: 3rem 2.5rem 1.5rem !important;
}

/* No section eyebrow — keep the sidebar quiet */
.sidebar .flex-grow-1::before { content: none; }

/* Set up the counter on the top-level nav UL */
.sidebar .flex-grow-1 > ul.nav {
    counter-reset: fl-toc;
    gap: 0 !important;
}

/* Top-level nav row — true pill matching the user pill */
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link {
    display: flex !important;
    align-items: center;
    gap: 0.7rem;
    padding: 0.35rem 0.85rem 0.35rem 0.35rem !important;
    margin: 0.2rem 0 !important;
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: var(--phoenix-secondary);
    font-family: var(--fl-font-ui);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.2;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    box-shadow: none !important;
    transform: none !important;
    position: relative;
    overflow: hidden;
}

.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link::before { content: none; }

/* Icon sits in a circular disc — matches the user-pill avatar */
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > i {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(var(--phoenix-primary-rgb), 0.07);
    color: var(--phoenix-secondary);
    font-size: 0.82rem;
    flex-shrink: 0;
    /* Kill legacy .sidebar .nav-link i { margin-right } and Bootstrap me-2 so
       flex gap alone spaces icon → label (keeps drawer text in one column). */
    margin: 0 !important;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > span {
    display: flex;
    align-items: center;
    border-top: none;
    padding-top: 0;
    flex: 1;
    min-width: 0;
    font-weight: 500;
    line-height: 1.2;
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > .fa-chevron-right,
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > .fa-chevron-down {
    width: auto;
    height: auto;
    background: transparent;
    font-size: 0.65rem;
    opacity: 0.55;
    margin-left: auto;
}

/* Right-edge arrow that slides in on hover/active — sense of direction */
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link::after {
    content: "›";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translate(6px, -50%);
    color: var(--phoenix-primary);
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.2s ease;
    pointer-events: none;
}

.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link:hover {
    color: var(--phoenix-text-color);
    background: rgba(var(--phoenix-primary-rgb), 0.05) !important;
    border-color: rgba(var(--phoenix-primary-rgb), 0.12) !important;
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link:hover > i {
    background: rgba(var(--phoenix-primary-rgb), 0.15);
    color: var(--phoenix-primary);
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link:hover::after {
    opacity: 0.7;
    transform: translate(0, -50%);
}

/* Active row — filled icon disc, deeper pill tint, persistent arrow */
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link.active {
    color: var(--phoenix-text-color);
    background: rgba(var(--phoenix-primary-rgb), 0.1) !important;
    border-color: rgba(var(--phoenix-primary-rgb), 0.18) !important;
    font-weight: 600;
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link.active > i {
    background: var(--phoenix-primary);
    color: #fff;
}
.sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link.active::after {
    opacity: 1;
    transform: translate(0, -50%);
}

/* Drop the previous left-bar — superseded by the pill */
.sidebar .nav-link.active::before { display: none !important; }

/* Kill the original ::before left-bar accent — superseded by the numeral */
.sidebar .nav-link.active::before { width: auto; background: transparent; border-radius: 0; }

/* ---- Sub-items (User Management collapsible) ---- */
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link,
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link:hover,
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link[aria-expanded="true"] {
    background: transparent !important;
    border: none !important;
    color: var(--phoenix-text-color);
}

.sidebar .collapse .nav-link {
    padding: 0.35rem 0 0.35rem 2.5rem !important;
    margin: 0 !important;
    background: transparent !important;
    color: var(--phoenix-secondary) !important;
    font-family: var(--fl-font-ui);
    font-size: 0.82rem;
    font-weight: 500;
}
.sidebar .collapse .nav-link i { color: var(--phoenix-secondary); font-size: 0.75rem; }

.sidebar .collapse .nav-link:hover,
.sidebar .collapse .nav-link.active {
    color: var(--phoenix-primary) !important;
    background: transparent !important;
}
.sidebar .collapse .nav-link.active {
    font-family: Georgia, serif;
    font-style: italic;
}

/* Brand block — FruitLive mark + wordmark */
.sidebar .d-flex.flex-column::before,
.sidebar .d-flex.flex-column::after { content: none !important; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.25rem 1.25rem 1.1rem;
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    text-decoration: none;
    color: var(--phoenix-text-color);
    transition: color 0.15s ease;
}
.sidebar-brand:hover {
    color: var(--phoenix-primary);
}
.sidebar-brand:hover .sidebar-brand-mark { transform: rotate(-6deg); }

.sidebar-brand-mark {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
}
.sidebar-brand-name {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.35rem;
    letter-spacing: -0.015em;
    color: inherit;
}
.sidebar-brand-accent {
    font-style: italic;
    color: var(--phoenix-primary);
}
.sidebar-brand-tag {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--phoenix-secondary);
    margin-top: 0.2rem;
}

/* Collapsed sidebar — show just the mark, centered */
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 1rem 0;
}
.sidebar.collapsed .sidebar-brand-text { display: none; }

.sidebar .flex-grow-1 { padding: 1rem 0.75rem 0.5rem !important; }

/* ---- Sidebar bottom dock: user, notifications, theme, settings ---- */
.sidebar-dock {
    position: static;
    margin-top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1;
    flex-shrink: 0;
    padding: 0.75rem 0.85rem 1rem;
}

/* Theme picker — vertical popover that opens above the toggle */
.sidebar-theme-picker { position: relative; align-self: flex-start; }

.sidebar-theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-primary);
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
    transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.sidebar-theme-toggle:hover {
    background: var(--phoenix-primary);
    color: #fff;
    transform: scale(1.05);
}

.sidebar-theme-options {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.3rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px) scale(0.95);
    transform-origin: bottom left;
    transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.sidebar-theme-picker.is-open .sidebar-theme-options {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.sidebar-theme-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--phoenix-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease,
                border-color 0.15s ease;
}
.sidebar-theme-option:hover {
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    transform: scale(1.15);
}
.sidebar-theme-option.is-active {
    background: var(--phoenix-primary);
    color: #fff;
    border-color: var(--phoenix-primary);
}

/* User cluster: pill + settings gear, side-by-side */
.sidebar-user-cluster {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
}
.sidebar-user-pill { flex: 1; min-width: 0; position: relative; }
.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.4rem 0.7rem 0.4rem 0.4rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.sidebar-user-pill:hover .sidebar-user-btn,
.sidebar-user-pill:focus-within .sidebar-user-btn,
.sidebar-user-pill.is-open .sidebar-user-btn {
    border-color: var(--phoenix-primary);
}
.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--phoenix-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.sidebar-user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

/* Hover card — extended user info opens above the pill */
.sidebar-user-card {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.2s ease;
    z-index: 20;
    /* Wide enough for Refresh and Sign out to sit side by side without either
       label wrapping; the card stretches past this whenever the pill is wider. */
    min-width: 250px;
}
.sidebar-user-pill:hover .sidebar-user-card,
.sidebar-user-pill:focus-within .sidebar-user-card,
.sidebar-user-pill.is-open .sidebar-user-card {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.sidebar-user-card-head {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 0.85rem;
}
.sidebar-user-card-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--phoenix-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.sidebar-user-card-name {
    font-family: var(--fl-font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--phoenix-text-color);
}
.sidebar-user-card-email {
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
    color: var(--phoenix-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}
/* Let the email column shrink so the ellipsis can do its job */
.sidebar-user-card-head > div { min-width: 0; flex: 1; }
.sidebar-user-card-meta {
    margin: 0 0 0.85rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    display: grid;
    gap: 0.45rem;
    font-family: var(--fl-font-ui);
}
.sidebar-user-card-meta > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.sidebar-user-card-meta dt {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin: 0;
}
.sidebar-user-card-meta dd {
    margin: 0;
    font-size: 0.78rem;
    color: var(--phoenix-text-color);
    text-align: right;
    word-break: break-word;
}
/* Refresh and Sign out share a row. Equal columns rather than auto width, so
   the pair reads as one control strip and neither button moves when the label
   of the other changes. */
.sidebar-user-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}
.sidebar-user-card-refresh,
.sidebar-user-card-signout {
    width: 100%;
    /* Icon gap set here rather than with Bootstrap's .me-2. Refresh is the
       control someone reaches for when the app is already misbehaving, so it
       should not depend on a utility class from a stylesheet that may be the
       thing that failed to load. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 8px;
    padding: 0.5rem 0.4rem;
    font-family: var(--fl-font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.sidebar-user-card-signout {
    color: var(--phoenix-danger, #ef4444);
}
.sidebar-user-card-signout:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--phoenix-danger, #ef4444);
}
.sidebar-user-card-refresh {
    color: var(--phoenix-primary);
}
.sidebar-user-card-refresh:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--phoenix-primary);
}
/* Held from the click until the reload replaces the page — on a slow device
   that gap is seconds long, and a dead-looking button is what makes someone
   tap it again. */
.sidebar-user-card-refresh.is-busy {
    opacity: 0.65;
    cursor: default;
}
.sidebar-user-card-refresh.is-busy i {
    animation: fl-refresh-spin 0.9s linear infinite;
}
@keyframes fl-refresh-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar-user-card-refresh.is-busy i { animation: none; }
}

/* Notifications bell */
.sidebar-notifications { position: relative; flex-shrink: 0; }
.sidebar-notif-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-notif-btn:hover,
.sidebar-notifications.is-open .sidebar-notif-btn {
    background: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: #fff;
}
.sidebar-notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--phoenix-danger, #ef4444);
    box-shadow: 0 0 0 2px var(--phoenix-card-bg);
}
.sidebar-notifications.is-open .sidebar-notif-dot { box-shadow: 0 0 0 2px var(--phoenix-primary); }

.sidebar-nav-warn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--phoenix-warning, #f59e0b);
    color: #1a1a1a;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}
.sidebar-nav-warn::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.55rem;
    margin-right: 0.15rem;
}
.sidebar.collapsed .sidebar-nav-warn {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 8px;
    height: 8px;
    padding: 0;
    margin: 0;
    font-size: 0;
}
.sidebar.collapsed .sidebar-nav-warn::before {
    display: none;
}

.sidebar-notif-panel {
    position: absolute;
    bottom: -0.25rem;
    left: calc(100% + 0.65rem);          /* anchored to the right of the bell */
    width: 340px;
    max-height: min(520px, calc(100vh - 2rem));
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8px) scale(0.97);
    transform-origin: bottom left;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1100;
}
/* Pointer arrow visually connecting the panel to the bell */
.sidebar-notif-panel::before,
.sidebar-notif-panel::after {
    content: "";
    position: absolute;
    bottom: 1.2rem;
    right: 100%;
    width: 0;
    height: 0;
    border-style: solid;
}
.sidebar-notif-panel::before {
    border-width: 8px 9px 8px 0;
    border-color: transparent var(--phoenix-border-color, var(--fl-border-muted)) transparent transparent;
}
.sidebar-notif-panel::after {
    border-width: 7px 8px 7px 0;
    border-color: transparent var(--phoenix-card-bg) transparent transparent;
    margin-right: -1px;
}
.sidebar-notifications.is-open .sidebar-notif-panel {
    position: fixed;
    right: auto;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.sidebar-notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem 0.6rem;
}
.sidebar-notif-title {
    font-family: var(--fl-font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--phoenix-text-color);
}
.sidebar-notif-mark {
    background: transparent;
    border: none;
    color: var(--phoenix-primary);
    font-family: var(--fl-font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    transition: background 0.12s ease;
}
.sidebar-notif-mark:hover { background: rgba(var(--phoenix-primary-rgb), 0.08); }

.sidebar-notif-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0 0.75rem 0.6rem;
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}
.sidebar-notif-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--phoenix-secondary);
    font-family: var(--fl-font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidebar-notif-tab:hover {
    color: var(--phoenix-primary);
    background: rgba(var(--phoenix-primary-rgb), 0.06);
}
.sidebar-notif-tab.is-active {
    color: var(--phoenix-text-color);
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    border-color: rgba(var(--phoenix-primary-rgb), 0.18);
}
.sidebar-notif-tab .fa-whatsapp { color: #25d366; }

.sidebar-notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}
.sidebar-notif-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--phoenix-secondary);
    font-family: var(--fl-font-ui);
}
.sidebar-notif-empty i {
    font-size: 1.5rem;
    color: rgba(var(--phoenix-primary-rgb), 0.4);
    margin-bottom: 0.6rem;
}
.sidebar-notif-empty div {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--phoenix-text-color);
    margin-bottom: 0.2rem;
}
.sidebar-notif-empty small {
    font-size: 0.75rem;
}
.sidebar-notif-item {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 0.65rem;
    cursor: pointer;
    font-family: var(--fl-font-ui);
    transition: background 0.12s ease;
}
.sidebar-notif-item:hover { background: rgba(var(--phoenix-primary-rgb), 0.06); }
.sidebar-notif-item + .sidebar-notif-item { border-top: 1px solid var(--phoenix-border-color); }
.sidebar-notif-item-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    font-size: 0.85rem;
}
.sidebar-notif-item-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.sidebar-notif-item-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--phoenix-text-color);
}
.sidebar-notif-item-text {
    font-size: 0.78rem;
    color: var(--phoenix-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sidebar-notif-item-time { font-size: 0.68rem; color: var(--phoenix-secondary); margin-top: 0.1rem; }
.sidebar-notif-item.is-unread .sidebar-notif-item-title::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phoenix-primary);
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* ============================================
   TOAST STACK — bottom-left slide-ins
   Use: window.showToast({ type, title, body, duration, icon, onClick })
   ============================================ */
.fl-toast-stack {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 1200;
    display: flex;
    flex-direction: column-reverse;     /* newest at the bottom */
    gap: 0.6rem;
    pointer-events: none;               /* clicks pass through gaps */
    max-width: min(380px, calc(100vw - 2.5rem));
}

.fl-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.75rem 0.85rem 0.75rem 0.7rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-left: 3px solid var(--phoenix-primary);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
.fl-toast.is-in { opacity: 1; transform: translateX(0); }
.fl-toast.is-leaving {
    opacity: 0;
    transform: translateX(-24px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.2s ease;
}

.fl-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(var(--phoenix-primary-rgb), 0.12);
    color: var(--phoenix-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.fl-toast-body {
    flex: 1;
    min-width: 0;
}
.fl-toast-title {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--phoenix-text-color);
    line-height: 1.25;
    margin-bottom: 0.15rem;
}
.fl-toast-text {
    font-size: 0.8rem;
    color: var(--phoenix-secondary);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.fl-toast-close {
    background: transparent;
    border: none;
    color: var(--phoenix-secondary);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}
.fl-toast-close:hover {
    background: rgba(var(--phoenix-primary-rgb), 0.08);
    color: var(--phoenix-primary);
}

/* Type variants — accent strip + icon-bubble colour */
.fl-toast--whatsapp { border-left-color: #25d366; }
.fl-toast--whatsapp .fl-toast-icon { background: rgba(37, 211, 102, 0.15); color: #25d366; }

.fl-toast--success { border-left-color: var(--phoenix-success, #10b981); }
.fl-toast--success .fl-toast-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--phoenix-success, #10b981);
}

.fl-toast--error { border-left-color: var(--phoenix-danger, #ef4444); }
.fl-toast--error .fl-toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--phoenix-danger, #ef4444);
}

.fl-toast--system { border-left-color: var(--phoenix-warning, #f59e0b); }
.fl-toast--system .fl-toast-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--phoenix-warning, #f59e0b);
}

/* Settings gear + popover */
.sidebar-settings { position: relative; flex-shrink: 0; }
.sidebar-settings-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-settings-btn:hover,
.sidebar-settings.is-open .sidebar-settings-btn {
    background: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: #fff;
}
.sidebar-settings-btn i { transition: transform 0.25s ease; }
.sidebar-settings.is-open .sidebar-settings-btn i { transform: rotate(45deg); }

.sidebar-settings-menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    right: 0;
    min-width: 240px;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}
.sidebar-settings.is-open .sidebar-settings-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.sidebar-settings-section + .sidebar-settings-section { margin-top: 0.25rem; }
.sidebar-settings-divider {
    border: 0;
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    margin: 0.4rem 0.3rem;
}
.sidebar-settings-eyebrow {
    font-family: var(--fl-font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    padding: 0.35rem 0.8rem 0.4rem;
}
.sidebar-settings-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.85rem 0.3rem 0.3rem;
    border-radius: 999px;
    color: var(--phoenix-text-color) !important;
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidebar-settings-item + .sidebar-settings-item { margin-top: 0.15rem; }
.sidebar-settings-item i {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--phoenix-primary-rgb), 0.08);
    color: var(--phoenix-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-settings-item:hover {
    background: rgba(var(--phoenix-primary-rgb), 0.08);
    color: var(--phoenix-primary) !important;
}
.sidebar-settings-item:hover i {
    background: var(--phoenix-primary);
    color: #fff;
}

/* Collapsed sidebar — dock icons align with nav column and scroll with the menu */
.sidebar.collapsed .sidebar-dock {
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0 1rem;
    width: 100%;
}
.sidebar.collapsed .sidebar-theme-picker { align-self: center; }
.sidebar.collapsed .sidebar-user-cluster {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}
.sidebar.collapsed .sidebar-user-name { display: none; }
.sidebar.collapsed .sidebar-user-pill { width: auto; flex: 0 0 auto; }
.sidebar.collapsed .sidebar-user-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
    gap: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.sidebar.collapsed .sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: transparent;
    color: var(--phoenix-secondary);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar.collapsed .sidebar-user-btn:hover .sidebar-user-avatar {
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    transform: translateY(-1px);
}
.sidebar.collapsed .sidebar-notif-btn,
.sidebar.collapsed .sidebar-settings-btn,
.sidebar.collapsed .sidebar-theme-toggle,
.sidebar.collapsed .sidebar-install-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: transparent;
    box-shadow: none;
    color: var(--phoenix-secondary);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar.collapsed .sidebar-notif-btn:hover,
.sidebar.collapsed .sidebar-notifications.is-open .sidebar-notif-btn,
.sidebar.collapsed .sidebar-settings-btn:hover,
.sidebar.collapsed .sidebar-settings.is-open .sidebar-settings-btn,
.sidebar.collapsed .sidebar-theme-toggle:hover,
.sidebar.collapsed .sidebar-theme-picker.is-open .sidebar-theme-toggle,
.sidebar.collapsed .sidebar-install-btn:hover {
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    border-color: transparent;
    color: var(--phoenix-primary);
    transform: translateY(-1px);
}
.sidebar.collapsed .sidebar-user-card { left: calc(100% + 0.6rem); right: auto; bottom: 0; min-width: 250px; }
.sidebar.collapsed .sidebar-settings-menu { right: auto; left: calc(100% + 0.6rem); bottom: 0; transform-origin: bottom left; }
.sidebar.collapsed .sidebar-notif-panel { right: auto; left: calc(100% + 0.6rem); bottom: 0; transform-origin: bottom left; width: 320px; }

/* ---- Sidebar collapse pill (straddles the sidebar's right edge) ---- */
.sidebar { position: fixed; overflow: visible !important; }
.sidebar-collapse-pill {
    position: absolute;
    top: 1.25rem;
    right: -14px;            /* half of the 28px button sits outside the sidebar */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    z-index: 110;
    box-shadow: 2px 0 8px rgba(0,0,0,0.06);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}
.sidebar-collapse-pill:hover {
    background: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: #fff;
}
.sidebar.collapsed .sidebar-collapse-pill i { transform: rotate(180deg); }
.sidebar-collapse-pill i { transition: transform 0.25s ease; }

/* ---- Collapsed sidebar: clean icon column ---- */
.sidebar.collapsed { width: 80px !important; }
.main-content.sidebar-collapsed { margin-left: 80px !important; width: calc(100% - 80px) !important; }

.sidebar.collapsed .flex-grow-1 {
    padding: 0.5rem 0 0.25rem !important;
}
.sidebar.collapsed .flex-grow-1::before,
.sidebar.collapsed .d-flex.flex-column::before,
.sidebar.collapsed .d-flex.flex-column::after {
    display: none !important;
}

/* Brand area at top still gets the hairline divider but no label */
.sidebar.collapsed .d-flex.flex-column { padding-top: 3.25rem; }

/* Top-level row in collapsed mode: just a centered icon disc, no pill row */
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0.35rem auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 0 !important;
    width: 48px;
    height: 48px;
    overflow: visible !important;
}

.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link::before,
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link::after,
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > span,
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > .fa-chevron-right,
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > .fa-chevron-down {
    display: none !important;
}

/* The disc IS the row when collapsed */
.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link > i {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px;
    font-size: 1rem !important;
    margin: 0 !important;
    background: transparent;
    color: var(--phoenix-secondary);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link:hover > i {
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    transform: translateY(-1px);
}

.sidebar.collapsed .flex-grow-1 > ul.nav > li.nav-item > a.nav-link.active > i {
    background: var(--phoenix-primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(var(--phoenix-primary-rgb), 0.3);
}

/* Sub-items (User Management collapse) */
.sidebar .collapse .nav-link {
    padding-left: 3rem;
    font-size: 0.82rem;
    color: var(--phoenix-secondary);
    margin: 0;
}

.sidebar .collapse .nav-link.active,
.sidebar .collapse .nav-link:hover {
    color: var(--phoenix-primary);
    background: rgba(var(--phoenix-primary-rgb), 0.05);
    font-weight: 500;
}

.sidebar .collapse .nav-link.active {
    font-weight: 600;
    color: var(--phoenix-primary);
}

/* Strip the box-style User Management parent — let it sit flat like the rest */
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link,
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link:hover,
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link[aria-expanded="true"] {
    background: transparent;
    border: none;
    color: var(--phoenix-secondary);
}

.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link:hover,
.sidebar .nav-item:has([data-bs-target="#settingsCollapse"]) .nav-link[aria-expanded="true"] {
    color: var(--phoenix-primary);
    background: rgba(var(--phoenix-primary-rgb), 0.05);
}

/* Sidebar footer toggle */
.sidebar-footer {
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
}

.sidebar-footer .btn-link,
.sidebar-footer .btn-link:hover {
    color: var(--phoenix-secondary) !important;
    font-family: var(--fl-font-ui);
    font-size: 0.8rem;
}

.sidebar-footer .btn-link:hover {
    color: var(--phoenix-primary) !important;
    background: rgba(var(--phoenix-primary-rgb), 0.05);
}

/* Collapsed-state panel still uses dark surface? Match the cream sheet too. */
.sidebar.collapsed .nav-item:has([data-bs-toggle="collapse"]) > .collapse {
    background-color: var(--phoenix-card-bg) !important;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08) !important;
}

.sidebar.collapsed .collapse .nav-link,
.sidebar.collapsed .collapse .nav-link:hover {
    color: var(--phoenix-secondary) !important;
    background: transparent !important;
}

.sidebar.collapsed .collapse .nav-link:hover {
    color: var(--phoenix-primary) !important;
    background: rgba(var(--phoenix-primary-rgb), 0.06) !important;
}

/* Main content sits on the same cream sheet — no card seam needed */
.main-content {
    background-color: var(--phoenix-body-bg) !important;
    position: relative;
}

/* Drifting-fruit backdrop inside the app shell — sits ABOVE content but
   blends through so it doesn't fight cards. */
.fruit-bg.fruit-bg--shell {
    position: fixed;
    top: 0;
    left: 280px;          /* clears the sidebar */
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 50;
    mix-blend-mode: multiply;
}
.sidebar.collapsed ~ .main-content .fruit-bg--shell,
.main-content.sidebar-collapsed .fruit-bg--shell { left: 80px; }

.fruit-bg--shell .fruit {
    position: absolute;
    color: var(--phoenix-primary);
    opacity: 0.13;
    width: 64px;
    height: 64px;
    will-change: transform;
    animation: flFruitDrift 28s ease-in-out infinite;
}

/* Dark mode: switch blend mode and tone */
[data-theme-mode="dark"] .fruit-bg--shell { mix-blend-mode: screen; }
[data-theme-mode="dark"] .fruit-bg--shell .fruit { opacity: 0.18; }

.fruit-bg--shell .fruit-peach      { top:  6%; left:  3%; width:  72px; animation-duration: 30s; animation-delay:  0s; }
.fruit-bg--shell .fruit-apple      { top:  4%; right: 6%; left: auto; width:  64px; animation-duration: 34s; animation-delay: -3s; }
.fruit-bg--shell .fruit-pear       { top: 40%; left:  4%; width:  60px; animation-duration: 32s; animation-delay: -8s; }
.fruit-bg--shell .fruit-orange     { top: 36%; right: 4%; left: auto; width:  72px; animation-duration: 36s; animation-delay: -5s; }
.fruit-bg--shell .fruit-lemon      { top: 70%; left:  6%; width:  64px; animation-duration: 31s; animation-delay: -12s; }
.fruit-bg--shell .fruit-grape      { top: 24%; left: 42%; width:  56px; animation-duration: 33s; animation-delay: -6s; }
.fruit-bg--shell .fruit-cherry     { top: 60%; right: 32%; left: auto; width:  60px; animation-duration: 29s; animation-delay: -10s; }
.fruit-bg--shell .fruit-strawberry { top: 78%; right: 10%; left: auto; width:  60px; animation-duration: 35s; animation-delay: -2s; }
.fruit-bg--shell .fruit-watermelon { top: 16%; right: 28%; left: auto; width:  64px; animation-duration: 30s; animation-delay: -14s; }
.fruit-bg--shell .fruit-kiwi       { top: 82%; left: 40%; width:  56px; animation-duration: 28s; animation-delay: -16s; }

/* Content positioning — do NOT give #content-area a z-index: that creates a stacking context
   which traps position:fixed Bootstrap .modal dialogs *below* body.modal-backdrop (grey overlay),
   making the modal visible but not clickable. Fruit shell stays pointer-events:none above. */
.main-content > #content-area {
    position: relative;
}
.main-content > .row {
    position: relative;
    z-index: 1;
}

/* Hide the fruit backdrop on dense data views to keep grids legible.
   Add `data-no-fruits` to #content-area (or rename content sections) to opt out. */
.main-content:has(#content-area [data-no-fruits]) .fruit-bg--shell { display: none; }
.main-content:has(.ag-root, .ag-theme-quartz, table.dataTable) .fruit-bg--shell { display: none; }

/* ============================================
   FL — Editorial tabs & pills (reusable across modules)
   Promote `.fl-nav-tabs` / `.fl-nav-pills` from the Assets module so every
   module (Assets, Payroll, …) shares the same tab visual.
   ============================================ */
.fl-nav-tabs.nav-tabs {
    border-bottom: 1px solid var(--phoenix-border-color, #e2e8f0);
    gap: 0.25rem;
    margin-bottom: 1.25rem !important;
}
.fl-nav-tabs.nav-tabs .nav-item .nav-link,
.fl-nav-tabs.nav-tabs > .nav-link {
    border: 0;
    background: transparent;
    color: var(--phoenix-secondary, #64748b);
    font-family: var(--fl-font-ui, system-ui, sans-serif);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.7rem 1rem;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.fl-nav-tabs.nav-tabs .nav-item .nav-link:hover,
.fl-nav-tabs.nav-tabs > .nav-link:hover {
    color: var(--phoenix-text-color, #1f2937);
    border-bottom-color: var(--phoenix-border-color, #cbd5e1);
}
.fl-nav-tabs.nav-tabs .nav-item .nav-link.active,
.fl-nav-tabs.nav-tabs > .nav-link.active {
    color: var(--phoenix-primary);
    border-bottom-color: var(--phoenix-primary);
    background: transparent;
}

.fl-nav-pills.nav-pills {
    gap: 0.35rem;
    margin-bottom: 1rem !important;
}
.fl-nav-pills.nav-pills .nav-item .nav-link,
.fl-nav-pills.nav-pills > .nav-link {
    background: var(--phoenix-card-bg, #fff);
    border: 1px solid var(--phoenix-border-color, #e2e8f0);
    color: var(--phoenix-secondary, #64748b);
    font-family: var(--fl-font-ui, system-ui, sans-serif);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.fl-nav-pills.nav-pills .nav-item .nav-link:hover,
.fl-nav-pills.nav-pills > .nav-link:hover {
    color: var(--phoenix-text-color, #1f2937);
    border-color: var(--phoenix-primary);
}
.fl-nav-pills.nav-pills .nav-item .nav-link.active,
.fl-nav-pills.nav-pills > .nav-link.active {
    background: var(--phoenix-primary);
    color: #fff;
    border-color: var(--phoenix-primary);
}

/* ============================================
   FL — Editorial page header (reusable across modules)
   Use: wrap module HTML in `.fl-page` and use `<header class="fl-page-header">`.
   ============================================ */
.fl-page { padding-top: 0.5rem; }

.fl-page-header { margin-bottom: 2rem; }

.fl-page-eyebrow {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.8rem;
}
.fl-page-eyebrow-sep { opacity: 0.5; }
.fl-page-eyebrow:empty { display: none; }

.fl-page-headline {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.fl-page-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(2rem, 4.5vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--phoenix-text-color);
    flex: 1;
    min-width: 240px;
}
.fl-page-title .accent { font-style: italic; color: var(--phoenix-primary); }

.fl-page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.fl-page-farm-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    padding: 0.45rem 2.25rem 0.45rem 1rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%23999' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    transition: border-color 0.15s ease;
}
.fl-page-farm-select:hover,
.fl-page-farm-select:focus {
    border-color: var(--phoenix-primary);
    outline: none;
}

/* Pill action buttons (ghost + primary) */
.fl-btn-ghost,
.fl-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    text-decoration: none;
    line-height: 1;
}
.fl-btn-ghost {
    background: var(--phoenix-card-bg);
    border-color: var(--phoenix-border-color, var(--fl-border-muted));
    color: var(--phoenix-text-color);
}
.fl-btn-ghost:hover {
    border-color: var(--phoenix-primary);
    color: var(--phoenix-primary);
}
.fl-btn-primary {
    background: var(--phoenix-primary);
    border-color: var(--phoenix-primary);
    color: #fff;
}
.fl-btn-primary:hover {
    background: var(--phoenix-primary-hover, var(--phoenix-dark));
    color: #fff;
    transform: translateY(-1px);
}

/* Excel export — shared size/style across Finances, Labour, Assets, Water, etc. */
.fl-btn-export-excel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    min-height: 2.125rem;
    border-radius: 999px;
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    background: var(--phoenix-card-bg);
    color: var(--phoenix-text-color);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
    text-decoration: none;
}
.fl-btn-export-excel:hover:not(:disabled) {
    border-color: var(--phoenix-primary);
    color: var(--phoenix-primary);
}
.fl-btn-export-excel:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}
.fl-btn-export-excel i {
    font-size: 1rem;
    line-height: 1;
}
.fl-btn-export-excel .spinner-border-sm {
    width: 0.85rem;
    height: 0.85rem;
    border-width: 0.15em;
}

.fl-page-note {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--phoenix-secondary);
    max-width: 780px;
    margin: 0;
    padding: 0.65rem 0 0;
    border-top: 1px dashed var(--phoenix-border-color, var(--fl-border-muted));
}
.fl-page-note strong {
    font-family: var(--fl-font-ui);
    font-style: normal;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--phoenix-text-color);
    margin-right: 0.35rem;
}

/* Tone down Bootstrap card chrome inside .fl-page (filters, compliance, etc.) */
.fl-page .card {
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    background: var(--phoenix-card-bg);
}
.fl-page .card .card-title {
    font-family: var(--fl-font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
}
.fl-page .form-label.fw-bold,
.fl-page .form-label {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
}
.fl-page .form-select,
.fl-page .form-control {
    border-radius: 10px;
    border-color: var(--phoenix-border-color, var(--fl-border-muted));
    font-family: var(--fl-font-ui);
}
.fl-page .form-select:focus,
.fl-page .form-control:focus {
    border-color: var(--phoenix-primary);
    box-shadow: 0 0 0 3px rgba(var(--phoenix-primary-rgb), 0.15);
}

/* Cost-rule (and similar) info tucked next to the headline as a disclosure */
.fl-page-aside {
    margin-top: 0.4rem;
    font-family: var(--fl-font-ui);
    font-size: 0.75rem;
}
.fl-page-aside > summary {
    list-style: none;
    cursor: pointer;
    color: var(--phoenix-secondary);
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.fl-page-aside > summary::-webkit-details-marker { display: none; }
.fl-page-aside > summary:hover { color: var(--phoenix-primary); border-color: var(--phoenix-primary); }
.fl-page-aside > div {
    margin-top: 0.5rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: rgba(var(--phoenix-primary-rgb), 0.05);
    color: var(--phoenix-text-color);
    font-family: Georgia, serif;
    font-style: italic;
    line-height: 1.5;
    max-width: 720px;
}

/* Inline filter chip bar — replaces the old filter card */
.fl-filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1rem;
}
.fl-filter-chip {
    appearance: none;
    -webkit-appearance: none;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    color: var(--phoenix-text-color);
    font-family: var(--fl-font-ui);
    font-size: 0.78rem;
    font-weight: 400; /* override .card-header { font-weight: 700 } inheritance */
    line-height: 1.25;
    padding: 0.35rem 1.9rem 0.35rem 0.85rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%23999' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.fl-filter-chip:hover,
.fl-filter-chip:focus { border-color: var(--phoenix-primary); outline: none; }

.fl-filter-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    /* In the new in-card filter group the bell is the last item — gentle gap only */
    margin-left: 0.15rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    color: var(--phoenix-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.fl-filter-bell:hover,
.fl-filter-bell:focus {
    border-color: var(--phoenix-primary);
    color: var(--phoenix-primary);
    outline: none;
}
.fl-filter-bell.has-alerts {
    border-color: rgba(var(--phoenix-warning-rgb, 255, 193, 7), 0.55);
    color: var(--phoenix-warning, #b45309);
}
.fl-filter-bell-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--phoenix-danger, #dc3545);
    color: #fff;
    font-family: var(--fl-font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    box-shadow: 0 0 0 2px var(--phoenix-card-bg);
}
.fl-renewal-section-title {
    font-family: var(--fl-font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin: 0 0 0.5rem;
}
.fl-renewal-empty {
    font-size: 0.85rem;
    color: var(--phoenix-secondary);
    padding: 0.5rem 0 1rem;
    margin: 0;
}

/* Renewals off-canvas — vertical card list, FruitLive aesthetic, no horizontal scroll */
#labourRenewalAlertsOffcanvas .offcanvas-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}
.fl-renewal-headcount {
    font-size: 0.78rem;
    color: var(--phoenix-secondary);
    letter-spacing: 0.04em;
    margin: 0 0 1.25rem;
}
.fl-renewal-section + .fl-renewal-section { margin-top: 1.5rem; }
.fl-renewal-section-head {
    font-family: var(--fl-font-ui);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--phoenix-border-color, #e2e8f0);
}
.fl-renewal-section-head span {
    background: transparent;
    color: var(--phoenix-secondary);
    border-radius: 0;
    padding: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0;
}
.fl-renewal-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.fl-renewal-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name    meta"
        "detail  meta";
    gap: 4px 14px;
    align-items: center;
    width: 100%;
    background: #fff;
    border: 1px solid var(--phoenix-border-color, #e2e8f0);
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
    font-family: var(--fl-font-ui);
    position: relative;
}
.fl-renewal-card::before {
    /* Small severity dot near the top-left, in place of the loud full-height bar */
    content: "";
    position: absolute;
    left: 14px;
    top: 16px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
}
.fl-renewal-card.is-overdue::before { background: #dc2626; }
.fl-renewal-card:hover {
    border-color: var(--phoenix-primary, #2d6a4f);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.fl-renewal-card-name {
    grid-area: name;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--phoenix-text-color, #1f2937);
    text-transform: none;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding-left: 16px;          /* room for the severity dot */
    letter-spacing: -0.005em;
}
.fl-renewal-card-name em { font-style: italic; }
.fl-renewal-card-emp {
    font-family: var(--fl-font-ui);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--phoenix-secondary, #64748b);
    text-transform: uppercase;
}
.fl-renewal-card-detail {
    grid-area: detail;
    font-size: 0.82rem;
    color: var(--phoenix-secondary, #64748b);
    padding-left: 16px;          /* align with name (past the severity dot) */
}
.fl-renewal-card-meta {
    grid-area: meta;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    white-space: nowrap;
}
.fl-renewal-card-date {
    font-size: 0.78rem;
    color: var(--phoenix-text-color, #1f2937);
    font-weight: 600;
}
.fl-renewal-card-status {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
}
.fl-renewal-card-status.s-overdue {
    color: #7f1d1d;
    background: #fee2e2;
}
.fl-renewal-card-status.s-soon {
    color: #92400e;
    background: #fef3c7;
}

/* Off-canvas loader — shown while data is fetched the first time */
.fl-renewal-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--phoenix-secondary, #64748b);
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    gap: 0.75rem;
}
.fl-renewal-loader-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid var(--phoenix-border-color, #e2e8f0);
    border-top-color: var(--phoenix-primary, #2d6a4f);
    animation: fl-renewal-spin 0.8s linear infinite;
}
@keyframes fl-renewal-spin { to { transform: rotate(360deg); } }

.fl-filter-more { position: relative; }
.fl-filter-more > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px dashed var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-family: var(--fl-font-ui);
    font-size: 0.78rem;
    color: var(--phoenix-secondary);
    transition: color 0.15s ease, border-color 0.15s ease, border-style 0.15s ease;
}
.fl-filter-more > summary::-webkit-details-marker { display: none; }
.fl-filter-more[open] > summary { color: var(--phoenix-primary); border-color: var(--phoenix-primary); border-style: solid; }
.fl-filter-more-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    /* Anchor to the right edge of the "More" button so the panel grows leftward
       into the page rather than overflowing the viewport on the right. */
    right: 0;
    left: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;       /* stack the three filters vertically — tighter, no overflow */
    gap: 0.4rem;
    padding: 0.55rem;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.08);
    width: 240px;
    max-width: calc(100vw - 2rem);
}
/* Each chip inside the More panel fills its width so the dropdowns line up nicely */
.fl-filter-more-panel .fl-filter-chip {
    width: 100%;
}

/* Disclosure wrapper — used for the compliance & audits block */
.fl-disclosure {
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    background: var(--phoenix-card-bg);
    margin-bottom: 1rem;
}
.fl-disclosure > summary {
    list-style: none;
    cursor: pointer;
    padding: 0.8rem 1rem;
    font-family: var(--fl-font-ui);
    font-weight: 600;
    color: var(--phoenix-text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.15s ease;
}
.fl-disclosure > summary::-webkit-details-marker { display: none; }
.fl-disclosure > summary::after {
    content: "›";
    margin-left: auto;
    color: var(--phoenix-secondary);
    transition: transform 0.2s ease;
    font-size: 1.1rem;
}
.fl-disclosure[open] > summary::after { transform: rotate(90deg); }
.fl-disclosure > summary small {
    font-weight: 400;
    color: var(--phoenix-secondary);
    margin-left: 0.4rem;
    font-size: 0.78rem;
}
.fl-disclosure > summary:hover { color: var(--phoenix-primary); }
.fl-disclosure-body { padding: 0 1rem 1rem; }

/* =====================================================
   AG-Grid — force single-line cells with ellipsis,
   right-align numeric "rate" cells so currency stays put.
   ===================================================== */
.ag-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: var(--ag-row-height, 36px);
}
.ag-cell-wrapper { flex-wrap: nowrap !important; }
.ag-cell-value { overflow: hidden; text-overflow: ellipsis; }
/* Disable wrapping defaults that some columns inherit */
.ag-cell.ag-cell-wrap-text { white-space: nowrap !important; }
/* Rate / currency columns — right-align so they fit narrow cols */
.ag-header-cell[col-id*="rate" i] .ag-header-cell-label,
.ag-header-cell[col-id*="amount" i] .ag-header-cell-label,
.ag-header-cell[col-id*="cost" i] .ag-header-cell-label,
.ag-header-cell[col-id*="hour" i] .ag-header-cell-label {
    justify-content: flex-end;
}
.ag-cell[col-id*="rate" i],
.ag-cell[col-id*="amount" i],
.ag-cell[col-id*="cost" i],
.ag-cell[col-id*="hour" i] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Custom HTML tables (labour, etc.) — keep numeric cells on one line */
.labour-rate-cell,
td.labour-rate-cell {
    white-space: nowrap !important;
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding-right: 0.85rem;
}
.labour-rate { white-space: nowrap; }

/* =====================================================
   Labour view-gating — show/hide sections by route.
   Tokens: workers | schedule | legacy. Element appears
   only when one of its tokens matches the container's
   data-labour-view.
   ===================================================== */
.labour-container[data-labour-view="workers"]  [data-view-only]:not([data-view-only~="workers"]),
.labour-container[data-labour-view="schedule"] [data-view-only]:not([data-view-only~="schedule"]),
.labour-container[data-labour-view="today"]    [data-view-only]:not([data-view-only~="today"]),
.labour-container[data-labour-view="legacy"]   [data-view-only]:not([data-view-only~="legacy"]) {
    display: none !important;
}
/* Schedule + Today views: no workers allocation table or filter bar. */
.labour-container[data-labour-view="schedule"] #labourWorkersCard,
.labour-container[data-labour-view="today"]    #labourWorkersCard {
    display: none !important;
}
.labour-container[data-labour-view="schedule"] .fl-filterbar,
.labour-container[data-labour-view="today"]    .fl-filterbar {
    display: none !important;
}

/* Italic summary sentence under the page title */
.fl-page-summary {
    font-family: Georgia, serif;
    font-size: 1rem;
    color: var(--phoenix-secondary);
    margin: 0.5rem 0 0;
    max-width: 760px;
}
.fl-page-summary strong {
    font-family: Georgia, serif;
    font-weight: 400;
    font-size: 1.15em;
    font-style: italic;
    color: var(--phoenix-primary);
}
.fl-page-summary em {
    font-style: italic;
    color: var(--phoenix-text-color);
}

/* =====================================================
   Worker table — editorial restyle.
   Hairline ruled list with breathing space, serif rate,
   muted badges, and a primary-tinted hover with a left
   bar that animates in.
   ===================================================== */
.labour-container .card { background: var(--phoenix-card-bg); }
.labour-container #workersTable {
    border-collapse: separate;
    border-spacing: 0;
}

/* Header row */
.labour-container #workersTable thead.table-light,
.labour-container #workersTable thead {
    background: transparent !important;
}
.labour-container #workersTable thead th {
    background: transparent !important;
    font-family: var(--fl-font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    padding: 0.85rem 0.85rem 0.55rem;
    border-top: none;
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}

/* Body rows */
.labour-container #workersTable tbody tr {
    transition: background 0.15s ease, transform 0.15s ease;
    position: relative;
}
.labour-container #workersTable tbody tr td {
    padding: 0.85rem 0.85rem;
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    vertical-align: middle;
    background: transparent;
}
.labour-container #workersTable tbody tr:hover,
.labour-container #workersTable tbody tr:hover td {
    background: rgba(var(--phoenix-primary-rgb), 0.04) !important;
}
/* Animated left accent on hover */
.labour-container #workersTable tbody tr td:first-child {
    position: relative;
}
.labour-container #workersTable tbody tr td:first-child::before {
    content: "";
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 0;
    background: var(--phoenix-primary);
    border-radius: 0 2px 2px 0;
    transition: width 0.18s ease;
}
.labour-container #workersTable tbody tr:hover td:first-child::before { width: 3px; }

/* Worker name + ID rhythm */
.labour-container #workersTable tbody td .fw-bold {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--phoenix-text-color);
    letter-spacing: -0.005em;
}
.labour-container #workersTable tbody td .fw-bold + br + small,
.labour-container #workersTable tbody td .text-muted.fw-normal {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--phoenix-secondary);
}

/* Rate column — pop with serif primary */
.labour-container td.labour-rate-cell .labour-rate,
.labour-container td.labour-rate-cell strong.labour-rate {
    font-family: Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--phoenix-primary);
}

/* Tone down badges */
.labour-container .badge {
    background: rgba(var(--phoenix-primary-rgb), 0.08) !important;
    color: var(--phoenix-primary) !important;
    font-family: var(--fl-font-ui);
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    border: none;
}
.labour-container .badge.bg-info { background: rgba(var(--phoenix-primary-rgb), 0.08) !important; color: var(--phoenix-primary) !important; }
.labour-container .badge.bg-success {
    background: rgba(16, 185, 129, 0.12) !important;
    color: var(--phoenix-success, #10b981) !important;
}
.labour-container .badge.bg-secondary {
    background: rgba(100, 116, 139, 0.1) !important;
    color: var(--phoenix-secondary) !important;
}
.labour-container .badge.text-dark { color: var(--phoenix-primary) !important; }

/* Card chrome around the table — drop the heavy Bootstrap card framing */
.labour-container > .card {
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}
.labour-container > .card > .card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
    padding: 1rem 1.25rem;
}
.labour-container > .card > .card-header h5 {
    font-family: var(--fl-font-ui);
    font-size: 0.75rem !important;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--phoenix-secondary) !important;
}
.labour-container > .card > .card-header .input-group,
.labour-container > .card > .card-header .labour-workers-search {
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
}
.labour-container > .card > .card-header .input-group .input-group-text,
.labour-container > .card > .card-header .input-group .form-control,
.labour-container > .card > .card-header .labour-workers-search .input-group-text,
.labour-container > .card > .card-header .labour-workers-search .form-control {
    background: transparent;
    border: none !important;
    font-family: var(--fl-font-ui);
    font-size: 0.85rem;
    box-shadow: none !important;
}
.labour-container > .card > .card-footer {
    background: transparent !important;
    border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted)) !important;
}

/* Initials avatar (no photo on file) */
.worker-photo-initials {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-family: var(--fl-font-ui);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #fff !important;
    background: hsl(var(--avatar-hue, 200), 45%, 48%) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 2px solid var(--phoenix-card-bg);
    vertical-align: middle;
    cursor: default;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.worker-photo-initials:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

/* Worker detail page */
.worker-detail-back {
    color: var(--phoenix-secondary) !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
}
.worker-detail-back:hover { color: var(--phoenix-primary) !important; }
.worker-detail-identity {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.worker-detail-photo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(var(--phoenix-primary-rgb), 0.1);
    color: var(--phoenix-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    border: 2px solid var(--phoenix-card-bg);
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}
.worker-detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.worker-detail-sub {
    margin: 0.4rem 0 0;
    font-family: Georgia, serif;
    font-style: italic;
    color: var(--phoenix-secondary);
}
.worker-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.worker-detail-card {
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    padding: 1.1rem 1.25rem 1.25rem;
}
.worker-detail-card-title {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin: 0 0 0.8rem;
}
.worker-detail-dl { display: grid; gap: 0.45rem; margin: 0; }
.worker-detail-dl > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed var(--phoenix-border-color, var(--fl-border-muted));
}
.worker-detail-dl > div:last-child { border-bottom: none; }
.worker-detail-dl dt {
    font-family: var(--fl-font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--phoenix-secondary);
    margin: 0;
}
.worker-detail-dl dd {
    margin: 0;
    font-size: 0.9rem;
    color: var(--phoenix-text-color);
    text-align: right;
    word-break: break-word;
}
.worker-detail-foot { display: flex; gap: 0.5rem; }

/* Workers view: drop allocation columns from the worker grid.
   Columns: 5 (Today's farm), 11 Block, 12 Variety, 13 Task, 14 Rows, 15 Leader, 16 Today */
.labour-container[data-labour-view="workers"] #workersTable th:nth-child(5),
.labour-container[data-labour-view="workers"] #workersTable td:nth-child(5),
.labour-container[data-labour-view="workers"] #workersTable th:nth-child(n+11),
.labour-container[data-labour-view="workers"] #workersTable td:nth-child(n+11) {
    display: none;
}

/* Schedule view: drop employment-detail columns, keep allocation + working status.
   Hidden: 4 Contact, 7 Type, 9 Rate, 10 HR. Kept: Photo, Worker, Emp#, Today's farm,
   Home, Position, Block, Variety, Task, Rows, Leader, Today(status). */
.labour-container[data-labour-view="schedule"] #workersTable th:nth-child(4),
.labour-container[data-labour-view="schedule"] #workersTable td:nth-child(4),
.labour-container[data-labour-view="schedule"] #workersTable th:nth-child(7),
.labour-container[data-labour-view="schedule"] #workersTable td:nth-child(7),
.labour-container[data-labour-view="schedule"] #workersTable th:nth-child(9),
.labour-container[data-labour-view="schedule"] #workersTable td:nth-child(9),
.labour-container[data-labour-view="schedule"] #workersTable th:nth-child(10),
.labour-container[data-labour-view="schedule"] #workersTable td:nth-child(10) {
    display: none;
}
/* Labour worker rows: give common short-value cells nowrap as a safety net */
.labour-worker-data-row td.text-center,
.labour-worker-data-row td:has(> .badge),
.labour-worker-data-row td:has(> strong) {
    white-space: nowrap;
}

/* PWA install pill — sidebar dock. Same vocabulary as theme/settings buttons. */
.sidebar-install { display: flex; width: 100%; }
.sidebar-install.d-none { display: none !important; }
.sidebar-install-btn {
    width: 100%;
    height: 40px;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--phoenix-primary, #2d6a4f);
    background: var(--phoenix-primary, #2d6a4f);
    color: #fff;
    cursor: pointer;
    font-family: var(--fl-font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(45, 106, 79, 0.18);
    transition: background 0.15s ease, transform 0.15s ease;
}
/* The 80px desktop rail has room for the icon only. */
.sidebar.collapsed .sidebar-install { justify-content: center; }
.sidebar.collapsed .sidebar-install-label { display: none; }
.sidebar-install-btn:hover {
    background: var(--phoenix-primary-hover, var(--phoenix-dark, #1b4332));
    transform: translateY(-1px);
}

/* Route loading state. Without this the content area stayed blank for the whole
   fetch, which on a weak mobile connection is indistinguishable from a freeze. */
.fl-route-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    padding: 1.5rem;
}

.fl-route-loading-inner {
    text-align: center;
}

.fl-route-loading-text {
    font-family: var(--fl-font-ui);
    font-size: 0.9rem;
    color: var(--phoenix-secondary);
    margin: 0.85rem 0 0;
}

/* Held back until the wait is long enough that silence would worry the user. */
.fl-route-loading-slow {
    font-family: var(--fl-font-ui);
    font-size: 0.82rem;
    color: var(--phoenix-secondary);
    margin: 0.35rem 0 0;
    opacity: 0;
    animation: fl-route-slow-hint 0.3s ease forwards 4s;
}

@keyframes fl-route-slow-hint {
    to { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
    .fl-route-loading-slow { animation-delay: 4s; animation-duration: 0.01s; }
}

/* Shown in the content area when a module's HTML can't be fetched — replaces
   the silent blank page that read as the app freezing. */
.fl-route-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 1.5rem;
}

.fl-route-error-card {
    max-width: 380px;
    text-align: center;
    background: var(--phoenix-card-bg, #fff);
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.07);
    padding: 2rem 1.5rem;
}

.fl-route-error-card i {
    font-size: 1.6rem;
    color: var(--phoenix-primary);
    margin-bottom: 0.85rem;
}

.fl-route-error-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
}

.fl-route-error-card p {
    font-family: var(--fl-font-ui);
    font-size: 0.9rem;
    color: var(--phoenix-secondary);
    margin: 0 0 1.25rem;
}

/* Which stage stalled. Deliberately readable in a screenshot — it is how a
   stall on someone's phone gets diagnosed without Web Inspector. */
.fl-route-error-card .fl-route-error-stage {
    font-size: 0.75rem;
    opacity: 0.75;
    margin: 1rem 0 0;
    font-variant-numeric: tabular-nums;
}

/* Which build is actually running. The shell and the router are cached
   independently, so a device can run a current shell with a stale router — this
   makes that visible instead of invisible. */
.fl-route-build {
    font-family: var(--fl-font-ui);
    font-size: 0.68rem;
    color: var(--phoenix-secondary);
    opacity: 0.55;
    margin: 0.75rem 0 0;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Phone-only hamburger that opens the module nav drawer, plus the drawer.
   ========================================================================== */
/* Fixed to the top right: the drawer slides in from the left, so the button
   never collides with it and stays reachable while the drawer is open. */
.fl-nav-launcher {
    position: fixed;
    top: max(0.6rem, env(safe-area-inset-top));
    right: max(0.6rem, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    border: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
    border-radius: 12px;
    background: var(--phoenix-card-bg, #fff);
    color: var(--phoenix-primary);
    font-size: 1.05rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    z-index: 1060;
}

.fl-nav-launcher:active {
    background: rgba(var(--phoenix-primary-rgb, 45, 106, 79), 0.14);
}

/* The drawer scrolls internally; the page behind it must not. */
body.fl-nav-open {
    overflow: hidden;
}

/* ==========================================================================
   Phone: module nav as an off-canvas drawer
   --------------------------------------------------------------------------
   Everything from the editorial redesign above (~line 2266 onward) is written
   without media queries, so those desktop rules — .sidebar width 320px,
   .main-content margin-left 320px, .main-content.sidebar-collapsed
   margin-left 80px — also apply on phones and outrank the responsive block
   near the top of this file. This block is last in the cascade on purpose:
   it is the one that has to win at phone widths.
   ========================================================================== */
@media (max-width: 767.98px) {

    /* The drawer itself: real width, parked off-screen, hidden when closed so
       its rows cannot ghost-paint over the page (the sidebar sets
       overflow: visible for the desktop collapse pill). */
    .container-fluid > .row > .sidebar,
    .sidebar {
        /* .navbar is display:none in the editorial redesign, so the drawer
           owns the full viewport height. */
        top: 0 !important;
        height: 100vh !important;
        /* iOS Safari's 100vh is the viewport with its toolbars hidden, so the
           foot of the drawer sits under them. dvh is the visible height. */
        height: 100dvh !important;
        width: min(86vw, 320px) !important;
        max-width: none !important;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.28s ease, visibility 0.28s ease;
    }

    .container-fluid > .row > .sidebar.show,
    .sidebar.show {
        transform: translateX(0);
        visibility: visible;
    }

    /* Scrim: a real sibling element rather than a pseudo-element on the
       sidebar. The sidebar sits at z-index 1050 and forms its own stacking
       context, so a negative-z-index child of it paints over the drawer's own
       background instead of behind it. A separate element at 1040 layers
       unambiguously: above .main-content, below the drawer. */
    .fl-nav-backdrop {
        position: fixed;
        /* Longhand as well as `inset`: iOS Safari only shipped `inset` in 14.5,
           and without offsets the backdrop collapses to zero size. */
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
        z-index: 1040;
    }

    .fl-nav-backdrop.show {
        opacity: 1;
        /* Absorb the tap so it dismisses the drawer instead of activating
           whatever sits underneath. */
        pointer-events: auto;
    }

    /* The desktop 80px icon rail is meaningless on a phone — the drawer is
       either open or closed. */
    .container-fluid > .row > .sidebar.collapsed,
    .sidebar.collapsed {
        width: min(86vw, 320px) !important;
    }

    /* Content always owns the full viewport, whichever classes the desktop
       collapse handler left behind. */
    .main-content,
    .main-content.sidebar-collapsed,
    .container-fluid > .row > .main-content,
    .container-fluid > .row > .main-content.sidebar-collapsed {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        /* Clear the fixed launcher in the top-right corner. */
        padding: 4.25rem 1rem 2rem !important;
    }

    /* The collapse pill sits half outside the sidebar, so on a phone it shows
       as an unexplained sliver at the screen edge that toggles the wrong
       state. The navbar hamburger replaces it. */
    .sidebar-collapse-pill { display: none !important; }

    /* Comfortable touch rows — the editorial rules above tighten these to
       ~0.35rem padding, which is under the 44px tap-target guideline. */
    .sidebar .flex-grow-1 > ul.nav > li.nav-item > a.nav-link {
        padding: 0.7rem 0.9rem 0.7rem 0.5rem !important;
        font-size: 0.975rem !important;
    }

    .sidebar .collapse .nav-link {
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
        font-size: 0.925rem !important;
    }

    .sidebar .flex-grow-1 { padding: 1.25rem 1.1rem 1rem !important; }

    /* The module list is taller than a phone screen, so the dock (user pill
       with Refresh / Sign out, notifications, theme) landed ~300px below the
       fold. Nothing hinted that the drawer scrolls, so on a phone there was
       effectively no way to sign out. Pin the dock to the foot of the drawer
       and let the list scroll behind it. */
    .sidebar-dock {
        position: sticky !important;
        bottom: 0 !important;
        background: var(--phoenix-body-bg);
        border-top: 1px solid var(--phoenix-border-color, var(--fl-border-muted));
        padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
        z-index: 5;
    }

    /* The settings gear sits at the right edge of the drawer, and its menu was
       positioned against the gear itself, so on a phone it opened half outside
       the drawer and got clipped. Unposition the gear's wrapper so the menu
       anchors to the (sticky, so positioned) dock and spans the drawer width. */
    .sidebar-dock .sidebar-settings { position: static !important; }
    .sidebar-dock .sidebar-settings-menu {
        max-height: calc(100dvh - 10rem);
        overflow-y: auto;
    }

    /* Dragging past the end of the menu made iOS stretch-bounce the list away
       from the pinned dock, showing a large empty gap. */
    .sidebar-inner { overscroll-behavior: contain; }

    /* Dock popovers are anchored to the right of the sidebar (left: 100% + gap),
       which on a 390px screen puts them off-screen. Keep them inside the drawer.
       The drawer is transformed, so it is the containing block for the panel's
       position: fixed state too. */
    .sidebar-notif-panel,
    .sidebar-settings-menu,
    .sidebar.collapsed .sidebar-notif-panel,
    .sidebar.collapsed .sidebar-settings-menu,
    .sidebar-notifications.is-open .sidebar-notif-panel {
        left: 0.5rem !important;
        right: 0.5rem !important;
        width: auto !important;
        max-width: none !important;
    }

    /* Full-bleed dialogs beat a cramped centred card on a phone. Opt a dialog
       out with .fl-modal-compact (or .modal-sm) when it is a spinner or a
       one-line confirmation that should stay a small card. */
    .modal-dialog:not(.modal-fullscreen):not(.modal-sm):not(.fl-modal-compact) {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        min-height: 100%;
    }

    .modal-dialog:not(.modal-fullscreen):not(.modal-sm):not(.fl-modal-compact) > .modal-content {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    /* Keep the dialog's own actions reachable without hunting for them. */
    .modal-dialog:not(.modal-sm):not(.fl-modal-compact) .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--phoenix-card-bg, #fff);
        z-index: 2;
    }
}

