* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #1a1a2e; color: #e0e0e0; min-height: 100vh; }

header { background: #16213e; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #0f3460; }
header h1 { font-size: 1.3rem; color: #4fc3f7; }
nav { display: flex; gap: 0.5rem; }
.nav-btn { background: transparent; border: 1px solid #0f3460; color: #8892b0; padding: 0.5rem 1rem; cursor: pointer; border-radius: 4px; font-size: 0.9rem; transition: all 0.2s; }
.nav-btn:hover { background: #0f3460; border-color: #4fc3f7; color: #fff; }
.nav-btn.active { background: #0f3460; color: #fff; border-color: #4fc3f7; }

main { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }
h2 { margin-bottom: 1rem; color: #4fc3f7; font-size: 1.2rem; }

.status-bar { background: #16213e; padding: 0.5rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.85rem; color: #8892b0; }

/* Camera Grid */
.camera-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.camera-card { background: #16213e; border: 1px solid #0f3460; border-radius: 8px; padding: 1.2rem; }
.camera-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.camera-card .status { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.camera-card .status.online { background: #1b5e20; color: #69f0ae; }
.camera-card .status.offline { background: #b71c1c33; color: #ef5350; }
.camera-card .details { margin-top: 0.8rem; font-size: 0.85rem; color: #8892b0; }
.camera-card .details div { margin-bottom: 0.3rem; }

/* Alarm Table */
.alarm-controls { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
#alarm-table { width: 100%; border-collapse: collapse; }
#alarm-table th { background: #0f3460; padding: 0.6rem 1rem; text-align: left; font-size: 0.85rem; color: #4fc3f7; }
#alarm-table td { padding: 0.5rem 1rem; border-bottom: 1px solid #0f346033; font-size: 0.85rem; }
#alarm-table tr:hover td { background: #16213e; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #16213e; border: 1px solid #0f3460; border-radius: 8px; width: 90%; max-width: 960px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid #0f3460; }
.modal-header h3 { color: #4fc3f7; margin: 0; font-size: 1rem; }
.modal-close { background: none; border: none; color: #8892b0; font-size: 1.5rem; cursor: pointer; padding: 0 0.3rem; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-details { padding: 0.8rem 1.2rem; display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.85rem; color: #ccc; border-bottom: 1px solid #0f3460; }
.modal-details .detail-item { display: flex; flex-direction: column; gap: 0.2rem; }
.modal-details .detail-label { color: #8892b0; font-size: 0.75rem; text-transform: uppercase; }
.modal-details .detail-value { color: #e0e0e0; }

/* Pagination */
.pagination { display: flex; gap: 0.3rem; margin-top: 0.8rem; align-items: center; flex-wrap: wrap; }
.page-btn { background: #16213e; color: #e0e0e0; border: 1px solid #0f3460; padding: 0.3rem 0.6rem; border-radius: 3px; cursor: pointer; font-size: 0.8rem; }
.page-btn:hover:not(:disabled) { background: #0f3460; }
.page-btn.active { background: #4fc3f7; color: #1a1a2e; border-color: #4fc3f7; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* Playback Links */
.btn-link { color: #4fc3f7; text-decoration: none; font-size: 0.8rem; padding: 0.2rem 0.5rem; border: 1px solid #4fc3f7; border-radius: 3px; transition: all 0.2s; margin-right: 0.3rem; }
.btn-link:hover { background: #4fc3f7; color: #1a1a2e; }

/* Schedule */
.schedule-controls { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
#sched-files-table { width: 100%; border-collapse: collapse; }
#sched-files-table th { background: #0f3460; padding: 0.6rem 1rem; text-align: left; font-size: 0.85rem; color: #4fc3f7; }
#sched-files-table td { padding: 0.5rem 1rem; border-bottom: 1px solid #0f346033; font-size: 0.85rem; }
#sched-files-table tr:hover td { background: #16213e; }

/* Camera table */
#cam-table { width: 100%; border-collapse: collapse; }
#cam-table th { background: #0f3460; padding: 0.6rem 1rem; text-align: left; font-size: 0.85rem; color: #4fc3f7; white-space: nowrap; }
#cam-table td { padding: 0.5rem 1rem; border-bottom: 1px solid #0f346033; font-size: 0.85rem; white-space: nowrap; }
#cam-table tr:hover td { background: #16213e; }
#cam-table button { margin-right: 0.3rem; }

/* Playback scrubber */
#playback-slider { -webkit-appearance: none; appearance: none; height: 6px; background: #0f3460; border-radius: 3px; outline: none; cursor: pointer; }
#playback-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: #4fc3f7; border-radius: 50%; cursor: pointer; }
#playback-slider::-moz-range-thumb { width: 16px; height: 16px; background: #4fc3f7; border-radius: 50%; cursor: pointer; border: none; }
/* Config */
.config-controls { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.info-row { font-size: 0.85rem; margin-bottom: 0.4rem; color: #8892b0; }
.info-row span { color: #4fc3f7; font-weight: 600; }
.config-panel { background: #16213e; border: 1px solid #0f3460; border-radius: 8px; padding: 1.2rem; margin-bottom: 1rem; }
.config-panel h3 { margin-bottom: 1rem; color: #4fc3f7; font-size: 1rem; }
.form-group { margin-bottom: 0.8rem; }
.form-group label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.form-group input[type="number"] { background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; padding: 0.4rem 0.6rem; border-radius: 4px; width: 80px; }
.inline-status { font-size: 0.85rem; margin-left: 0.5rem; }

/* Live View */
.live-controls { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
#live-container { background: #000; border-radius: 8px; overflow: hidden; max-width: 960px; }
#live-video { width: 100%; display: block; }

/* Recording Schedule Grid */
.schedule-grid { overflow-x: auto; }
.sched-table { border-collapse: collapse; font-size: 0.75rem; }
.sched-table th { padding: 0.2rem 0.3rem; color: #4fc3f7; font-weight: normal; text-align: center; }
.sched-table td { padding: 0.15rem 0.3rem; text-align: center; }
.sched-table .sched-day { color: #8892b0; text-align: right; padding-right: 0.5rem; font-weight: 600; }
.sched-cb { width: 14px; height: 14px; cursor: pointer; accent-color: #4fc3f7; }

/* Common */
select { background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; padding: 0.4rem 0.6rem; border-radius: 4px; }
button { background: #0f3460; border: 1px solid #4fc3f7; color: #4fc3f7; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
button:hover { background: #4fc3f7; color: #1a1a2e; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
