* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: #f0f2f5; color: #1a1a2e; }
a { text-decoration: none; color: inherit; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.auth-card { background: #fff; border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo img { height: 60px; object-fit: contain; }
.auth-logo h1 { font-size: 24px; font-weight: 700; color: #1a1a2e; margin-top: 12px; }
.auth-logo p { color: #666; font-size: 14px; margin-top: 4px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }
.form-group input { width: 100%; padding: 12px 16px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: #0f3460; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: #0f3460; color: #fff; width: 100%; }
.btn-primary:hover { background: #16213e; }
.btn-success { background: #22c55e; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-secondary { background: #f1f5f9; color: #444; border: 1px solid #e0e0e0; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.error-msg { background: #fee2e2; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: none; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1a1a2e; color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo img { height: 40px; object-fit: contain; }
.sidebar-logo span { display: block; font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; transition: background 0.2s; font-size: 14px; color: rgba(255,255,255,0.7); border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(15,52,96,0.6); color: #fff; border-left-color: #4fc3f7; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-avatar { width: 36px; height: 36px; background: #0f3460; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.logout-btn { margin-top: 12px; width: 100%; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); border: none; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.main { margin-left: 240px; flex: 1; }
.topbar { background: #fff; padding: 16px 32px; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; }
.topbar h2 { font-size: 20px; font-weight: 700; flex: 1; }
.content { padding: 32px; }
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }
.tracker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.tracker-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border-top: 4px solid #22c55e; }
.tracker-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.tracker-card.offline { border-top-color: #ef4444; }
.tracker-card.manual { border-top-color: #f59e0b; }
.tracker-card.wind { border-top-color: #f59e0b; }
.tracker-card.night { border-top-color: #6366f1; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-imei { font-size: 11px; color: #888; margin-top: 2px; font-family: monospace; }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-online { background: #dcfce7; color: #16a34a; }
.badge-offline { background: #fee2e2; color: #dc2626; }
.badge-manual { background: #fff7ed; color: #ea580c; }
.badge-wind { background: #fef9c3; color: #ca8a04; }
.badge-night { background: #ede9fe; color: #7c3aed; }
.card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric-label { font-size: 11px; color: #888; margin-bottom: 4px; }
.metric-value { font-size: 18px; font-weight: 700; }
.progress-bar { height: 6px; background: #f1f5f9; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: #0f3460; border-radius: 3px; transition: width 0.5s; }
.card-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid #f1f5f9; font-size: 11px; color: #888; display: flex; justify-content: space-between; }
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.back-btn { display: flex; align-items: center; gap: 6px; color: #0f3460; font-size: 14px; font-weight: 600; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.data-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f8fafc; }
.data-key { font-size: 13px; color: #666; }
.data-val { font-size: 13px; font-weight: 600; }
.data-val.green { color: #16a34a; }
.data-val.red { color: #dc2626; }
.data-val.orange { color: #ea580c; }
.pos-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.pos-bar { height: 12px; background: #f1f5f9; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.pos-fill { height: 100%; background: linear-gradient(90deg, #0f3460, #4fc3f7); border-radius: 6px; transition: width 0.8s ease; }
.light-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: center; }
.light-ring { width: 60px; height: 60px; border-radius: 50%; border: 4px solid #f1f5f9; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; font-size: 12px; font-weight: 700; transition: border-color 0.5s; }
.relay-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.relay-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f8fafc; border-radius: 8px; }
.relay-name { font-size: 13px; font-weight: 600; }
.relay-dot { width: 10px; height: 10px; border-radius: 50%; background: #e0e0e0; }
.relay-dot.on { background: #22c55e; }
.control-label { font-size: 13px; font-weight: 600; color: #444; margin-bottom: 10px; display: flex; justify-content: space-between; }
input[type=range] { width: 100%; height: 6px; -webkit-appearance: none; background: #e2e8f0; border-radius: 3px; outline: none; margin-bottom: 16px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #0f3460; cursor: pointer; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.toggle-label { font-size: 14px; font-weight: 600; }
.toggle-switch { position: relative; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #e2e8f0; border-radius: 13px; transition: 0.3s; }
.toggle-slider:before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
input:checked + .toggle-slider { background: #0f3460; }
input:checked + .toggle-slider:before { transform: translateX(22px); }
.quick-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.chart-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #f1f5f9; }
.chart-tab { padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; color: #888; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.chart-tab.active { color: #0f3460; border-bottom-color: #0f3460; }
.time-selector { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.time-btn { padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1.5px solid #e0e0e0; background: #fff; color: #666; }
.time-btn.active { background: #0f3460; color: #fff; border-color: #0f3460; }
.chart-container { position: relative; height: 300px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: #666; text-transform: uppercase; }
.data-table td { padding: 14px 16px; font-size: 14px; border-top: 1px solid #f1f5f9; }
.data-table tr:hover td { background: #f8fafc; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 480px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
select { width: 100%; padding: 12px 16px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; background: #fff; }
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; color: #fff; min-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 768px) { .sidebar { display: none; } .main { margin-left: 0; } .stats-bar { grid-template-columns: repeat(2, 1fr); } .detail-grid { grid-template-columns: 1fr; } .content { padding: 16px; } }
