/* [Original CSS content remains unchanged until line 699] */

/* ========================================
   MODERN BOOTSTRAP STYLES
   ======================================== */

/* Consolidated CSS Variables */
:root {
	--primary-color: #005f7f;
	--secondary-color: #007fa0;
	--success-color: #198754;
	--info-color: #0dcaf0;
	--warning-color: #ffc107;
	--danger-color: #dc3545;
	--light-color: #f8f9fa;
	--dark-color: #212529;
	--theme-primary: #1e3a8a;
	--theme-secondary: #3b82f6;
	--theme-accent: #60a5fa;
	--theme-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	--card-border-radius: 16px;
	--transition-speed: 0.3s;
	--search-primary: #2c3e50;
	--search-secondary: #3498db;
	--search-danger: #e74c3c;
	--search-danger-dark: #750d02;
	--search-success: #27ae60;
	--search-dark-bg: #34495e;
	--search-light-bg: #ecf0f1;
	--success-gradient: linear-gradient(135deg, #23a6d5 0%, #23d5ab 100%);
	--info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
	--warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
	--danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
	--dark-gradient: linear-gradient(135deg, #2D3436 0%, #000000 100%);
	--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Global Font */
* {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	box-sizing: border-box;
}

/* Lock base font size so jQuery UI .ui-widget cannot cascade into layout.
   jQuery UI sets: body .ui-widget { font-size: .875em }
   which shrinks sidebar/menu fonts on pages that load jQuery UI CSS.
   Setting explicit px on html+body breaks the em inheritance chain. */
html, body {
	font-size: 16px !important;
}

/* Explicitly protect sidebar and header from any external font-size override */
.sidebar-wrapper,
.sidebar-menu-container,
.sidebar-navigation,
.sidebar-navigation .nav-link,
.main-header,
.header-title,
.header-container {
	font-size: revert;
}

.sidebar-navigation .nav-link {
	font-size: 0.85rem !important;
}

/* Scope jQuery UI font rules to only its own widgets,
   preventing bleed into layout elements */
.ui-widget {
	font-size: 0.875rem !important;
}

body .ui-widget {
	font-size: 0.875rem !important;
}

/* ========================================
   HEADER
   ======================================== */
.header-container {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: var(--theme-gradient);
	z-index: 1001;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-banner {
	text-align: center;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-banner img {
	max-height: 50px;
	width: auto;
}

.main-header {
	color: white;
	padding: 1rem 0;
}

.header-logo {
	max-height: 50px;
	width: auto;
}

.header-title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 300;
}

.header-left {
	text-align: center;
}

.last-updated .time {
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.2;
}

.hidden-context {
	display: none !important;
	position: absolute !important;
	left: -9999px !important;
}

/* ========================================
   PAGE LAYOUT - SIDEBAR + MAIN CONTENT
   ======================================== */
.page-wrapper {
	margin-top: 140px;
	min-height: calc(100vh - 140px);
	display: flex !important;
	align-items: flex-start !important;
	width: 100% !important;
	gap: 0 !important;
	overflow-x: hidden !important;
}

.sidebar-wrapper {
    width: 210px !important;
    min-width: 210px !important;
    max-width: 210px !important;
    flex-shrink: 0 !important;
    background: var(--theme-gradient);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.1);
    position: fixed !important;
    top: 140px;
    bottom: 0;
    left: 0;
    overflow: hidden;   /* ← back to hidden */
    z-index: 100;
}

.sidebar-menu-container {
    width: 100%;
    height: 100%;
    display: block;
    overflow-y: auto;
    padding: 0;
    padding-top: 3.5rem;   /* ← add this */
}

#sidebar > *:not(.sidebar-menu-container) {
	display: none !important;
}

.main-content {
	margin-left: 210px !important;
	width: calc(100% - 210px) !important;
	max-width: calc(100% - 210px) !important;
	flex: 1 1 auto !important;
	padding: 0 !important;
	overflow-x: auto !important;
	background-color: transparent;
}

.content-wrapper {
	padding: 0.5rem 0.75rem !important;
	margin: 0 !important;
	width: 100% !important;
}

.mainContent {
	padding: 0 !important;
	margin: 0 !important;
	width: 100% !important;
}

#bodycontent {
	padding: 0 !important;
	margin: 0 !important;
	width: 100% !important;
}

.container-fluid {
	padding-left: 0.75rem !important;
	padding-right: 0.75rem !important;
	width: 100% !important;
	max-width: 100% !important;
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */
.sidebar-navigation {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
	padding: 0;
	box-shadow: none;
	width: 100%;
	min-height: 100%;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sidebar-navigation .nav {
	padding: 0;
}

.sidebar-navigation .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.75rem 1rem !important;   /* ← slightly more padding too */
    margin: 0;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 1rem !important;         /* ← was 0.85rem, now 1rem */
    font-family: inherit !important;
}

.sidebar-navigation .nav-link:hover {
	background-color: rgba(255, 255, 255, 0.1);
	color: #fff !important;
	padding-left: 1.25rem !important;
	border-left-color: #ffc107;
}

.sidebar-navigation .nav-link.active {
	background-color: rgba(255, 255, 255, 0.2) !important;
	color: white !important;
	border-left-color: #ffc107 !important;
}

.sidebar-navigation .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.9);
    margin-right: 0.5rem;  /* add this — backup for me-2 */
}

.sidebar-navigation .nav-link span {
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-modern {
	border-radius: 25px;
	padding: 0.5rem 1.5rem;
	font-weight: 500;
	transition: all var(--transition-speed) ease;
	border: none;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	background-color: white;
	color: #667eea;
}

.btn-modern:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	background-color: #f8f9fa;
	color: #764ba2;
}

/* ========================================
   MODAL
   ======================================== */
.modal-content {
	border-radius: 15px;
	border: none;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-header {
	border-bottom: 1px solid #e9ecef;
	background-color: #f8f9fa;
	border-radius: 15px 15px 0 0;
}

.modal-dialog {
	margin: 1.75rem auto;
	max-width: 100vw;
}

.modal-dialog.modal-xl {
	max-width: 70vw;
}

.modal-dialog-centered {
	display: flex;
	align-items: center;
	min-height: calc(100vh - 5.5rem);
}

/* ========================================
   FORMS
   ======================================== */
.form-control {
	border-radius: 8px;
	border: 1px solid #ced4da;
	padding: 0.75rem 1rem;
	transition: all var(--transition-speed) ease;
}

.form-control:focus {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 0.2rem rgba(0, 95, 127, 0.25);
}

.form-control-modern {
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	padding: 0.5rem 0.75rem;
	transition: all 0.3s ease;
	background-color: #f8f9fa;
	font-size: 0.813rem;
}

.form-control-modern:focus {
	border-color: var(--search-secondary);
	box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
	background-color: white;
}

.form-select-modern {
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	padding: 0.5rem 0.75rem;
	transition: all 0.3s ease;
	background-color: #f8f9fa;
	font-size: 0.813rem;
}

.form-select-modern:focus {
	border-color: var(--search-secondary);
	box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
	background-color: white;
}

/* ========================================
   PASSWORD STRENGTH
   ======================================== */
.spinner-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	display: none;
	justify-content: center;
	align-items: center;
	z-index: 9999;
}

.password-strength {
	height: 5px;
	margin-top: 5px;
	border-radius: 3px;
	transition: all var(--transition-speed) ease;
}

.strength-weak { background-color: var(--danger-color); width: 33%; }
.strength-medium { background-color: var(--warning-color); width: 66%; }
.strength-strong { background-color: var(--success-color); width: 100%; }

/* ========================================
   STAT CARDS (DASHBOARD)
   ======================================== */
.stat-card {
	background: white;
	border-radius: var(--card-border-radius);
	padding: 1.5rem;
	height: 100%;
	transition: all var(--transition-speed) ease;
	border: 1px solid rgba(0, 0, 0, 0.05);
	position: relative;
	overflow: hidden;
}

.stat-card::before {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 4px;
	background: var(--theme-gradient);
	transform: scaleX(0);
	transition: transform var(--transition-speed) ease;
}

.stat-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.stat-card:hover::before { transform: scaleX(1); }

.stat-icon {
	width: 48px;
	height: 48px;
	background: var(--theme-gradient);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	color: white;
	margin-bottom: 1rem;
}

.stat-value {
	font-size: 2.25rem;
	font-weight: 700;
	color: var(--theme-primary);
	line-height: 1;
	margin-bottom: 0.5rem;
}

.stat-label {
	font-size: 0.875rem;
	color: #6c757d;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.stat-change { font-size: 0.875rem; font-weight: 500; margin-top: 0.5rem; }
.stat-change.positive { color: var(--success-color); }
.stat-change.negative { color: var(--danger-color); }

/* ========================================
   CHART CARDS (DASHBOARD)
   ======================================== */
.chart-card {
	background: white;
	border-radius: var(--card-border-radius);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	transition: all var(--transition-speed) ease;
	height: 100%;
	border: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-card:hover { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); }

.chart-header {
	padding: 1.5rem;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.chart-title {
	font-size: 1.125rem;
	font-weight: 600;
	color: #1a202c;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.chart-title i { color: var(--theme-secondary); }

.chart-actions { display: flex; gap: 0.5rem; }

.chart-action-btn {
	background: transparent;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 0.375rem 0.75rem;
	font-size: 0.875rem;
	color: #6c757d;
	transition: all var(--transition-speed) ease;
	cursor: pointer;
}

.chart-action-btn:hover {
	background: var(--light-color);
	color: var(--theme-primary);
	border-color: var(--theme-primary);
}

.chart-body {
	padding: 1.5rem;
	min-height: 350px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ========================================
   SEARCH PAGE
   ======================================== */
.search-page { min-height: 100vh; }

.search-section {
	display: block !important;
	text-align: left !important;
	background: white;
	border-radius: 10px;
	padding: 0.75rem 1rem !important;
	margin: 0 0 0.75rem 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
	box-sizing: border-box !important;
}

.search-section .row {
	display: flex !important;
	flex-wrap: nowrap !important;
	justify-content: flex-start !important;
	align-items: flex-end !important;
	margin: 0 !important;
	width: 100% !important;
	gap: 0.5rem !important;
}

.search-section .col-md-3 {
	flex: 0 0 400px !important;
	width: 400px !important;
	padding: 0 !important;
}

.search-section .col-md-6 {
	flex: 1 1 auto !important;
	width: auto !important;
	padding: 0 !important;
}

.search-section .form-control,
.search-section .form-select {
	width: 100% !important;
	max-width: 100% !important;
	height: 38px !important;
}

.search-section .btn-group {
	display: flex !important;
	flex-wrap: nowrap !important;
	gap: 0.4rem !important;
	align-items: center !important;
	padding-top: 1.5rem !important;
	justify-content: flex-start !important;
}

.search-section .btn {
	min-width: 80px !important;
	height: 38px !important;
	font-size: 0.75rem !important;
	padding: 0.35rem 0.6rem !important;
	white-space: nowrap !important;
}

.btn-search {
	border-radius: 8px;
	padding: 0.375rem 1rem;
	font-weight: 500;
	transition: all 0.3s ease;
	border: none;
	text-transform: uppercase;
	font-size: 0.75rem;
	letter-spacing: 0.5px;
}

.btn-primary-modern { background-color: var(--search-secondary); color: white; }
.btn-primary-modern:hover { background-color: #2980b9; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(52,152,219,0.3); }

.btn-danger-modern { background-color: var(--search-danger); color: white; }
.btn-danger-modern:hover { background-color: #c0392b; transform: translateY(-2px); }

.btn-danger-dark { background-color: var(--search-danger-dark); color: white; }
.btn-danger-dark:hover { background-color: #c0392b; transform: translateY(-2px); }

.btn-secondary-modern { background-color: #95a5a6; color: white; }
.btn-secondary-modern:hover { background-color: #7f8c8d; transform: translateY(-2px); }

/* ========================================
   TABLE — EXCEL STYLE
   ======================================== */

/* Outer wrapper */
.table-container {
	background: white;
	border-radius: 6px;
	padding: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
	width: 100% !important;
	margin: 0 !important;
	overflow-x: auto !important;
	border: 1px solid #b0b0b0;
}

/* DataTables wrapper inside container */
.table-container .dataTables_wrapper {
	padding: 0 !important;
	margin: 0 !important;
}

/* DataTables info + pagination bar */
.table-container .dataTables_info,
.table-container .dataTables_paginate {
	padding: 0.4rem 0.75rem !important;
	font-size: 0.72rem !important;
	color: #444 !important;
}

/* Hide DataTables search (we use our own) */
.dataTables_filter { display: none; }

/* Show entries selector */
.dataTables_length label {
	font-size: 0.72rem !important;
	color: #444 !important;
}

.dataTables_length select {
	font-size: 0.72rem !important;
	padding: 0.15rem 0.4rem !important;
	border: 1px solid #bbb !important;
	border-radius: 3px !important;
}

/* The table itself */
#searchtab {
	min-width: 1100px !important;
	width: 100% !important;
	border-collapse: collapse !important;
	border-spacing: 0 !important;
	font-size: 0.72rem !important;
	font-family: 'Calibri', 'Segoe UI', Arial, sans-serif !important;
}

/* All cells — Excel-style thin borders */
#searchtab th,
#searchtab td {
	border: 1px solid #d0d0d0 !important;
	padding: 4px 7px !important;
	vertical-align: middle !important;
	white-space: nowrap !important;
	max-width: 200px !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
}

/* Header row — Excel green-grey style */
#searchtab thead tr th {
	background: linear-gradient(180deg, #217346 0%, #1a5c38 100%) !important;
	color: #ffffff !important;
	font-weight: 600 !important;
	font-size: 0.70rem !important;
	text-transform: uppercase !important;
	letter-spacing: 0.4px !important;
	text-align: center !important;
	border: 1px solid #155a30 !important;
	padding: 6px 7px !important;
	position: sticky !important;
	top: 0 !important;
	z-index: 2 !important;
	user-select: none !important;
}

/* Header sort arrows */
#searchtab thead th.sorting:after,
#searchtab thead th.sorting_asc:after,
#searchtab thead th.sorting_desc:after {
	color: rgba(255,255,255,0.7) !important;
}

/* DataTables odd/even — Excel alternating rows */
#searchtab tbody tr:nth-child(odd) td {
	background-color: #ffffff !important;
}

#searchtab tbody tr:nth-child(even) td {
	background-color: #EEF5EE !important;
}

/* Hover — Excel blue highlight */
#searchtab tbody tr:hover td {
	background-color: #cce5ff !important;
	cursor: pointer;
}

/* Selected row */
#searchtab tbody tr.selected td {
	background-color: #b8d4f0 !important;
}

/* Row number column (S.No) */
#searchtab tbody td:nth-child(2) {
	text-align: center !important;
	color: #555 !important;
	background-color: #f5f5f5 !important;
	font-weight: 500 !important;
	border-right: 2px solid #c0c0c0 !important;
}

/* Checkbox column */
#searchtab tbody td:nth-child(1),
#searchtab thead th:nth-child(1) {
	text-align: center !important;
	width: 30px !important;
	min-width: 30px !important;
	max-width: 30px !important;
	background-color: #f0f0f0 !important;
}

/* Links inside table */
#searchtab tbody td a {
	color: #0563c1 !important;
	text-decoration: underline !important;
	text-decoration-color: transparent !important;
	transition: text-decoration-color 0.2s;
}

#searchtab tbody td a:hover {
	text-decoration-color: #0563c1 !important;
	color: #003d8a !important;
}

/* Freeze first data columns visual hint */
#searchtab tbody td:nth-child(3) {
	font-weight: 600 !important;
	color: #1a3c5e !important;
}

/* DataTables pagination buttons — Excel-ish */
.dataTables_paginate .paginate_button {
	padding: 2px 8px !important;
	font-size: 0.72rem !important;
	border: 1px solid #bbb !important;
	border-radius: 3px !important;
	margin: 0 1px !important;
	background: #f5f5f5 !important;
	color: #333 !important;
	cursor: pointer !important;
}

.dataTables_paginate .paginate_button:hover {
	background: #ddeedd !important;
	border-color: #217346 !important;
	color: #155a30 !important;
}

.dataTables_paginate .paginate_button.current {
	background: #217346 !important;
	color: white !important;
	border-color: #155a30 !important;
	font-weight: 600 !important;
}

.dataTables_paginate .paginate_button.disabled {
	color: #aaa !important;
	cursor: default !important;
}

/* Status badges inside table */
.status-badge {
	padding: 0.15rem 0.5rem;
	border-radius: 3px;
	font-size: 0.68rem;
	font-weight: 600;
	display: inline-block;
}

.status-active  { background-color: #e2efda; color: #375623; border: 1px solid #c6e0b4; }
.status-inactive { background-color: #fce4ec; color: #880e4f; border: 1px solid #f48fb1; }

/* ========================================
   JQUERY UI DIALOG
   ======================================== */
.ui-dialog {
	border-radius: 12px !important;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
}

.ui-dialog-titlebar {
	background-color: #f8f9fa !important;
	border-bottom: 1px solid #e0e0e0 !important;
	border-radius: 12px 12px 0 0 !important;
}

.ui-dialog-content { padding: 1.5rem !important; }

/* ========================================
   LOADING / SPINNERS
   ======================================== */
.div-img-spinner1 {
	width: 220px; height: 220px;
	background-color: #ffffff;
	position: absolute;
	top: 50%; left: 50%;
	margin-left: -110px; margin-top: -110px;
	text-align: center;
}

.loading-spinner {
	width: 60px; height: 60px;
	border: 5px solid #f3f3f3;
	border-top: 5px solid var(--search-secondary);
	border-radius: 50%;
	animation: spin 1s linear infinite;
	display: inline-block;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

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

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

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

@keyframes pulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.05); }
	100% { transform: scale(1); }
}

@keyframes slideInRight {
	from { transform: translateX(100%); opacity: 0; }
	to { transform: translateX(0); opacity: 1; }
}

@keyframes slideDown {
	from { opacity: 0; transform: translateY(-10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   UTILITY
   ======================================== */
.skeleton-loader {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: loading 1.5s infinite;
	border-radius: 8px;
	height: 20px;
	margin: 10px 0;
}

.animate-in { animation: fadeInUp 0.6s ease-out; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ========================================
   UPDATE DATA PAGE
   ======================================== */
.management-card {
	transition: all var(--transition-speed) ease;
	border: none;
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	height: 100%;
}

.management-card:hover {
	transform: translateY(-8px);
	box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.data-update-icon { background: linear-gradient(135deg, #005f7f 0%, #0099cc 100%); }
.firmware-icon { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); }
.monitoring-icon { background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%); }
.reports-icon { background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%); }

.file-upload-area, .firmware-upload-area {
	border: 2px dashed #005f7f;
	border-radius: 12px;
	background: #f8fafb;
	padding: 2rem;
	text-align: center;
	transition: all var(--transition-speed) ease;
	cursor: pointer;
}

.firmware-upload-area { padding: 1rem; }

.file-upload-area:hover, .firmware-upload-area:hover {
	background: #005f7f;
	color: white;
}

.file-upload-area i, .firmware-upload-area i {
	font-size: 2rem;
	margin-bottom: 1rem;
	color: #005f7f;
}

.firmware-upload-area i { font-size: 1.5rem; margin-bottom: 0.5rem; }
.file-upload-area:hover i, .firmware-upload-area:hover i { color: white; }
.file-input { display: none; }

.btn-primary-custom {
	background: linear-gradient(135deg, #005f7f 0%, #0099cc 100%);
	border: none;
	border-radius: 50px;
	padding: 0.75rem 2rem;
	font-weight: 600;
	transition: all var(--transition-speed) ease;
}

.btn-primary-custom:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 95, 127, 0.4);
}

.format-table { border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.format-table thead { background: #005f7f; }
.format-table th { color: white; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.8rem; }

.update-options-section {
	background: #f8fafb;
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1.5rem;
	display: none;
}

.update-options-section.show { display: block; animation: fadeInUp 0.5s ease; }

.deployment-ready { border-left: 4px solid #28a745 !important; }
.deployment-not-ready { border-left: 4px solid #ffc107 !important; }

.deployment-section {
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1.5rem;
	border: 2px dashed #28a745;
	transition: all var(--transition-speed) ease;
}

.deployment-modal .modal-header {
	background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
	color: white;
	padding: 1.5rem;
}

.deployment-option-card {
	border: 2px solid #e9ecef;
	border-radius: 12px;
	padding: 1.5rem;
	margin-bottom: 1rem;
	cursor: pointer;
	transition: all var(--transition-speed) ease;
	position: relative;
	overflow: hidden;
	background: white;
}

.deployment-option-card:hover {
	border-color: #28a745;
	transform: translateY(-2px);
	box-shadow: 0 5px 15px rgba(40, 167, 69, 0.2);
}

.deployment-option-card.selected {
	border-color: #28a745;
	background: linear-gradient(135deg, rgba(40,167,69,0.05) 0%, rgba(32,201,151,0.05) 100%);
}

.deployment-option-card.selected::before {
	content: '✓';
	position: absolute;
	top: 10px; right: 10px;
	background: #28a745;
	color: white;
	width: 25px; height: 25px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 14px;
}

.schedule-icon {
	width: 50px; height: 50px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	margin-bottom: 1rem;
}

.schedule-immediate { background: rgba(220,53,69,0.1); color: #dc3545; }
.schedule-scheduled { background: rgba(255,193,7,0.1); color: #ffc107; }
.schedule-maintenance { background: rgba(23,162,184,0.1); color: #17a2b8; }

.deployment-details-panel {
	background: #f8f9fa;
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1rem;
	display: none;
	animation: slideDown 0.3s ease;
}

.deployment-details-panel.show { display: block; }

.deployment-summary-card {
	background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
	border: 1px solid #ffc107;
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1.5rem;
}

.deployment-progress { display: none; text-align: center; padding: 2rem; }
.deployment-progress.show { display: block; }

.progress-spinner {
	width: 60px; height: 60px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #28a745;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto 1rem;
}

.status-indicator { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.status-immediate { background-color: #dc3545; }
.status-scheduled { background-color: #ffc107; }
.status-maintenance { background-color: #17a2b8; }
.badge-immediate { background: #dc3545; color: white; }
.badge-scheduled { background: #ffc107; color: #000; }
.badge-maintenance { background: #17a2b8; color: white; }

.firmware-notification {
	position: fixed; top: 20px; right: 20px; z-index: 9999;
	min-width: 300px; max-width: 500px;
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
	animation: slideInRight 0.3s ease;
}

.deployment-status {
	position: fixed; top: 80px; right: 20px; z-index: 9999;
	min-width: 450px; max-width: 600px;
	border-left: 5px solid #28a745;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#firmwareTable tbody tr, #processTable tbody tr { transition: background-color 0.2s ease; }
#firmwareTable tbody tr:hover { background-color: rgba(40,167,69,0.05); }
#firmwareTable tbody tr.selected, .firmware-row.selected { background-color: rgba(40,167,69,0.1) !important; }
#processTable tbody tr:hover { background-color: rgba(0,123,255,0.05); }
.firmware-checkbox { cursor: pointer; }

.temp-indicator { width: 20px; height: 20px; border-radius: 50%; display: inline-block; background: #28a745; }
.temp-indicator.warning { background: #ffc107; }
.temp-indicator.danger { background: #dc3545; }

.metric-item { padding: 0.5rem 0; border-bottom: 1px solid #e9ecef; }
.metric-item:last-child { border-bottom: none; }

.coming-soon-badge {
	position: absolute; top: 10px; right: 10px;
	background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
	color: white; padding: 0.25rem 0.5rem;
	border-radius: 20px; font-size: 0.7rem; font-weight: 600;
}

.time-display { background: white; border: 1px solid #dee2e6; border-radius: 8px; padding: 1rem; margin-top: 1rem; }
.time-picker-group { background: white; border: 1px solid #dee2e6; border-radius: 8px; padding: 1rem; }
.time-zone-display { background: #e9ecef; border-radius: 6px; padding: 0.5rem 1rem; font-family: 'Courier New', monospace; font-size: 0.9rem; }
.time-zone-info { font-size: 0.8rem; color: #6c757d; }
.deployment-preview { background: #fff3cd; border: 1px solid #ffeeba; border-radius: 8px; padding: 1rem; margin-top: 1rem; }

.schedule-option {
	border: 2px solid #e9ecef; border-radius: 8px;
	padding: 1rem; margin-bottom: 0.5rem;
	cursor: pointer; transition: all var(--transition-speed) ease;
}

.schedule-option:hover { border-color: #28a745; background-color: #f8f9fa; }
.schedule-option.selected { border-color: #28a745; background-color: #d4edda; }

.schedule-details {
	background: #fff; border-radius: 8px; padding: 1rem;
	margin-top: 1rem; border: 1px solid #dee2e6; display: none;
}

.schedule-details.show { display: block; animation: slideDown 0.3s ease; }
.status-message { border-radius: 8px; padding: 0.75rem; margin: 1rem 0; }

.deployment-option-card:focus, .schedule-option:focus { outline: 2px solid #28a745; outline-offset: 2px; }

/* ========================================
   USER MANAGEMENT PAGE
   ======================================== */
.user-management-container {
	margin-top: 30px;
	background: white;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	width: 100%;
	border: none !important;
}

.user-management-header {
	background: var(--theme-gradient);
	color: white;
	padding: 10px 25px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 15px;
}

.user-management-header h2 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.3px; flex: 1; }

.header-actions { display: flex; gap: 10px; align-items: center; }

.add-user-btn, .search-user-btn, .clear-user-btn, .export-excel-btn {
	background: rgba(255, 255, 255, 0.15);
	color: white;
	border: 2px solid rgba(255, 255, 255, 0.3);
	padding: 8px 14px; border-radius: 6px;
	font-size: 12px; font-weight: 600;
	cursor: pointer;
	transition: all var(--transition-speed) ease;
	display: flex; align-items: center; gap: 6px;
	text-decoration: none;
	backdrop-filter: blur(10px);
}

.add-user-btn:hover, .search-user-btn:hover, .clear-user-btn:hover {
	background: rgba(255,255,255,1);
	border-color: rgba(255,255,255,0.8);
	transform: translateY(-1px);
	box-shadow: 0 4px 15px rgba(0,0,0,0.15);
	color: #004a66;
	text-decoration: none;
}

.export-excel-btn:hover {
	background: rgba(255,255,255,0.25);
	border-color: rgba(255,255,255,0.5);
	transform: translateY(-1px);
	box-shadow: 0 4px 15px rgba(0,0,0,0.15);
	color: white; text-decoration: none;
}

.add-user-btn:active, .export-excel-btn:active { transform: translateY(0); }
.export-excel-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.add-user-icon, .export-icon { width: 14px; height: 14px; }

.user-count-badge {
	background: rgba(255,255,255,0.2); color: white;
	padding: 4px 10px; border-radius: 15px;
	font-size: 11px; font-weight: 500;
	border: 1px solid rgba(255,255,255,0.3);
}

.user-management-content { padding: 20px; }
.users-table-wrapper { overflow-x: auto; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.users-table {
	width: 100%; border-collapse: collapse;
	background: white;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.users-table thead { background: var(--theme-gradient); color: white; }

.users-table th {
	padding: 10px 12px; text-align: center;
	font-weight: 600; font-size: 12px;
	letter-spacing: 0.3px; border: none;
	white-space: nowrap; height: 35px;
}

.users-table tbody tr {
	transition: all 0.2s ease;
	border-bottom: 1px solid #e5e7eb;
	height: 45px;
	animation: fadeInUp 0.3s ease forwards;
}

.users-table tbody tr:hover { background: #f8fafc; transform: translateY(-1px); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.users-table tbody tr:last-child { border-bottom: none; }

.users-table td {
	padding: 8px 12px; text-align: center;
	font-size: 12px; color: #374151;
	border: none; vertical-align: middle; height: 45px;
}

.username-cell { font-weight: 600; }

.username-link {
	color: #005f7f; text-decoration: none;
	font-weight: 600; padding: 4px 8px;
	border-radius: 4px; transition: all 0.2s ease;
	display: inline-block; font-size: 12px;
}

.username-link:hover { background: #005f7f; color: white; text-decoration: none; transform: translateY(-1px); }

.codename-cell {
	max-width: 250px; word-wrap: break-word;
	overflow-wrap: break-word; white-space: pre-line;
	font-size: 11px; line-height: 1.3;
}

.role-badge {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 3px 8px; border-radius: 12px;
	font-size: 10px; font-weight: 600;
	text-transform: uppercase; letter-spacing: 0.3px; min-height: 20px;
}

.role-admin { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: white; }
.role-user { background: linear-gradient(135deg, #059669 0%, #047857 100%); color: white; }

.role-icon {
	width: 12px; height: 12px; border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex; align-items: center; justify-content: center; font-size: 8px;
}

.action-buttons { display: flex; gap: 8px; align-items: center; }

.action-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 32px; height: 32px; border-radius: 4px;
	text-decoration: none; transition: all 0.2s ease; position: relative;
}

.action-btn svg { width: 16px; height: 16px; stroke: currentColor; }
.edit-btn { background-color: #f0f0f0; color: #333; }
.edit-btn:hover { background-color: #e0e0e0; color: #000; }
.delete-btn { background-color: #fee; color: #d32f2f; }
.delete-btn:hover { background-color: #fdd; color: #c62828; }

.no-users-message {
	text-align: center; padding: 40px 20px;
	color: #6b7280; font-size: 16px;
	background: #f9fafb; border-radius: 6px;
	border: 2px dashed #d1d5db;
}

.no-users-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

.access-badge {
	background: #e0f2fe; color: #0369a1;
	padding: 3px 6px; border-radius: 8px;
	font-size: 10px; font-weight: 500;
	display: inline-block; min-height: 18px; line-height: 1.2;
}

.users-table .status-badge {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 3px 8px; border-radius: 12px;
	font-size: 10px; font-weight: 600;
	text-transform: uppercase; letter-spacing: 0.3px; min-height: 20px;
}

.status-online { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }
.status-offline { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); color: white; }
.status-icon { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: rgba(255,255,255,0.8); }
.online-pulse { animation: pulse 2s infinite; background: rgba(255,255,255,1); }

.export-success-notification {
	position: fixed; top: 20px; right: 20px;
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
	color: white; padding: 12px 16px; border-radius: 6px;
	box-shadow: 0 4px 16px rgba(16,185,129,0.25);
	z-index: 1000; animation: slideInRight 0.5s ease-out;
	max-width: 300px; display: flex; align-items: center; gap: 10px; font-size: 13px;
}

.export-success-notification .success-icon {
	width: 20px; height: 20px;
	background: rgba(255,255,255,0.2); border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: bold; font-size: 12px;
}

/* Tooltip */
.tooltip { position: relative; }

.tooltip::after {
	content: attr(data-tooltip);
	position: absolute; bottom: 100%; left: 50%;
	transform: translateX(-50%);
	background: #374151; color: white;
	padding: 6px 10px; border-radius: 4px;
	font-size: 11px; white-space: nowrap;
	opacity: 0; visibility: hidden;
	transition: all 0.2s ease; z-index: 1000;
}

.tooltip:hover::after {
	opacity: 1; visibility: visible;
	transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   REPORT PAGE
   ======================================== */
.dashboard-container { padding: 2rem; animation: fadeIn 0.5s ease-in-out; }

.page-header {
	background: white; border-radius: 15px;
	padding: 2rem; margin-bottom: 2rem;
	box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.page-header h1 { color: var(--search-primary); font-weight: 700; margin: 0; }
.page-header p { color: #7f8c8d; margin: 0.5rem 0 0 0; }
.report-section { margin-bottom: 3rem; }

.section-title {
	color: var(--search-primary); font-size: 1.5rem; font-weight: 600;
	margin-bottom: 1.5rem; padding-left: 0.5rem;
	border-left: 4px solid #667eea;
}

.report-card {
	background: white; border-radius: 15px; overflow: hidden;
	transition: all var(--transition-speed) ease;
	box-shadow: 0 5px 15px rgba(0,0,0,0.08);
	height: 100%; cursor: pointer; position: relative;
}

.report-card:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }

.report-card::before {
	content: ''; position: absolute; top: 0; left: 0; right: 0;
	height: 5px; background: var(--theme-gradient);
}

.report-card.optical::before { background: var(--success-gradient); }
.report-card .card-body { padding: 1.5rem; }
.report-card h5 { color: var(--search-primary); font-weight: 600; margin-bottom: 0.5rem; }
.report-card p { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 1rem; }

.card-icon {
	width: 60px; height: 60px; border-radius: 12px;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.5rem; color: white; margin-bottom: 1rem;
}

.card-icon.cpe { background: var(--theme-gradient); }
.card-icon.optical { background: var(--success-gradient); }
.card-icon.time-24 { background: var(--info-gradient); }
.card-icon.time-30 { background: var(--warning-gradient); }

.stats-row { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid #ecf0f1; }
.stat-item { text-align: center; }
.report-card .stat-value { font-size: 1.25rem; font-weight: 700; color: var(--search-primary); }
.report-card .stat-label { font-size: 0.75rem; color: #95a5a6; text-transform: uppercase; }

.action-button {
	background: var(--theme-gradient); color: white; border: none;
	padding: 0.5rem 1.5rem; border-radius: 25px;
	font-size: 0.9rem; font-weight: 500;
	transition: all var(--transition-speed) ease;
	text-decoration: none; display: inline-block; cursor: pointer;
}

.action-button:hover { transform: scale(1.05); box-shadow: 0 5px 15px rgba(102,126,234,0.4); color: white; text-decoration: none; }

.badge-new {
	position: absolute; top: 1rem; right: 1rem;
	background: var(--danger-gradient); color: white;
	padding: 0.25rem 0.75rem; border-radius: 20px;
	font-size: 0.75rem; font-weight: 600;
	animation: pulse 2s infinite;
}

.export-button {
	background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
	color: white; border: none; padding: 0.5rem 1rem;
	border-radius: 25px; font-weight: 500; font-size: 0.9rem;
	display: inline-flex; align-items: center; gap: 0.5rem;
	cursor: pointer; transition: all var(--transition-speed) ease; text-decoration: none;
}

.export-button:hover { transform: scale(1.05); box-shadow: 0 5px 15px rgba(32,201,151,0.4); color: white; text-decoration: none; }
.export-icon { width: 16px; height: 16px; }

.loading-overlay {
	display: none; position: fixed; top: 0; left: 0;
	width: 100%; height: 100%;
	background: rgba(0,0,0,0.5); z-index: 9999;
	justify-content: center; align-items: center;
}

.loading-overlay .spinner-border { width: 3rem; height: 3rem; border-width: 0.3rem; }

/* ========================================
   DARK MODE
   ======================================== */
@media (prefers-color-scheme: dark) {
	body { background-color: #0f172a; color: #e2e8f0; }
	.stat-card, .chart-card { background: #1e293b; border-color: #334155; }
	.chart-header { border-color: #334155; }
	.chart-title { color: #e2e8f0; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
	.sidebar-wrapper {
		width: 200px !important;
		min-width: 200px !important;
		max-width: 200px !important;
	}
	.main-content {
		margin-left: 200px !important;
		width: calc(100% - 200px) !important;
		max-width: calc(100% - 200px) !important;
	}
	.header-title { font-size: 1.2rem; }
	.search-section .row { flex-wrap: wrap !important; }
	.search-section .col-md-3 { flex: 0 0 100% !important; width: 100% !important; }
	.deployment-option-card { margin-bottom: 0.5rem; padding: 1rem; }
	.modal-dialog.modal-xl { max-width: 95%; margin: 0.5rem; }
	.user-management-container { margin: 15px 8px; width: calc(100% - 16px); }
	.user-management-header { flex-direction: column; text-align: center; gap: 12px; padding: 15px 20px; }
	.user-management-header h2 { font-size: 20px; }
	.header-actions { justify-content: center; flex-wrap: wrap; }
	.add-user-btn, .export-excel-btn { padding: 6px 12px; font-size: 11px; }
	.user-management-content { padding: 15px; }
	.users-table th, .users-table td { padding: 6px 8px; font-size: 11px; }
	.codename-cell { max-width: 100px; font-size: 10px; }
	.action-buttons { flex-direction: column; gap: 3px; }
	.action-btn { width: 24px; height: 24px; }
	.export-success-notification { top: 10px; right: 10px; left: 10px; max-width: none; font-size: 12px; }
}

@media (max-width: 576px) {
	.sidebar-wrapper { display: none !important; }
	.main-content {
		margin-left: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
	}
}