/* css/main.css */

/* ==========================================================================
   1. Base Global Elements
   ========================================================================= */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ==========================================================================
   2. Core Login Portal Styles
   ========================================================================== */
.login-page-body {
    margin: 0;
    background: linear-gradient(135deg, #3c1053 0%, #2d0c3e 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    background: #ffffff;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-top: 6px solid #e5007d;
    box-sizing: border-box;
    text-align: center;
}

.brand-logo {
    height: 48px;
    margin-bottom: 25px;
}

h2 {
    margin: 0 0 8px 0;
    color: #3c1053;
    font-size: 22px;
    font-weight: 800;
}

p.subtitle {
    margin: 0 0 25px 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: left;
    word-break: break-word;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 18px;
    text-align: left;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    color: #1e293b;
}

input[type="text"]:focus, input[type="password"]:focus {
    border-color: #e5007d;
    box-shadow: 0 0 0 3px rgba(229, 0, 125, 0.15);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #3c1053;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #2d0c3e;
}

.forgot-link {
    display: inline-block;
    margin-top: 18px;
    font-size: 12px;
    color: #e5007d;
    text-decoration: none;
    font-weight: 700;
}

.forgot-link:hover {
    text-decoration: underline;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
    visibility: visible;
    opacity: 1;
}

.modal-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    max-width: 550px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15);
    text-align: left;
    box-sizing: border-box;
}

.modal-card h3 {
    margin: 0 0 10px 0;
    color: #3c1053;
    font-size: 18px;
    font-weight: 800;
}

.modal-card p {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.btn-close-modal {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    display: block;
    margin-left: auto;
}

/* ==========================================================================
   3. Global Application Master Frames
   ========================================================================== */
.app-authenticated-body {
    background: #f1f5f9 !important;
    display: block !important;
    height: auto !important;
}

.top-header { 
    background-color: #3c1053; 
    color: white; 
    padding: 0 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10000;
}

.logo-container { display: flex; align-items: center; height: 100%; }
.logo-img { height: 40px; width: auto; display: block; }
.nav-container { display: flex; align-items: center; gap: 5px; height: 100%; }

.nav-link { 
    color: white; text-decoration: none; font-weight: 600; font-size: 13px; padding: 0 15px;
    height: 60px; display: flex; align-items: center; transition: background 0.2s; 
}
.nav-link:hover { background: rgba(255,255,255,0.1); }

.dropdown { position: relative; display: inline-block; height: 100%; }
.dropdown::after { content: ""; position: absolute; top: 100%; left: 0; width: 100%; height: 15px; display: block; z-index: 1; }
.dropbtn { color: white; text-decoration: none; font-weight: 600; font-size: 13px; padding: 0 15px; height: 100%; cursor: pointer; display: flex; align-items: center; }
.dropdown:hover .dropbtn { background: rgba(255,255,255,0.1); }

.dropdown-content { 
    display: none; position: absolute; background-color: #ffffff; min-width: 220px; 
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.15); z-index: 9999; border-radius: 0 0 6px 6px; overflow: hidden; top: 60px; left: 0;
}
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a { color: #334155; padding: 12px 16px; text-decoration: none; display: block; font-size: 13px; font-weight: 600; border-bottom: 1px solid #f1f5f9; }
.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: #fdf2f8; color: #e5007d; }

.dev-badge-dropdown { position: relative; display: inline-block; }
.dev-badge-dropdown::after { content: ""; position: absolute; top: 100%; right: 0; width: 150px; height: 20px; display: block; }
.user-badge { background-color: #e5007d; color: white; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; margin-left: 5px; cursor: default; }
.user-badge.rank-developer { background-color: #fbbf24; color: #3c1053; cursor: pointer; }

.dev-dropdown-content { display: none; position: absolute; background-color: #ffffff; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 10001; border-radius: 6px; overflow: hidden; top: 100%; right: 0; margin-top: 10px; }
.dev-dropdown-content a { color: #334155; padding: 10px 15px; text-decoration: none; display: block; font-size: 12px; font-weight: bold; border-bottom: 1px solid #f1f5f9; }
.dev-dropdown-content a:hover { background-color: #fffbeb; color: #b45309; }
.dev-badge-dropdown:hover .dev-dropdown-content { display: block; }

.user-section { display: flex; align-items: center; gap: 15px; margin-left: 10px; border-left: 1px solid rgba(255,255,255,0.2); padding-left: 20px; height: 100%; }
.logout-btn { border: 1px solid rgba(255,255,255,0.3); background: transparent; color: white; padding: 6px 12px; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 11px; font-weight: bold; }
.logout-btn:hover { background: #ef4444; border-color: #ef4444; }
.main-content { padding: 20px; }

@keyframes pulse-red { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.live-dot { display: inline-block; animation: pulse-red 2s infinite; margin-right: 4px; }

/* ==========================================================================
   4. Command Operations Dashboard Layouts
   ========================================================================== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border-top: 4px solid #3c1053;
}

.command-header h2 { margin: 0; color: #3c1053; font-size: 24px; }
.command-header p.operator-text { margin: 5px 0 0; color: #64748b; font-size: 14px; }
.command-header p.login-text { margin: 5px 0 0; color: #94a3b8; font-size: 11px; }
.command-header .clock-pane { text-align: right; }
.command-header .clock-title { font-size: 11px; font-weight: bold; color: #e5007d; text-transform: uppercase; margin-bottom: 4px; }
.command-header .clock-time { font-size: 32px; font-weight: 800; color: #1e293b; line-height: 1; }
.command-header .clock-date { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.weather-deck {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.weather-deck .deck-left { display: flex; align-items: center; gap: 15px; }
.weather-deck .weather-icon-box { font-size: 26px; background: #e2e8f0; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.weather-deck .weather-label-title { color: #334155; font-size: 14px; font-weight: bold; }
.weather-deck .weather-metrics-row { margin-top: 3px; display: flex; gap: 15px; font-size: 12px; color: #475569; font-weight: 500; }
.weather-deck .deck-right { text-align: right; display: flex; align-items: center; gap: 12px; }
.weather-deck .gusts-title { font-size: 10px; font-weight: bold; color: #64748b; text-transform: uppercase; }
.weather-deck .gusts-val { font-size: 16px; font-weight: 800; color: #1e293b; }
.weather-deck .erskine-status-badge { font-size: 10px; font-weight: bold; padding: 6px 12px; border-radius: 6px; text-transform: uppercase; border: 1px solid; }

.search-board-container {
    background: #3c1053;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-board-container .search-label { color: white; font-weight: bold; font-size: 16px; min-width: 180px; }
.search-board-container form { flex-grow: 1; display: flex; gap: 10px; }
.search-board-container input { flex-grow: 1; padding: 12px 15px; border-radius: 6px; border: none; outline: none; font-size: 15px; }
.search-board-container button { background: #e5007d; color: white; border: none; padding: 0 25px; border-radius: 6px; font-weight: bold; cursor: pointer; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-card.card-purple { border-left: 6px solid #3c1053; }
.stat-card.card-pink { border-left: 6px solid #e5007d; }
.stat-card.card-violet { border-left: 6px solid #a855f7; }
.stat-card.card-blue { border-left: 6px solid #3b82f6; }

.stat-card .stat-title { color: #64748b; font-size: 12px; font-weight: bold; text-transform: uppercase; }
.stat-card .stat-number { font-size: 32px; font-weight: 800; margin: 8px 0; color: #1e293b; }
.stat-card .stat-footer-green { color: #10b981; font-size: 12px; font-weight: 600; }
.stat-card .stat-footer-gray { color: #64748b; font-size: 12px; }

.stat-card .health-rows { margin: 10px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.stat-card .health-line { display: flex; justify-content: space-between; font-size: 11px; font-weight: bold; }
.stat-card .health-label-text { color: #475569; }
.stat-card .bridges-footnote { color: #64748b; font-size: 11px; border-top: 1px dashed #e2e8f0; padding-top: 4px; margin-top: 4px; }

.stat-card .crossings-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; }
.stat-card .crossing-row { display: flex; justify-content: space-between; align-items: center; }
.stat-card .crossing-open-badge { background: #ecfdf5; color: #10b981; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: bold; text-transform: uppercase; }

.bottom-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1.3fr;
    gap: 20px;
    align-items: start;
}

.bottom-dashboard-layout .action-buttons-column { display: flex; flex-direction: column; gap: 15px; }

.bottom-dashboard-layout .live-assist-pending-banner {
    text-decoration: none; background: #ef4444; color: white; padding: 20px; border-radius: 12px; text-align: center; box-shadow: 0 4px 12px rgba(239,68,68,0.3); font-weight: bold; animation: pulse 2s infinite; display: block;
}
.bottom-dashboard-layout .live-assist-pending-banner .assist-icon { font-size: 24px; margin-bottom: 4px; }

.bottom-dashboard-layout .dash-navigation-card {
    text-decoration: none; color: white; padding: 30px 20px; border-radius: 12px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: transform 0.2s; display: block;
}
.bottom-dashboard-layout .dash-navigation-card.bg-purple { background: #3c1053; }
.bottom-dashboard-layout .dash-navigation-card.bg-pink { background: #e5007d; }
.bottom-dashboard-layout .dash-navigation-card.bg-green { background: #10b981; }
.bottom-dashboard-layout .dash-navigation-card .card-icon { font-size: 30px; margin-bottom: 10px; }
.bottom-dashboard-layout .dash-navigation-card .card-label { font-size: 18px; font-weight: bold; }

.feed-panel {
    background: white; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); overflow: hidden; display: flex; flex-direction: column; max-height: 600px;
}
.feed-panel .panel-header { padding: 15px 20px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.feed-panel .panel-header h4 { margin: 0; font-size: 16px; font-weight: bold; }
.feed-panel .panel-header h4.color-purple { color: #3c1053; }
.feed-panel .panel-header h4.color-pink { color: #e5007d; }

.feed-panel .feed-form-area { padding: 15px 20px; border-bottom: 1px solid #e2e8f0; background: #ffffff; }
.feed-panel .feed-form-area form { display: flex; flex-direction: column; gap: 10px; }
.feed-panel .feed-form-area textarea { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; resize: none; font-family: inherit; font-size: 13px; height: 60px; box-sizing: border-box; }
.feed-panel .feed-form-area .form-controls-row { display: flex; justify-content: space-between; align-items: center; }
.feed-panel .feed-form-area select { padding: 6px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; color: #475569; }
.feed-panel .feed-form-area button { background: #3b82f6; color: white; border: none; padding: 6px 15px; border-radius: 4px; font-size: 12px; font-weight: bold; cursor: pointer; }

.feed-panel .feed-scrollable-container { overflow-y: auto; flex-grow: 1; padding: 0 20px; }
.feed-panel .feed-empty-state { font-size: 13px; color: #94a3b8; text-align: center; margin-top: 30px; padding-bottom: 30px; }

.feed-panel .feed-item { padding: 15px 0; border-bottom: 1px solid #f1f5f9; }
.feed-panel .feed-item .item-top-line { display: flex; justify-content: space-between; align-items: start; margin-bottom: 5px; }
.feed-panel .feed-item .item-title { font-size: 13px; font-weight: bold; color: #1e293b; }
.feed-panel .feed-item .item-badge { font-size: 10px; color: white; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.feed-panel .feed-item .item-body-text { font-size: 12px; color: #475569; margin-bottom: 8px; line-height: 1.4; }
.feed-panel .feed-item .item-meta-line { font-size: 10px; color: #94a3b8; display: flex; gap: 10px; }

/* ==========================================================================
   5. Network & Sector Asset Management Layouts (manage-networks.php)
   ========================================================================== */
.manage-split-container { display: flex; gap: 20px; margin: 20px; align-items: flex-start; }
.side-card { width: 400px; flex-shrink: 0; }
.main-grid { flex-grow: 1; }
.admin-card { background: white; padding: 25px; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.admin-card h2 { margin: 0 0 20px 0; color: #3c1053; border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; font-size: 18px; font-weight: 800; }
.admin-card .form-group { margin-bottom: 15px; }
.admin-card .form-group label { display: block; font-size: 11px; font-weight: bold; text-transform: uppercase; color: #64748b; margin-bottom: 5px; letter-spacing: 0.5px; }
.admin-card .form-group input, .admin-card .editor-row-input { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; box-sizing: border-box; background: #f8fafc; color: #1e293b; outline: none; }
.admin-card .form-group input:focus, .admin-card .editor-row-input:focus { border-color: #3c1053; background: #ffffff; }
.btn-submit-assets { width: 100%; background: #10b981; color: white; border: none; padding: 12px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 14px; transition: background 0.2s; }
.btn-submit-assets:hover { background: #059669; }
.badge-depot { background: #f1f5f9; color: #475569; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; display: inline-block; margin: 2px; text-decoration: none; border: 1px solid #cbd5e1; }
.badge-depot:hover { border-color: #3c1053; color: #3c1053; background: #ffffff; }
.admin-card table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.admin-card th { text-align: left; padding: 10px; border-bottom: 2px solid #e2e8f0; color: #64748b; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
.admin-card td { padding: 12px; border-bottom: 1px solid #f1f5f9; }
.admin-card .alert { padding: 12px; border-radius: 6px; margin-bottom: 20px; font-weight: bold; text-align: center; }
.admin-card .alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.admin-card .alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ==========================================================================
   6. User Management Layout Class Additions (🌟 NEW CLEANUP ENTRY)
   ========================================================================== */
.users-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1500px;
    margin: 20px auto 10px auto;
    padding: 0 20px;
}
.users-page-header h2 { color: #3c1053; margin: 0; font-weight: 800; font-size: 24px; }

.btn-create-trigger {
    background: #3c1053; color: white; padding: 10px 20px; border: none; border-radius: 6px;
    font-weight: 700; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px;
}
.btn-create-trigger:hover { background: #250a35; }

.filter-deck {
    background: white; max-width: 1500px; margin: 10px auto 20px auto; padding: 15px 20px;
    border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); border: 1px solid #e2e8f0;
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 15px; box-sizing: border-box;
}
.filter-deck input, .filter-deck select {
    width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    box-sizing: border-box; font-size: 13px; color: #1e293b; outline: none; background: #f8fafc;
}
.filter-deck input:focus, .filter-deck select:focus { border-color: #e5007d; background: #fff; }

.table-card {
    background: white; max-width: 1500px; margin: 0 auto 40px auto; border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-top: 5px solid #e5007d; overflow: hidden;
}
.user-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.user-table th { background: #f8fafc; padding: 14px 16px; border-bottom: 2px solid #e2e8f0; color: #475569; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.user-table td { padding: 14px 16px; border-bottom: 1px solid #e2e8f0; color: #334155; vertical-align: middle; }
.user-table tr:hover td { background: #fdf2f8; }

.status-badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-active { background: #dcfce7; color: #166534; }
.status-suspended { background: #fee2e2; color: #991b1b; }

.btn-settings-trigger {
    background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; padding: 6px 12px;
    border-radius: 4px; font-weight: 700; cursor: pointer; font-size: 12px; transition: all 0.2s;
}
.btn-settings-trigger:hover { background: #3c1053; color: white; border-color: #3c1053; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-form-group { margin-bottom: 14px; }
.modal-form-group label { display: block; font-size: 11px; font-weight: 700; color: #475569; text-transform: uppercase; margin-bottom: 5px; }
.modal-form-group input, .modal-form-group select { width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; box-sizing: border-box; outline: none; }
.modal-form-group input:focus, .modal-form-group select:focus { border-color: #e5007d; }

.modal-actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; border-top: 1px solid #e2e8f0; padding-top: 15px; }
.btn-modal-cancel { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; padding: 9px 16px; border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 13px; }
.btn-modal-save { background: #3c1053; color: white; border: none; padding: 9px 20px; border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 13px; }
.btn-modal-save.bg-pink { background: #e5007d; }

/* ==========================================================================
   7. Route & Fleet Scheduling Layouts (manage-routes.php)
   ========================================================================== */
.route-badge {
    background: #3c1053;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    display: inline-block;
    min-width: 35px;
    text-align: center;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(60, 16, 83, 0.15);
}

.diversion-pill {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fdba74;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.diversion-pill.none {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.route-direction-text {
    font-size: 13px;
    color: #1e293b;
    font-weight: 600;
}
.route-arrow {
    color: #94a3b8;
    margin: 0 4px;
    font-weight: normal;
}

/* ==========================================================================
   8. Advanced Tree-Grid Route Matrix Styles (manage-routes.php appends)
   ========================================================================== */
.manage-split-container { display: flex; gap: 16px; margin: 12px; box-sizing: border-box; align-items: flex-start; }
.side-controls-column { width: 340px; display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
.main-data-column { flex-grow: 1; min-width: 500px; }

/* Premium Sidebar UI Styling Match */
.filter-panel-card { 
    background: #ffffff; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    display: flex; 
    flex-direction: column; 
    border: 1px solid #e2e8f0;
}
.filter-panel-card h4 { 
    margin: 0 0 4px 0; 
    color: #1e293b; 
    font-size: 16px; 
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.filter-panel-card .panel-sub {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
}
.network-group { 
    background: #ffffff; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    padding: 4px; 
    margin-bottom: 14px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}
.network-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 700; 
    color: #334155; 
    font-size: 13px; 
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 6px;
}
.depot-list-container { padding: 4px 0; }
.depot-list-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 8px 12px 8px 32px; 
    font-size: 12px; 
    color: #475569; 
    font-weight: 600;
    border-radius: 6px;
    margin: 2px 4px;
    transition: all 0.15s ease-in-out;
}
.depot-list-item:hover { background: #f1f5f9; color: #1e293b; }

.btn-toggle-all { 
    background: #f1f5f9; border: none; color: #475569; font-size: 11px; font-weight: 700; cursor: pointer; padding: 6px 12px; border-radius: 6px; transition: background 0.15s;
}
.btn-toggle-all:hover { background: #e2e8f0; color: #1e293b; }

/* Search Component Layout */
.search-input-wrapper { display: flex; margin-bottom: 15px; align-items: center; justify-content: space-between; gap: 15px; }
.filter-search-input { padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; font-weight: 700; width: 100%; max-width: 300px; outline: none; background-color: #f8fafc; }
.filter-search-input:focus { border-color: #e5007d; background-color: #ffffff; box-shadow: 0 0 0 3px rgba(229,0,125,0.1); }

.btn-danger { background: #ef4444; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 11px; font-weight:bold; transition: background 0.2s;}
.btn-danger:hover { background: #dc2626; }
.btn-edit { background: #3b82f6; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 11px; font-weight:bold; margin-right: 5px; transition: background 0.2s;}
.btn-edit:hover { background: #2563eb; }
.btn-live { background: #3c1053; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 11px; font-weight:bold; margin-right: 5px; transition: opacity 0.2s;}
.btn-live:hover { opacity: 0.85; color: #e5007d; }

.badge-net { background: #e2e8f0; color: #475569; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; margin-right: 6px; text-transform: uppercase; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid #cbd5e1; vertical-align: middle; margin-right: 4px; }

/* Interactive Tree-Grid Collapsible Styling */
.group-header-row { background: #f8fafc; cursor: pointer; font-weight: bold; border-left: 4px solid #e5007d; transition: background 0.15s; }
.group-header-row:hover { background: #f1f5f9; }
.toggle-indicator { display: inline-block; transition: transform 0.2s ease-in-out; margin-right: 8px; color: #e5007d; font-size: 11px; }
.nested-route-cell { padding-left: 28px !important; }

/* ==========================================================================
   10. Diversion Alteration & Tab Management Layouts (manage-diversions.php)
   ========================================================================== */

/* Layout and header */
.diversion-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.admin-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(16,24,40,0.04);
    border: 1px solid #eef2f7;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Tab container and buttons */
.tab-container {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
}

.tab-btn {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: #f1f5f9;
    font-weight: 700;
    color: #64748b;
    border-radius: 8px 8px 0 0;
    transition: background 0.18s ease, color 0.18s ease, transform 0.08s ease;
    outline: none;
    box-shadow: none;
    font-size: 13px;
}

.tab-btn:hover {
    transform: translateY(-1px);
}

.tab-btn.active {
    background: #3c1053;
    color: #ffffff;
}

/* Tab content */
.tab-content {
    display: none;
    background: #ffffff;
    padding: 20px;
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    margin-top: -1px;
}

.tab-content.active {
    display: block;
}

/* Table basics */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: #334155;
}

th {
    text-align: left;
    background: #f8fafc;
    padding: 12px;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 700;
    font-size: 13px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

/* Badge styles */
.badge {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    line-height: 1;
}

/* Known badge tokens - keep these in sync with PHP badge token mapping */
.badge-Emergency { background: #fee2e2; color: #dc2626; }
.badge-Road { background: #e0f2fe; color: #0369a1; }
.badge-Blocked { background: #fef3c7; color: #92400e; }

/* Hide any accidental empty badge class */
.badge.badge- { display: none; }

/* Action links */
.action-link {
    font-weight: 700;
    text-decoration: none;
    font-size: 11px;
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
    color: inherit;
}

/* Narrative box */
.narrative-box {
    max-height: 80px;
    overflow-y: auto;
    background: #f8fafc;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    line-height: 1.5;
    font-size: 11px;
    color: #475569;
}

/* Developer override zone */
.dev-override-zone {
    margin-top: 10px;
    border-top: 1px dotted #ccc;
    padding-top: 5px;
}

/* Primary create button — matches original inline styling */
.btn-submit-assets {
    padding: 12px 25px;
    background: #e5007d;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(229,0,125,0.2);
    font-size: 14px;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    width: auto;
    flex: 0 0 auto;
    align-self: center;
    max-width: 320px;
}

/* Button hover */
.btn-submit-assets:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

/* Ensure header keeps items inline and button does not stretch */
.diversion-header-row > .btn-submit-assets {
    flex: 0 0 auto;
    align-self: center;
    width: auto !important;
    max-width: 320px;
    display: inline-block;
}

/* Small utility styles */
.small-muted {
    font-size: 12px;
    color: #94a3b8;
}

.center-empty {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

/* Responsive tweaks */
@media (max-width: 900px) {
    .diversion-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    th, td { font-size: 12px; padding: 10px; }
    .tab-btn { padding: 8px 12px; font-size: 12px; }
    .btn-submit-assets { width: auto; max-width: 100%; }
}

/* Accessibility */
.tab-btn:focus { box-shadow: 0 0 0 3px rgba(60,16,83,0.12); }
.action-link:focus { outline: 2px dashed rgba(16,24,40,0.08); outline-offset: 2px; }

/* ==========================================================================
   RETRO 2011 MESSENGER FIXED CHAT INFRASTRUCTURE
   ========================================================================== */
#fleet-chat-bar {
    position: fixed;
    bottom: 0;
    right: 20px;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    pointer-events: none;
}
#chat-windows-container, #chat-roster-box {
    pointer-events: auto;
}
#chat-roster-box {
    width: 240px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}
#chat-roster-header {
    background: #3c1053;
    color: #ffffff;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#chat-roster-header:hover {
    background: #4d166b;
}
#chat-roster-body {
    height: 300px;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
#chat-search-wrapper {
    padding: 6px;
    background: #ededed;
    border-bottom: 1px solid #ddd;
}
#chat-user-search {
    width: 100%;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
#chat-roster-users {
    flex-grow: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.roster-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #334155;
    transition: background 0.15s;
}
.roster-user-row:hover {
    background: #e2e8f0;
}
.roster-user-info {
    display: flex;
    flex-direction: column;
}
.roster-user-role {
    font-size: 10px;
    color: #64748b;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}
.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}
.chat-unread-badge {
    background: #e5007d;
    color: #ffffff;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 10px;
    margin-right: auto;
    margin-left: 6px;
}
.chat-window {
    width: 250px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}
.chat-win-header {
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    color: #334155;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-win-header:hover {
    background: #e2e8f0;
}
.chat-win-body {
    height: 220px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
}
.chat-msg-line {
    max-width: 85%;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-msg-line.inbound {
    background: #f1f5f9;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.chat-msg-line.outbound {
    background: #3c1053;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.chat-msg-time {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 2px;
    display: block;
    text-align: right;
}
.chat-msg-line.outbound .chat-msg-time {
    color: #c084fc;
}
.chat-win-footer {
    border-top: 1px solid #e2e8f0;
    padding: 6px;
    background: #f8fafc;
}
.chat-win-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 6px;
    font-size: 12px;
    box-sizing: border-box;
    resize: none;
    outline: none;
}
.chat-win-input:focus {
    border-color: #3c1053;
}
.chat-close-btn {
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.chat-close-btn:hover {
    color: #dc2626;
}

/* ==========================================================================
   First Control - Fleet Mapping Engine & Dashboard Split Layout
   ========================================================================== */

/* Layout Container Scaffolding */
.map-split-container { 
    display: flex; 
    gap: 16px; 
    height: calc(100vh - 100px); 
    margin: 12px; 
    box-sizing: border-box; 
}

/* Sidebar Control & Filter Panel */
.filter-panel { 
    width: 340px; 
    background: #ffffff; 
    padding: 20px; 
    border-radius: 12px; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    border: 1px solid #e2e8f0; 
}

.filter-panel h4 { 
    margin: 0 0 4px 0; 
    color: #1e293b; 
    font-size: 16px; 
    font-weight: 700; 
    letter-spacing: -0.3px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.filter-panel .panel-sub { 
    font-size: 11px; 
    color: #94a3b8; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    margin-bottom: 15px; 
    border-bottom: 2px solid #f1f5f9; 
    padding-bottom: 10px; 
}

/* Route Spotlight Selection Boxes */
.route-select-box { 
    width: 100%; 
    padding: 10px 12px; 
    font-size: 13px; 
    font-weight: 700; 
    color: #1e293b; 
    background-color: #f8fafc; 
    border: 1px solid #cbd5e1; 
    border-radius: 8px; 
    outline: none; 
    cursor: pointer; 
    margin-bottom: 20px; 
}

/* Global Filter Toggle Utility Button */
.btn-toggle-all {
    background: none;
    border: none;
    color: #e5007d;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0;
}

.btn-toggle-all:hover {
    text-decoration: underline;
}

/* Operational Footprint Tree Hierarchy */
.network-group { 
    background: #ffffff; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    padding: 4px; 
    margin-bottom: 14px; 
}

.network-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 700; 
    color: #334155; 
    font-size: 13px; 
    background: #f8fafc; 
    padding: 10px 12px; 
    border-radius: 6px; 
}

.depot-list-container {
    display: flex;
    flex-direction: column;
}

.depot-list-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 8px 12px 8px 32px; 
    font-size: 12px; 
    color: #475569; 
    font-weight: 600; 
}

/* Form Input Checkbox Overrides */
.network-chk, .depot-chk {
    cursor: pointer;
}

/* Aggregated Route Multi-Hover Tooltip Styling */
.leaflet-tooltip.route-tooltip-shell { 
    background: #0f172a !important; 
    border: 1px solid #334155 !important; 
    color: #ffffff !important; 
    font-size: 12px !important; 
    padding: 8px 12px !important; 
    border-radius: 6px !important; 
    font-weight: 600 !important; 
    max-width: 320px; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); 
}
.leaflet-tooltip.route-tooltip-shell::before { 
    display: none !important; 
}

/* Active Striped Diversion Hover Tooltip Styling */
.leaflet-tooltip.diversion-tooltip-shell {
    background: #071133 !important;
    border: 1px solid #0f172a !important;
    color: #ffffff !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    max-width: 320px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}
.leaflet-tooltip.diversion-tooltip-shell::before { 
    display: none !important; 
}

/* Legacy Bridge & Inline Component Fallbacks */
.bridge-sign-icon { 
    background: #ffffff; 
    border: 4px solid #c8102e; 
    border-radius: 50%; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    font-weight: 900; 
    color: #000000; 
    line-height: 1.1; 
    text-align: center; 
    box-shadow: 0 3px 6px rgba(0,0,0,0.3); 
}
.bridge-text { font-size: 9px; letter-spacing: -0.4px; }
.bridge-arrows { font-size: 7px; margin: -2px 0; }
.map-popup-photo { width: 100%; max-height: 110px; object-fit: cover; border-radius: 6px; margin-top: 6px; border: 1px solid #cbd5e1; }
.landmark-badge { display: inline-block; font-size: 9px; font-weight: 800; color: #ffffff; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; margin-bottom: 4px; }

/* Custom Overrides for Leaflet Core Controls */
.leaflet-control-layers-expanded { 
    font-family: 'Segoe UI', sans-serif !important; 
    border-radius: 8px !important; 
    border: 1px solid #cbd5e1 !important; 
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1) !important; 
    padding: 10px 14px !important; 
    color: #1e293b !important; 
    font-weight: 600 !important; 
    font-size: 12px !important; 
}
.leaflet-control-layers-group-name { 
    font-weight: 800; 
    color: #3c1053; 
    font-size: 10px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    border-bottom: 1px dashed #cbd5e1; 
    margin-bottom: 6px; 
    padding-bottom: 2px; 
}