:root { color-scheme: dark; font-family: system-ui, -apple-system, Segoe UI, sans-serif; background: #0b1117; color: #e8eef4; }
* { box-sizing: border-box; }
body { margin: 0; padding: 20px; background: #0b1117; }
main { max-width: 1100px; margin: auto; }
header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
h1 { margin: 0 auto 0 0; font-size: 1.5rem; }
h2 { font-size: 1.05rem; margin: 0 0 14px; }
h3 { font-size: .95rem; margin: 8px 0; }
nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
a { color: #8fd5ff; }
button { border: 1px solid #536272; border-radius: 5px; padding: 7px 11px; background: #17212c; color: inherit; cursor: pointer; }
.inline { display: inline; }
.status { border-radius: 5px; padding: 9px 11px; margin: 18px 0; }
.status.ok { color: #9df0c4; background: #123327; }
.status.warn { color: #f5d48b; background: #392d16; }
.status.bad, .error { color: #ffb0b0; background: #3b1d24; }
.panel { background: #121b24; border: 1px solid #2a3948; border-radius: 8px; padding: 16px; margin: 14px 0; }
.panel.secondary { opacity: .95; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.cards article { display: grid; gap: 5px; min-height: 82px; background: #172431; border-radius: 6px; padding: 11px; }
.cards span, small, .muted { color: #9caebb; }
.cards strong { font-size: 1.35rem; }
.night-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr); gap: 18px; align-items: start; }
.frame { display: block; width: 100%; max-height: 480px; object-fit: contain; background: #070a0d; border: 1px solid #304354; border-radius: 5px; }
.frame[hidden] { display: none; }
.live-view-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.live-view-controls button { min-height: 40px; }
.live-view-status { flex: 1 1 240px; }
.live-view-controls button:focus-visible, .live-view-dialog button:focus-visible { outline: 3px solid #edf1f5; outline-offset: 2px; }
.live-view-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; }
.live-view-modal[hidden] { display: none; }
.live-view-modal-backdrop { position: absolute; inset: 0; background: rgba(3, 7, 11, .82); }
.live-view-dialog { position: relative; width: min(100%, 600px); padding: 28px; border: 1px solid #70d6ff; border-radius: 10px; background: #121b24; box-shadow: 0 18px 60px rgba(0, 0, 0, .55); }
.live-view-dialog h2 { margin-top: 0; font-size: clamp(1.35rem, 3vw, 1.8rem); }
.live-view-dialog p { margin: 14px 0 22px; font-size: 1.05rem; line-height: 1.5; }
.live-view-countdown { display: inline-block; min-width: 3.4ch; color: #f5d48b; font-size: 1.45em; font-variant-numeric: tabular-nums; }
.live-view-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.live-view-dialog-actions button { min-height: 46px; padding-inline: 16px; }
.live-view-primary { border-color: #70d6ff; background: #164055; }
body.live-view-modal-open { overflow: hidden; }
.event-summary { margin-top: 12px; }
.event-summary ul { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 5px 0; padding-left: 20px; color: #c6d5e2; }
.event-summary .recent-markers { display: grid; gap: 6px; margin: 5px 0; padding-left: 24px; color: #c6d5e2; }
.event-summary .recent-markers li { display: grid; gap: 5px; }
.recent-marker-text { overflow-wrap: anywhere; }
.detection-clip-metadata { font-size: .86rem; overflow-wrap: anywhere; }
.detection-image-button { justify-self: start; min-height: 34px; }
.detection-image-panel { display: grid; gap: 5px; max-width: min(100%, 480px); }
.detection-image-panel[hidden], .detection-image[hidden], .detection-image-status[hidden] { display: none; }
.detection-image { display: block; width: 100%; max-height: 320px; object-fit: contain; background: #070a0d; border: 1px solid #304354; border-radius: 5px; }
.detection-image-status { font-size: .9rem; }
.detection-history-nav { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.detection-history-nav button { min-height: 34px; }
.detection-history-nav button:disabled { cursor: default; opacity: .55; }
.detection-history-page { min-width: 11ch; color: #c6d5e2; text-align: center; }
.detection-history-note { margin: 4px 0 0; }
.history-panel { margin-top: 18px; padding-top: 14px; border-top: 1px solid #2a3948; }
.history-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.history-head h2 { margin: 0 auto 0 0; }
.history-head label { color: #9caebb; }
.history-head select { color: inherit; background: #0c131a; border: 1px solid #536272; border-radius: 5px; padding: 6px 8px; }
#historyChart { display: block; width: 100%; min-height: 220px; margin-top: 10px; background: #0c131a; border: 1px solid #2a3948; border-radius: 5px; }
#historyChart text { fill: #9caebb; font: 12px system-ui, -apple-system, Segoe UI, sans-serif; }
.history-chart-wrap { position: relative; width: 100%; }
.history-chart-wrap #historyChart { margin-top: 10px; touch-action: pan-y; user-select: none; }
.remote-range-handle { position: absolute; bottom: -4px; width: 34px; height: 34px; min-width: 34px; padding: 0; transform: translateX(-50%); border: 1px solid #70d6ff; border-radius: 50%; background: #101a22; color: #b9edff; font-size: 15px; line-height: 1; z-index: 2; touch-action: pan-y; }
.remote-range-handle::after { content: ''; display: block; width: 3px; height: 13px; margin: auto; border-left: 1px solid currentColor; border-right: 1px solid currentColor; }
.remote-range-handle:focus-visible { outline: 3px solid #edf1f5; outline-offset: 2px; }
.history-selection { margin-top: 12px; padding-top: 12px; border-top: 1px solid #2a3948; }
.history-selection-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.history-selection-head h3 { margin: 0 auto 0 0; }
.history-selection-head button { padding: 5px 8px; }
.history-selection > p { margin: 8px 0; }
.history-stats-scroll { overflow-x: auto; }
.history-stats { width: 100%; min-width: 1080px; border-collapse: collapse; white-space: nowrap; }
.history-stats th, .history-stats td { padding: 6px; border-bottom: 1px solid #28313a; text-align: right; }
.history-stats th:first-child, .history-stats td:first-child { text-align: left; }
.history-stats th { color: #9eabb8; font-size: 10px; }
.history-stats-details { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.history-stats-card { border: 1px solid #26313b; border-radius: 6px; padding: 9px; }
.history-stats-card h4 { margin: 0 0 8px; color: #9eabb8; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.history-rows, .remote-rows { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 12px; }
.history-rows dt, .remote-rows dt { color: #9caebb; }
.history-rows dd, .remote-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.remote-csv-controls { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-left: auto; }
.remote-csv-controls label { color: #9caebb; }
.remote-csv-controls select { color: inherit; background: #0c131a; border: 1px solid #536272; border-radius: 5px; padding: 6px 8px; }
.remote-csv-controls button { padding: 6px 9px; }
.remote-csv-controls span { font-size: .85rem; }
.remote-auxiliary { margin-top: 14px; padding-top: 12px; border-top: 1px solid #2a3948; opacity: .95; }
.remote-auxiliary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.remote-auxiliary-card { padding: 10px; background: #101922; border: 1px solid #273847; border-radius: 6px; }
.remote-auxiliary-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.remote-auxiliary-head h3 { margin: 0 auto 0 0; font-size: .9rem; }
.remote-badge { border-radius: 999px; padding: 3px 7px; color: #c5d4df; background: #27323d; font-size: .72rem; letter-spacing: .04em; }
.remote-badge.ok { color: #9df0c4; background: #123327; }
.remote-badge.warn { color: #f5d48b; background: #392d16; }
.remote-badge.muted { color: #b2bdc8; background: #27323d; }
.remote-rows { font-size: .88rem; }
.login { max-width: 420px; margin: 12vh auto; background: #121b24; border: 1px solid #2a3948; border-radius: 8px; padding: 22px; }
.login label { display: grid; gap: 6px; margin: 18px 0; }
.login input[type=password] { color: inherit; background: #0c131a; border: 1px solid #536272; border-radius: 5px; padding: 10px; }
@media (max-width: 700px) { body { padding: 12px; } .night-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .history-stats-details, .remote-auxiliary-grid { grid-template-columns: 1fr; } .remote-csv-controls { width: 100%; margin-left: 0; } .remote-csv-controls select, .remote-csv-controls button, .detection-history-nav button { min-height: 38px; } .remote-csv-controls span { flex: 1 1 100%; } .detection-history-page { flex: 1 1 auto; } }
