:root {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #e8edf5;
  background: #0e131b;
  font-synthesis: none;
  --surface: #151c26;
  --surface-raised: #1a2330;
  --line: #25303d;
  --muted: #8895a7;
  --accent: #61d6a5;
  --blue: #5da6ff;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #0e131b; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: #0e131b; color: #e8edf5; }
button, select, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; display: flex; flex-direction: column; padding: 28px 18px 16px; border-right: 1px solid var(--line); background: #111720; z-index: 2; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 36px; text-decoration: none; color: inherit; }
.brand strong { display: block; font-family: Manrope, "Segoe UI", sans-serif; font-size: 16px; letter-spacing: -.3px; }
.brand small { display: block; margin-top: 3px; color: #758396; font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #6ae1b1, #3fba92); color: #09241a; font: 800 20px Manrope, "Segoe UI", sans-serif; box-shadow: 0 5px 18px #42c49832; }
.sidebar-section { flex: 1; }
.section-label, .eyebrow { margin: 0; color: #77869a; font-size: 10px; font-weight: 700; letter-spacing: 1.35px; }
.section-label { padding: 0 9px 10px; }
.nav-link, .camera-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: none; color: #9ba8b8; text-align: left; cursor: pointer; }
.nav-link { padding: 11px 10px; border-radius: 8px; font-size: 13px; }
.nav-link.active { background: #1b2932; color: #71dfb2; }
.nav-icon { width: 16px; text-align: center; font-size: 17px; }
.camera-heading { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 5px; }
.camera-heading .section-label { padding-bottom: 0; }
.count-pill { padding: 3px 7px; border-radius: 12px; background: #202a36; color: #9ba8b8; font-size: 10px; }
.camera-item { padding: 10px 9px; border-radius: 7px; font-size: 12px; }
.camera-item:hover { background: #1b242e; color: #e8edf5; }
.camera-status, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #e4a45f; box-shadow: 0 0 10px #e4a45f4d; }
.camera-status.online, .status-dot { background: #54d6a0; box-shadow: 0 0 10px #54d6a04d; }
.sidebar-bottom { padding-top: 15px; border-top: 1px solid var(--line); }
.retention-note { display: flex; align-items: center; gap: 9px; padding: 10px; color: #8997a9; font-size: 10px; }
.logout-button { margin-top: 5px; }

.main-content { max-width: 1540px; margin-left: 248px; padding: 35px 48px 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, "Segoe UI", sans-serif; letter-spacing: -.45px; }
.topbar h1 { margin: 6px 0 0; font-size: 25px; }
.topbar-right { display: flex; align-items: center; gap: 12px; color: #a4afbd; font-size: 11px; }
.memory-usage { padding: 6px 9px; border: 1px solid #303c4a; border-radius: 6px; background: #151c26; color: #b7c8da; font-size: 10px; white-space: nowrap; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: #758396; font-size: 9px; font-weight: 700; letter-spacing: .9px; }
.live-indicator i, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #56d49e; box-shadow: 0 0 10px #56d49e88; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.live-panel { margin-bottom: 42px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; }
.live-controls { display: flex; align-items: center; gap: 12px; }
.stream-control { padding: 9px 12px; border: 1px solid #3b8f70; border-radius: 7px; background: #172620; color: #83d6ac; font-size: 11px; cursor: pointer; }
.stream-control:disabled { opacity: .55; cursor: not-allowed; }
.camera-select-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.camera-select-label select { min-width: 150px; padding: 9px 31px 9px 11px; border: 1px solid #303c4a; border-radius: 7px; outline: none; background: #1b2430; color: #e8edf5; font-size: 11px; }
.live-placeholder { height: min(45vw, 430px); min-height: 235px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; background: radial-gradient(ellipse at center, #202a35 0%, #131a23 65%); color: #8290a1; font-size: 12px; }
.live-placeholder strong { color: #d3dae4; font-size: 14px; }
.placeholder-icon { margin-bottom: 3px; color: #5bdaa7; font-size: 30px; }
.live-image { display: block; width: 100%; height: auto; max-height: min(65vh, 720px); min-height: 220px; object-fit: contain; background: #080b10; }
.view-mode { display: inline-flex; padding: 3px; border: 1px solid #303c4a; border-radius: 8px; background: #121921; }
.view-mode-button { padding: 6px 11px; border: 0; border-radius: 5px; background: none; color: #9ba8b8; font-size: 11px; cursor: pointer; }
.view-mode-button:hover { color: #e8edf5; }
.view-mode-button[aria-pressed="true"] { background: #1b2932; color: #71dfb2; }
.camera-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 0 22px 16px; }
.camera-picker-options { display: flex; flex-wrap: wrap; gap: 7px; }
.camera-picker .filter-button { display: inline-flex; align-items: center; gap: 7px; }
.live-grid { --grid-columns: 2; display: grid; grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr)); gap: 2px; background: #080b10; }
.live-grid-tile { position: relative; margin: 0; aspect-ratio: 16 / 9; background: #080b10; overflow: hidden; cursor: zoom-in; }
.live-grid-tile img { display: block; width: 100%; height: 100%; object-fit: contain; }
.live-grid-tile.no-image img { visibility: hidden; }
.live-grid-missing { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #8290a1; font-size: 12px; }
.live-grid-tile.no-image .live-grid-missing { display: flex; }
.live-grid-tile figcaption { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 7px; max-width: calc(100% - 16px); padding: 5px 9px; border-radius: 6px; background: #0e131bcc; color: #e8edf5; font-size: 11px; }
.live-grid-tile figcaption strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.live-caption { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: #63dba9; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.live-dot { width: 6px; height: 6px; }
.caption-spacer { flex: 1; }
#camera-connection { color: #8997a9; font-weight: 500; letter-spacing: 0; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title-row h2 { margin: 5px 0 4px; font-size: 20px; }
.muted { margin: 0; color: var(--muted); font-size: 11px; }
.retention-tag { padding: 7px 10px; border: 1px solid #334333; border-radius: 6px; color: #83d6ac; font-size: 9px; font-weight: 700; letter-spacing: .8px; }
.date-list { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 11px; }
.date-card { min-width: 220px; display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; cursor: pointer; }
.date-card.selected { border-color: #3b8f70; background: #172620; box-shadow: 0 0 0 1px #3b8f7030; }
.date-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #222c39; color: #7e9cbe; font-size: 15px; }
.selected .date-icon { background: #203d32; color: #66d8a5; }
.date-main { flex: 1; }
.date-main strong, .date-main small { display: block; }
.date-main strong { font-size: 11px; font-weight: 600; }
.date-main small { margin-top: 4px; color: #8997a9; font-size: 10px; }
.date-stats { display: flex; gap: 8px; color: #8d99a9; font-size: 9px; }
.date-stats span { display: flex; align-items: center; gap: 4px; }
.date-stats i { width: 6px; height: 6px; border-radius: 50%; }
.person-key { background: #5fdaa2; }.vehicle-key { background: #5da6ff; }.animal-key { background: #ce88dc; }
.event-section { margin-top: 24px; }
.event-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.event-header h3 { margin: 4px 0 0; font-size: 15px; }
.event-count { color: #8997a9; font-size: 10px; }
.recording-timeline { margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #121923; }
.timeline-heading, .timeline-range-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timeline-actions { display: flex; align-items: center; gap: 8px; }
.timeline-heading .muted { margin-top: 5px; font-size: 10px; }
.timeline-reset, .timeline-refresh, .timeline-apply { padding: 8px 11px; border: 1px solid #354354; border-radius: 6px; background: #1b2430; color: #c4cfdb; font-size: 10px; cursor: pointer; }
.timeline-reset:hover, .timeline-refresh:hover, .timeline-apply:hover { border-color: #61d6a5; color: #83d6ac; }
.timeline-reset:disabled, .timeline-refresh:disabled { opacity: .6; cursor: wait; }
.timeline-apply { border-color: #3b8f70; background: #172620; color: #83d6ac; }
.timeline-histogram { position: relative; display: grid; grid-template-columns: repeat(var(--timeline-bin-count, 52), minmax(2px, 1fr)); align-items: end; gap: 2px; height: 80px; margin-top: 14px; padding: 14px 1px 0; }
.timeline-histogram::after { position: absolute; z-index: 1; inset: 0; border-right: 1px solid #61d6a566; border-left: 1px solid #61d6a566; background: linear-gradient(90deg, transparent var(--range-start), #61d6a510 var(--range-start), #61d6a510 var(--range-end), transparent var(--range-end)); content: ""; pointer-events: none; }
.timeline-bar { position: relative; z-index: 2; min-width: 0; height: var(--bar-height); min-height: 2px; padding: 0; border: 0; border-radius: 2px 2px 0 0; background: #5da6ff; opacity: .8; cursor: pointer; }
.timeline-bar:focus-visible { outline: 2px solid #d5f3e5; outline-offset: 2px; }
.timeline-count { position: absolute; z-index: 3; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); color: #b7c8da; font-size: 8px; line-height: 1; white-space: nowrap; }
.timeline-person-marker { position: absolute; z-index: 4; left: 50%; bottom: 32%; width: 5px; height: 5px; transform: translate(-50%, 50%); border: 1px solid #eafff5; border-radius: 50%; background: #ff6b73; box-shadow: 0 0 0 1px #35191d, 0 0 5px #ff6b73; pointer-events: none; }
.timeline-legend { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; color: #8997a9; font-size: 9px; }
.timeline-person-key { width: 6px; height: 6px; border: 1px solid #eafff5; border-radius: 50%; background: #ff6b73; box-shadow: 0 0 0 1px #35191d; }
.timeline-bar.outside-range { background: #667383; opacity: .3; }
.timeline-labels { display: flex; justify-content: space-between; gap: 4px; margin-top: 5px; color: #77869a; font-size: 9px; }
.timeline-labels span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-track { position: relative; height: 28px; margin: -14px 0 0; }
.timeline-slider { position: absolute; inset: 0; width: 100%; height: 28px; margin: 0; appearance: none; background: transparent; pointer-events: none; }
.timeline-slider::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.timeline-slider::-moz-range-track { height: 4px; background: transparent; }
.timeline-slider::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; appearance: none; border: 2px solid #d5f3e5; border-radius: 50%; background: #42bd8b; box-shadow: 0 1px 5px #0008; pointer-events: auto; cursor: ew-resize; }
.timeline-slider::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid #d5f3e5; border-radius: 50%; background: #42bd8b; box-shadow: 0 1px 5px #0008; pointer-events: auto; cursor: ew-resize; }
.timeline-slider:focus-visible { outline: none; }
.timeline-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px #61d6a555; }
.timeline-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px #61d6a555; }
.timeline-range-row { justify-content: flex-start; margin-top: 5px; color: #8997a9; font-size: 10px; }
.timeline-range-row strong { margin-left: 4px; color: #e2e8ef; font-weight: 600; }
.timeline-apply { margin-left: auto; }
.nav-link { text-decoration: none; }
.analytics-page .topbar { margin-bottom: 22px; }
.back-overview { color: #83d6ac; font-size: 11px; text-decoration: none; }
.back-overview:hover { color: #c1f3db; }
.analytics-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 21px; }
.analytics-intro h2 { margin: 6px 0 8px; font-size: 17px; }
.analytics-intro .muted { max-width: 720px; line-height: 1.6; }
.analytics-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.analytics-controls label, .chart-heading label { display: flex; flex-direction: column; gap: 5px; color: #8997a9; font-size: 9px; }
.analytics-controls select, .chart-heading select { min-width: 126px; padding: 8px 10px; border: 1px solid #303c4a; border-radius: 6px; background: #1b2430; color: #e8edf5; font-size: 10px; }
.analytics-controls button:disabled { opacity: .6; cursor: wait; }
.analytics-error { margin: 16px 0; padding: 12px 15px; border: 1px solid #713a40; border-radius: 7px; background: #321e24; color: #ffaaaa; font-size: 11px; }
.analytics-content { margin-top: 18px; }
.analytics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.analytics-kpi { display: flex; flex-direction: column; gap: 9px; padding: 16px; }
.analytics-kpi span { color: #8997a9; font-size: 10px; }
.analytics-kpi strong { color: #e4f3ec; font-size: 18px; line-height: 1.25; }
.trend-card { display: flex; align-items: center; gap: 15px; margin: 14px 0; padding: 17px 19px; }
.trend-icon { display: grid; flex: 0 0 39px; height: 39px; place-items: center; border-radius: 10px; background: #1b3026; color: #76d9aa; font-size: 23px; }
.trend-card[data-direction="falling"] .trend-icon { transform: rotate(90deg); background: #302622; color: #e6ad72; }
.trend-card[data-direction="steady"] .trend-icon { transform: rotate(45deg); color: #a9bad0; background: #222c39; }
.trend-card[data-direction="insufficient_data"] .trend-icon { color: #a9bad0; background: #222c39; }
#trend-commentary { margin: 5px 0 0; color: #d3dae4; font-size: 11px; line-height: 1.5; }
.trend-badge { margin-left: auto; padding: 6px 9px; border: 1px solid #315941; border-radius: 20px; color: #83d6ac; font-size: 9px; white-space: nowrap; }
.trend-card[data-direction="falling"] .trend-badge { border-color: #62482e; color: #e6ad72; }
.trend-card[data-direction="steady"] .trend-badge, .trend-card[data-direction="insufficient_data"] .trend-badge { border-color: #3a4655; color: #a9bad0; }
.analytics-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-panel { min-width: 0; padding: 17px; }
.chart-wide { grid-column: 1 / -1; }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-heading h2 { margin: 5px 0 0; font-size: 14px; }
.chart-heading label { align-items: flex-start; }
.chart-heading select { min-width: 155px; }
.chart-scroll { overflow-x: auto; margin-top: 18px; scrollbar-color: #344455 #151c26; }
.bar-chart { display: grid; align-items: end; gap: 5px; height: 175px; padding: 12px 2px 0; }
.daily-chart { grid-template-columns: repeat(var(--bar-count, 30), minmax(22px, 1fr)); min-width: 760px; }
.hourly-chart { grid-template-columns: repeat(24, minmax(8px, 1fr)); margin-top: 18px; }
.weekday-chart { grid-template-columns: repeat(7, minmax(20px, 1fr)); margin-top: 18px; }
.bar-column { display: flex; min-width: 0; height: 100%; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.bar-column[role="button"] { cursor: pointer; }
.bar-column[role="button"]:focus-visible { border-radius: 3px; outline: 2px solid #d5f3e5; outline-offset: 2px; }
.bar-area { display: flex; height: 100%; min-height: 0; align-items: flex-end; justify-content: center; }
.activity-bar { position: relative; display: block; width: min(100%, 22px); height: var(--bar-height); min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #6fe0b0, #318f78); }
.bar-column.no-data .activity-bar { background: #394452; opacity: .5; }
.hourly-chart .activity-bar { width: 100%; background: linear-gradient(180deg, #71b5ff, #3979bb); }
.hourly-chart[data-metric="person_detections"] .activity-bar { background: linear-gradient(180deg, #ff9a9f, #a94959); }
.hourly-chart[data-metric="vehicle_detections"] .activity-bar { background: linear-gradient(180deg, #7ab8ff, #3979bb); }
.hourly-chart[data-metric="other_detections"] .activity-bar { background: linear-gradient(180deg, #d3a0ed, #8051a0); }
.weekday-chart .activity-bar { width: 70%; }
.bar-count { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); color: #b7c8da; font-size: 8px; line-height: 1; white-space: nowrap; }
.day-activity-panel { margin: 14px 0; }
.day-timeline { grid-template-columns: repeat(48, minmax(2px, 1fr)); gap: 2px; height: 165px; margin-top: 20px; padding: 14px 1px 0; }
.day-bin { display: flex; min-width: 0; height: 100%; flex-direction: column; justify-content: flex-end; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.day-bin:focus-visible { border-radius: 3px; outline: 2px solid #d5f3e5; outline-offset: 1px; }
.day-bin-area { position: relative; display: flex; height: 100%; min-height: 0; align-items: flex-end; justify-content: center; }
.day-bin-bar { position: relative; display: block; width: 100%; height: var(--bar-height); min-height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, #6fe0b0, #318f78); opacity: .8; }
.day-timeline[data-metric="person_detections"] .day-bin-bar.category-hit { background: linear-gradient(180deg, #ff9a9f, #a94959); opacity: 1; }
.day-timeline[data-metric="vehicle_detections"] .day-bin-bar.category-hit { background: linear-gradient(180deg, #7ab8ff, #3979bb); opacity: 1; }
.day-timeline[data-metric="other_detections"] .day-bin-bar.category-hit { background: linear-gradient(180deg, #d3a0ed, #8051a0); opacity: 1; }
.day-bin-count { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); color: #c4cfdb; font-size: 7px; line-height: 1; white-space: nowrap; }
.day-bin-marker { position: absolute; z-index: 1; bottom: 32%; left: 50%; width: 5px; height: 5px; transform: translate(-50%, 50%); border: 1px solid #eafff5; border-radius: 50%; background: #ff6b73; box-shadow: 0 0 0 1px #35191d; }
.day-timeline[data-metric="vehicle_detections"] .day-bin-marker { background: #7ab8ff; }
.day-timeline[data-metric="other_detections"] .day-bin-marker { background: #d3a0ed; }
.day-bin-label { display: block; height: 13px; overflow: visible; margin-top: 5px; color: #77869a; font-size: 7px; white-space: nowrap; }
.day-timeline-legend { display: flex; align-items: center; gap: 6px; margin: 5px 0 0; color: #8997a9; font-size: 9px; }
.day-marker-key { width: 6px; height: 6px; border: 1px solid #eafff5; border-radius: 50%; background: #ff6b73; box-shadow: 0 0 0 1px #35191d; }
.day-timeline-legend[data-metric="vehicle_detections"] .day-marker-key { background: #7ab8ff; }
.day-timeline-legend[data-metric="other_detections"] .day-marker-key { background: #d3a0ed; }
.day-timeline-legend[data-metric="videos"] .day-marker-key { display: none; }
.bar-label { display: block; height: 16px; overflow: hidden; margin-top: 6px; color: #8997a9; font-size: 8px; text-align: center; white-space: nowrap; }
.chart-caption { margin: 12px 0 0; color: #8997a9; font-size: 9px; line-height: 1.5; }
.analytics-footnote { margin: 17px 2px 0; color: #8997a9; font-size: 10px; line-height: 1.6; }
.detection-summary { margin-top: 14px; padding: 17px; }
.detection-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.detection-total { display: flex; flex-direction: column; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #121923; color: inherit; text-align: left; cursor: pointer; }
.detection-total[aria-pressed="true"] { border-color: #61d6a5; box-shadow: inset 0 0 0 1px #61d6a544; }
.detection-total:focus-visible { outline: 2px solid #d5f3e5; outline-offset: 2px; }
.detection-total span { color: #9aa8b8; font-size: 10px; }
.detection-total strong { color: #e8edf5; font-size: 18px; }
.detection-total small { color: #718095; font-size: 9px; }
.detection-people strong { color: #ff9a9f; }
.detection-vehicles strong { color: #7ab8ff; }
.detection-other strong { color: #d3a0ed; }
.recording-drilldown { margin-top: 16px; padding: 17px; }
.drilldown-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drilldown-heading h2, .drilldown-heading h3 { margin: 5px 0 0; font-size: 14px; }
.recording-drilldown > .muted { margin: 8px 0 12px; font-size: 10px; }
.drilldown-list { display: grid; gap: 7px; }
.drilldown-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #121923; }
.drilldown-item strong { font-size: 11px; }
.drilldown-item p { margin: 4px 0 0; color: #8997a9; font-size: 9px; }
.drilldown-item a { color: #83d6ac; font-size: 10px; white-space: nowrap; }
.drilldown-unavailable { color: #a4afbd; font-size: 9px; text-align: right; }
.analytics-updated { margin: 7px 2px 0; color: #657487; font-size: 9px; text-align: right; }
.recording-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 15px; }
.filter-label { margin-right: 3px; color: #8997a9; font-size: 10px; }
.filter-button, .clear-filters { padding: 7px 10px; border: 1px solid #303b48; border-radius: 6px; background: #171f29; color: #aab5c2; font-size: 10px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.filter-button:hover, .clear-filters:hover { border-color: #687889; color: #edf2f7; }
.filter-button.selected { border-color: #5183b4; background: #1b2c3d; color: #9dc9f4; }
.clear-filters.selected { border-color: #3b8f70; background: #172620; color: #83d6ac; }
.filter-empty-state { margin: 0 0 14px; padding: 20px; border: 1px dashed #303b48; border-radius: 8px; color: #8997a9; text-align: center; font-size: 11px; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 225px), 1fr)); gap: 13px; }
.load-more-row { display: flex; justify-content: center; padding: 20px 0; }
.load-more-button { padding: 10px 18px; border: 1px solid #3b8f70; border-radius: 7px; background: #172620; color: #83d6ac; font-size: 11px; cursor: pointer; }
.load-more-button:hover { border-color: #61d6a5; background: #1b3026; }
.load-more-button:disabled { opacity: .6; cursor: wait; }
.event-card { overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.event-card:hover { transform: translateY(-2px); border-color: #466453; }
.event-card.has-person { border: 2px solid #ef4444; box-shadow: 0 0 0 1px #ef444455, 0 0 15px #ef444422; }
.event-card.has-person:hover { border-color: #ff6b6b; box-shadow: 0 0 0 1px #ff6b6b66, 0 0 20px #ef444444; }
.thumbnail-wrap { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #090c10; }
.thumbnail-wrap img { width: 100%; height: 100%; object-fit: cover; }
.alert-badge { position: absolute; top: 8px; left: 8px; padding: 5px 7px; border: 1px solid #54c995aa; border-radius: 5px; background: #09271ddd; color: #a4f0c7; font-size: 9px; font-weight: 700; letter-spacing: .02em; }
.notification-status-icon { position: absolute; top: 7px; right: 7px; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid currentColor; border-radius: 50%; box-shadow: 0 1px 5px #0008; }
.notification-status-icon > span { font-size: 15px; font-weight: 800; line-height: 1; }
.notification-status-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.notification-sent { background: #063d27ee; color: #58e3a2; }
.notification-not-sent { background: #4a1018ee; color: #ff6b73; }
.play-icon { position: absolute; inset: 50% auto auto 50%; display: grid; width: 35px; height: 35px; transform: translate(-50%, -50%); place-items: center; border: 1px solid #ffffff80; border-radius: 50%; background: #111a20bb; color: white; font-size: 12px; padding-left: 2px; opacity: .9; }
.duration { position: absolute; right: 8px; bottom: 8px; padding: 4px 6px; border-radius: 4px; background: #080b10d9; color: white; font-size: 9px; }
.event-card-body { padding: 11px 12px 12px; }
.event-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.event-card-top strong { overflow: hidden; color: #e2e8ef; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-card-top time { color: #8997a9; font-size: 9px; white-space: nowrap; }
.event-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.event-card-tags span, .tag { padding: 4px 6px; border-radius: 4px; background: #222e37; color: #93aa9c; font-size: 9px; }
.empty-state { padding: 48px 15px; border: 1px dashed #303b48; border-radius: 10px; text-align: center; color: #8b98a8; }
.empty-state > span { color: #62d6a4; font-size: 25px; }
.empty-state h3 { margin: 10px 0 5px; color: #d3dae4; font-size: 14px; }
.empty-state p { margin: 0; font-size: 11px; }
.video-dialog { width: min(900px, calc(100vw - 32px)); max-width: none; padding: 0; border: 1px solid #35404d; border-radius: 12px; background: #111720; color: #e8edf5; box-shadow: 0 20px 80px #000b; }
.video-dialog::backdrop { background: #05080dbb; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 15px; }
.icon-button { width: 32px; height: 32px; border: 1px solid #303b48; border-radius: 7px; background: #1b2430; font-size: 22px; line-height: 1; cursor: pointer; }
.video-dialog video { display: block; width: 100%; max-height: 72vh; background: #05070a; }
.event-tags { display: flex; gap: 6px; padding: 13px 20px 17px; }
.tag { background: #20372d; color: #89d9ad; }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 40%, #18241f 0, #0e131b 55%); }
.login-card { width: min(390px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 20px 70px #0005; }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { margin: 8px 0; font-size: 22px; }
.login-card .muted { margin-bottom: 24px; }
.login-card label { display: block; margin: 15px 0 7px; color: #b7c1ce; font-size: 11px; font-weight: 600; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid #303c4a; border-radius: 7px; outline: none; background: #10161e; color: #e8edf5; }
.login-card input:focus { border-color: #50bd90; }
.button { border: 0; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 700; }
.button-primary { margin-top: 23px; padding: 12px; background: #58ce9d; color: #08251a; }
.full-width { width: 100%; }
.form-error { padding: 10px; border-radius: 6px; background: #3b2024; color: #ff9a9a; font-size: 11px; }
.configuration-page .topbar { margin-bottom: 20px; }
.configuration-panel { margin-bottom: 14px; padding: 18px; }
.configuration-panel h2 { margin: 5px 0 0; font-size: 15px; }
.configuration-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 18px; }
.configuration-fields label { display: flex; flex-direction: column; gap: 6px; color: #aab6c5; font-size: 10px; }
.configuration-fields input { min-width: 0; padding: 9px 10px; border: 1px solid #303c4a; border-radius: 6px; outline: none; background: #10161e; color: #e8edf5; font-size: 11px; }
.configuration-fields input:focus { border-color: #50bd90; }
.configuration-fields select { min-width: 0; padding: 9px 10px; border: 1px solid #303c4a; border-radius: 6px; outline: none; background: #10161e; color: #e8edf5; font-size: 11px; }
.configuration-fields select:focus { border-color: #50bd90; }
.configuration-fields .configuration-checkbox { flex-direction: row; align-items: center; }
.configuration-fields .configuration-checkbox input { width: 16px; height: 16px; accent-color: #58ce9d; }
.configuration-help { margin-top: 10px; line-height: 1.5; }
.email-enabled { display: flex; align-items: center; gap: 7px; color: #aab6c5; font-size: 10px; }
.email-enabled input, .camera-notification-options input { width: 16px; height: 16px; accent-color: #58ce9d; }
.whatsapp-bridge-status { margin-top: 12px; color: #aab6c5; font-size: 11px; }
.whatsapp-pairing-qr { display: block; width: 240px; height: 240px; margin-top: 12px; padding: 8px; border-radius: 6px; background: #fff; }
.camera-notification-settings { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.camera-notification-settings > strong { color: #e2e8ef; font-size: 10px; }
.camera-notification-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.camera-notification-options label { display: flex; align-items: center; gap: 6px; color: #aab6c5; font-size: 10px; }
.camera-notification-settings > label { display: flex; flex-direction: column; gap: 6px; max-width: 360px; color: #aab6c5; font-size: 10px; }
.camera-notification-settings > label input { padding: 9px 10px; border: 1px solid #303c4a; border-radius: 6px; background: #10161e; color: #e8edf5; font-size: 11px; }
.camera-hot-zone-coordinates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 520px; }
.camera-hot-zone-coordinates label { display: flex; flex-direction: column; gap: 6px; color: #aab6c5; font-size: 10px; }
.camera-hot-zone-coordinates input { min-width: 0; accent-color: #ff7373; cursor: pointer; }
.camera-hot-zone-coordinates output { color: #e8edf5; font-variant-numeric: tabular-nums; }
.centroid-boundary-preview { width: min(100%, 360px); margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #10161e; }
.centroid-boundary-preview svg { display: block; width: 100%; height: auto; }
.centroid-boundary-preview figcaption, .centroid-boundary-help { color: #aab6c5; font-size: 9px; line-height: 1.5; }
.centroid-boundary-preview figcaption { margin-top: 5px; }
.camera-hot-zone-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; align-items: start; }
.camera-snapshot-preview { min-width: 0; }
.camera-snapshot-button { margin-bottom: 8px; }
.camera-snapshot-frame { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #0b1016; }
.camera-snapshot-image { display: block; width: 100%; height: 100%; object-fit: fill; }
.camera-snapshot-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera-snapshot-status { position: absolute; top: 50%; left: 50%; width: 100%; margin: 0; padding: 10px; transform: translate(-50%, -50%); color: #aab6c5; font-size: 10px; text-align: center; }
.centroid-boundary-coordinate { display: block; margin-top: 5px; color: #ffaaaa; font-size: 10px; font-weight: 700; }
.centroid-boundary-help { margin: 5px 0 0; }
.camera-config-list { display: grid; gap: 11px; }
.camera-config-card { min-width: 0; margin: 14px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #121923; }
.camera-config-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.camera-config-heading strong { color: #e2e8ef; font-size: 11px; }
.camera-config-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.camera-config-toggle { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 4px 2px; border: 0; background: none; text-align: left; cursor: pointer; }
.camera-config-toggle:hover strong { color: #fff; }
.camera-config-toggle:focus-visible { outline: 2px solid #50bd90; outline-offset: 2px; border-radius: 4px; }
.camera-config-chevron { display: inline-block; width: 12px; color: #71dfb2; font-size: 12px; transition: transform .15s; }
.camera-config-toggle[aria-expanded="true"] .camera-config-chevron { transform: rotate(90deg); }
.camera-config-summary { min-width: 0; overflow: hidden; color: #8997a9; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.camera-config-card.collapsed .camera-config-body { display: none; }
.camera-config-card:not(.collapsed) .camera-config-heading { padding-bottom: 6px; }
.camera-fields { margin-top: 11px; }
.camera-remove-button { padding: 6px 9px; border: 1px solid #674147; border-radius: 5px; background: #2b1d22; color: #ffaaaa; font-size: 9px; cursor: pointer; }
.startup-note { padding: 14px 18px; }
.startup-note .muted { margin: 7px 0 0; line-height: 1.6; }
.configuration-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.configuration-actions .button { margin: 0; }
.configuration-actions .button:disabled { opacity: .6; cursor: wait; }
.configuration-message { margin: 0 0 14px; padding: 11px 13px; border: 1px solid #315941; border-radius: 7px; background: #172620; color: #a8e8c8; font-size: 11px; line-height: 1.5; }
.configuration-message.configuration-error { border-color: #713a40; background: #321e24; color: #ffaaaa; }
.notification-schedule-toolbar { display: flex; gap: 8px; margin: 12px 0; }
.notification-schedule-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; }
.notification-schedule { width: 100%; min-width: 930px; border-collapse: collapse; table-layout: fixed; color: #aab6c5; font-size: 9px; }
.notification-schedule th, .notification-schedule td { height: 34px; padding: 4px 2px; border-bottom: 1px solid var(--line); text-align: center; }
.notification-schedule thead th { position: sticky; top: 0; background: #1a2330; color: #9ba8b8; font-variant-numeric: tabular-nums; }
.notification-schedule th:first-child { width: 82px; }
.notification-schedule tbody th { padding-left: 10px; text-align: left; color: #c4cfdb; font-weight: 500; }
.notification-schedule input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.notification-schedule tbody tr:last-child th, .notification-schedule tbody tr:last-child td { border-bottom: 0; }
.whatsapp-test-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.whatsapp-test-actions .whatsapp-bridge-status { margin-top: 0; }
.whatsapp-test-actions .configuration-error { color: #ffaaaa; }

@media (max-width: 1024px) {
  .main-content { padding-inline: 30px; }
}
@media (max-width: 900px) {
  .sidebar { width: 205px; padding-inline: 12px; }
  .main-content { margin-left: 205px; padding: 28px 24px 55px; }
  .event-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); }
  .analytics-intro { align-items: flex-start; flex-direction: column; }
  .analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .configuration-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 650px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .sidebar-section { display: flex; align-items: center; gap: 5px; margin-top: 12px; }
  .sidebar-section > .section-label, .camera-heading, .camera-list, .sidebar-bottom { display: none; }
  .sidebar-section .nav-link { width: auto; flex: 1; justify-content: center; padding: 9px 7px; font-size: 11px; }
  .main-content { width: 100%; margin: 0; padding: 20px 14px 36px; }
  .analytics-controls { width: 100%; }
  .analytics-controls label { flex: 1; min-width: 110px; }
  .analytics-controls select { width: 100%; }
  .analytics-controls button { min-height: 38px; }
  .configuration-actions { flex-direction: column; }
  .configuration-actions .button { width: 100%; }
  .analytics-kpis { gap: 8px; }
  .detection-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .detection-total { padding: 9px; }
  .detection-total span { font-size: 8px; }
  .detection-total strong { font-size: 14px; }
  .analytics-kpi { padding: 12px; }
  .analytics-kpi strong { font-size: 14px; }
  .analytics-charts { grid-template-columns: minmax(0, 1fr); }
  .chart-wide { grid-column: auto; }
  .chart-panel { padding: 13px; }
  .chart-heading { align-items: flex-start; }
  .chart-heading select { min-width: 0; max-width: 145px; }
  .trend-card { align-items: flex-start; padding: 13px; }
  .trend-icon { flex-basis: 32px; height: 32px; }
  .trend-badge { padding: 5px 7px; font-size: 8px; }
  .topbar { align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .topbar h1 { font-size: 22px; }
  .topbar-right { flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; }
  .live-indicator { font-size: 8px; }
  .panel { border-radius: 9px; }
  .live-panel { margin-bottom: 30px; }
  .panel-heading { align-items: stretch; flex-direction: column; gap: 12px; padding: 14px; }
  .live-controls { align-items: stretch; flex-direction: column; gap: 10px; }
  .stream-control { min-height: 44px; }
  .camera-select-label { align-items: center; justify-content: space-between; gap: 12px; }
  .camera-select-label select { width: min(72%, 280px); min-width: 0; min-height: 44px; font-size: 16px; }
  .live-placeholder { height: auto; min-height: 0; aspect-ratio: 16 / 9; padding: 16px; text-align: center; }
  .live-image { min-height: 0; max-height: 58vh; aspect-ratio: 16 / 9; }
  .live-caption { padding: 9px 12px; }
  .view-mode { width: 100%; }
  .view-mode-button { flex: 1; min-height: 40px; font-size: 13px; }
  .camera-picker { padding: 0 14px 14px; }
  .camera-picker .filter-label { flex: 0 0 100%; }
  .live-grid { grid-template-columns: repeat(var(--grid-columns-narrow, 1), minmax(0, 1fr)); }
  .section-title-row { align-items: flex-start; gap: 10px; }
  .recording-timeline { padding: 12px; }
  .timeline-heading { align-items: flex-start; }
  .timeline-actions { flex-direction: column; align-items: stretch; }
  .timeline-reset, .timeline-refresh { white-space: nowrap; }
  .timeline-range-row { flex-wrap: wrap; gap: 8px 14px; }
  .timeline-apply { margin-left: 0; }
  .timeline-histogram { gap: 1px; }
  .section-title-row > div { min-width: 0; }
  .section-title-row h2 { font-size: 19px; }
  .section-title-row .muted { max-width: 34ch; line-height: 1.5; }
  .retention-tag { flex: 0 0 auto; margin-top: 14px; padding: 6px 7px; font-size: 8px; }
  .date-list { margin-right: -14px; padding-right: 14px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
  .date-card { min-width: min(235px, 82vw); scroll-snap-align: start; }
  .event-section { margin-top: 20px; }
  .event-header { align-items: flex-start; gap: 10px; }
  .event-header h3 { font-size: 14px; line-height: 1.4; }
  .event-count { flex: 0 0 auto; padding-top: 5px; }
  .recording-filters { gap: 7px; margin-bottom: 13px; }
  .filter-label { flex: 0 0 100%; }
  .filter-button, .clear-filters { min-height: 42px; padding: 9px 11px; font-size: 11px; }
  .event-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 11px; }
  .event-card-top strong, .event-card-top time { font-size: 11px; }
  .event-card-body { padding: 12px; }
  .video-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); overflow-y: auto; border-radius: 10px; }
  .dialog-heading { position: sticky; top: 0; z-index: 1; gap: 10px; padding: 12px 14px; background: #111720; }
  .dialog-heading > div { min-width: 0; }
  .dialog-heading h2 { overflow-wrap: anywhere; font-size: 14px; }
  .icon-button { flex: 0 0 40px; width: 40px; height: 40px; }
  .video-dialog video { max-height: 65dvh; }
  .event-tags { flex-wrap: wrap; padding: 10px 14px 14px; }
  .login-page { padding: 16px; }
  .login-card { padding: 26px 22px; }
  .login-card input { min-height: 46px; font-size: 16px; }
  .button-primary { min-height: 46px; }
}

@media (max-width: 380px) {
  .main-content { padding-inline: 11px; }
  .sidebar { padding-inline: 12px; }
  .date-list { margin-right: -11px; padding-right: 11px; }
  .date-card { min-width: 82vw; gap: 9px; padding: 11px; }
  .date-stats { gap: 6px; }
  .recording-filters { gap: 6px; }
  .filter-button, .clear-filters { padding-inline: 9px; }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-section, .sidebar-bottom { display: none; }
  .main-content { margin: 0; padding: 14px 18px 28px; }
  .live-image { max-height: 60vh; }
  .live-placeholder { min-height: 0; height: 50vh; }
}

/* Per-camera orientation and recording/motion schedules */
.camera-capture-settings { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.camera-capture-settings > strong, .capture-schedule > strong { color: #e2e8ef; font-size: 10px; }
.capture-schedule-help { margin: 0; font-size: 10px; line-height: 1.5; }
.capture-orientation { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 13px; }
.capture-orientation label, .capture-schedule-mode { display: flex; flex-direction: column; gap: 6px; color: #aab6c5; font-size: 10px; }
.capture-orientation select, .capture-schedule-mode select, .capture-straighten input[type="number"], .capture-window input[type="time"] { min-width: 0; padding: 8px 10px; border: 1px solid #303c4a; border-radius: 6px; background: #10161e; color: #e8edf5; font-size: 11px; color-scheme: dark; }
.capture-straighten { display: flex; align-items: center; gap: 8px; }
.capture-straighten input[type="range"] { flex: 1; min-width: 0; accent-color: #58ce9d; }
.capture-straighten input[type="number"] { width: 72px; }
.orientation-preview { display: grid; gap: 8px; margin: 0; }
.orientation-preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.orientation-preview-state { color: #8997a9; font-size: 10px; }
.orientation-preview-state.orientation-unsaved { color: #e4a45f; }
.orientation-preview-frame { display: flex; justify-content: center; max-width: 520px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #080b10; }
.orientation-preview-frame img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; }
.orientation-preview figcaption { font-size: 10px; }
.capture-schedules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 4px; }
.capture-schedule { display: grid; align-content: start; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #121921; }
.capture-schedule-mode { max-width: 280px; }
.capture-schedule > .timeline-refresh { justify-self: start; }
.capture-window-list { display: grid; gap: 8px; }
.capture-window { display: grid; gap: 8px; padding: 9px; border: 1px solid #263140; border-radius: 6px; background: #0f151c; }
.capture-window-times { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #8997a9; font-size: 10px; }
.capture-window-note { color: #e4a45f; }
.capture-window-days { display: flex; flex-wrap: wrap; gap: 4px; }
.capture-day { min-width: 38px; padding: 5px 6px; border: 1px solid #303b48; border-radius: 5px; background: #171f29; color: #7f8c9c; font-size: 10px; cursor: pointer; }
.capture-day[aria-pressed="true"] { border-color: #3b8f70; background: #172620; color: #83d6ac; }
.capture-window .camera-remove-button { justify-self: start; }
.camera-paused { margin-left: auto; padding: 2px 6px; border-radius: 9px; background: #2b2219; color: #e4a45f; font-size: 9px; white-space: nowrap; }
.camera-paused + .camera-paused { margin-left: 4px; }

/* Stitched layout editor */
.stitch-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 14px; }
.stitch-layout-picker { display: flex; flex-direction: column; gap: 6px; color: #aab6c5; font-size: 10px; }
.stitch-layout-picker select { min-width: 200px; padding: 8px 10px; border: 1px solid #303c4a; border-radius: 6px; background: #10161e; color: #e8edf5; font-size: 11px; }
.stitch-layout-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stitch-layout-fields .configuration-checkbox { grid-column: 1 / -1; }
.stitch-preview-status { font-size: 10px; }
.stitch-stage-wrap { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #0a0e14; }
.stitch-stage { --stage-ratio: 1.7778; position: relative; width: min(100%, calc(70vh * var(--stage-ratio))); margin: 0 auto; overflow: hidden; background: repeating-conic-gradient(#121820 0% 25%, #0e131a 0% 50%) 0 0 / 24px 24px; touch-action: none; user-select: none; }
.stitch-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.stitch-tile { position: absolute; border: 1px dashed #8fb3d9aa; background: #5da6ff0d; cursor: move; }
.stitch-tile:hover { border-color: #b8d4f0; }
.stitch-tile.selected, .stitch-tile:focus-visible { outline: none; border: 2px solid #61d6a5; background: #61d6a514; }
.stitch-tile-label { position: absolute; bottom: 4px; left: 4px; max-width: calc(100% - 26px); overflow: hidden; padding: 2px 6px; border-radius: 4px; background: #0e131bd9; color: #dfe7f0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.stitch-tile-handle { position: absolute; right: -1px; bottom: -1px; width: 16px; height: 16px; border-radius: 3px 0 0 0; background: #61d6a5; cursor: nwse-resize; }
.stitch-tile:not(.selected) .stitch-tile-handle { opacity: .55; }
.stitch-tile-panel { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #121921; }
.stitch-tile-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.stitch-tile-heading strong { color: #e2e8ef; font-size: 11px; }
.stitch-tile-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.stitch-tile-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px; }
.stitch-tile-fields select { grid-column: span 1; }
.stitch-crop-fields { max-width: none; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; }
.stitch-crop-fields input { accent-color: #5da6ff; }
.stitch-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.stitch-save-row .button-primary { margin-top: 0; }
.stitch-save-row .button-primary { min-width: 160px; }

@media (max-width: 900px) {
  .capture-schedules, .capture-orientation { grid-template-columns: 1fr; }
  .stitch-layout-fields, .stitch-tile-fields, .stitch-crop-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .stitch-layout-picker, .stitch-layout-picker select { width: 100%; min-width: 0; }
  .capture-day { min-height: 36px; flex: 1; }
}

/* Disk cleanup */
.cleanup-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.cleanup-card { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #121921; }
.cleanup-card strong { color: #e8edf5; font-size: 13px; }
.cleanup-card .muted { font-size: 10px; line-height: 1.45; }
.cleanup-meter { position: relative; height: 8px; margin: 2px 0; border-radius: 4px; background: #222c38; }
.cleanup-meter span { display: block; height: 100%; border-radius: 4px; background: #58ce9d; }
.cleanup-meter span.over-threshold { background: #e4a45f; }
.cleanup-meter i { position: absolute; top: -3px; width: 2px; height: 14px; background: #c7d1da; }
.cleanup-meter #cleanup-threshold-mark { background: #ff7373; }
.cleanup-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cleanup-fields .configuration-checkbox { grid-column: 1 / -1; }
.cleanup-history { margin-top: 14px; }
.cleanup-history summary { color: #aab6c5; font-size: 11px; cursor: pointer; }
.cleanup-history-scroll { margin-top: 8px; overflow-x: auto; }
.cleanup-history table { width: 100%; border-collapse: collapse; font-size: 10px; }
.cleanup-history th, .cleanup-history td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: #aab6c5; text-align: left; white-space: nowrap; }
.cleanup-history th { color: #77869a; font-weight: 700; }
.cleanup-history tr.cleanup-failed td { color: #ff9a9a; }

@media (max-width: 900px) {
  .cleanup-status, .cleanup-fields { grid-template-columns: 1fr; }
}

/* Collapsible configuration sections */
.configuration-topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.collapsible-heading { justify-content: flex-start; }
.collapsible-heading > :last-child:not(.section-title):not(.section-toggle) { margin-left: auto; }
.section-title { flex: 0 1 auto; min-width: 0; cursor: pointer; user-select: none; }
.section-title:hover h2 { color: #fff; }
.section-toggle { flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid #303c4a; border-radius: 6px; background: #171f29; color: #71dfb2; font-size: 12px; cursor: pointer; }
.section-toggle:hover { border-color: #687889; }
.section-toggle:focus-visible { outline: 2px solid #50bd90; outline-offset: 2px; }
.section-toggle span { display: inline-block; transition: transform .15s; }
.section-toggle[aria-expanded="true"] span { transform: rotate(90deg); }
.configuration-panel.collapsed .configuration-section-body { display: none; }
.configuration-panel.collapsed { padding-bottom: 14px; }

/* Playback (timeline viewer) */
.playback-topbar-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.playback-topbar-controls input[type="date"] { padding: 8px 10px; border: 1px solid #303c4a; border-radius: 7px; background: #1b2430; color: #e8edf5; font-size: 11px; color-scheme: dark; }
.playback-panel { overflow: hidden; }
.pb-viewport { position: relative; aspect-ratio: 16 / 9; max-height: 68vh; width: 100%; margin: 0 auto; background: #080b10; }
.pb-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #080b10; }
.pb-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; color: #8290a1; font-size: 12px; text-align: center; }
.pb-empty strong { color: #d3dae4; font-size: 15px; }
.pb-badge { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 6px; background: #0e131bcc; color: #e8edf5; font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.pb-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #8e9aab; }
.pb-badge-live .pb-badge-dot { background: #ff7373; box-shadow: 0 0 8px #ff7373; }
.pb-badge-recording .pb-badge-dot { background: #5da6ff; }
.pb-badge-snapshot .pb-badge-dot { background: #c7d1da; }
.pb-time { position: absolute; right: 12px; bottom: 12px; padding: 5px 9px; border-radius: 6px; background: #0e131bcc; color: #e8edf5; font-size: 12px; font-variant-numeric: tabular-nums; }
.pb-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pb-transport, .pb-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pb-button { min-width: 38px; height: 34px; padding: 0 10px; border: 1px solid #303c4a; border-radius: 7px; background: #171f29; color: #dfe7f0; font-size: 12px; cursor: pointer; }
.pb-button:hover { border-color: #687889; }
.pb-play { min-width: 48px; border-color: #3b8f70; background: #172620; color: #83d6ac; font-size: 14px; }
.pb-live.active { border-color: #a04848; background: #2b1d22; color: #ffaaaa; }
.pb-timeline-wrap { padding: 0 16px 12px; }
.pb-timeline { display: block; width: 100%; height: 96px; border: 1px solid var(--line); border-radius: 8px; cursor: grab; touch-action: none; }
.pb-timeline:active { cursor: grabbing; }
.pb-timeline:focus-visible { outline: 2px solid #50bd90; outline-offset: 2px; }
.pb-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 8px; color: #8997a9; font-size: 10px; }
.pb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pb-key { width: 14px; height: 8px; border-radius: 2px; }
.pb-key-person { background: #5da6ff; }
.pb-key-vehicle { background: #e4a45f; }
.pb-key-animal { background: #61d6a5; }
.pb-key-snapshot { background: #3a4656; }
.pb-hint { margin-left: auto; }
.pb-info { display: flex; align-items: center; gap: 12px; margin: 0 16px 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #121921; }
.pb-info img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; background: #080b10; }
.pb-info > div { display: grid; flex: 1; gap: 3px; min-width: 0; font-size: 12px; }
.pb-info .muted { font-size: 10px; }
.pb-info a { text-decoration: none; }

@media (max-width: 650px) {
  .pb-controls { padding: 10px; }
  .pb-timeline-wrap { padding: 0 10px 10px; }
  .pb-hint { display: none; }
  .pb-info { margin: 0 10px 10px; }
}
.dialog-playback-link { margin-left: auto; margin-right: 10px; text-decoration: none; }
