:root {
  color-scheme: dark;
  color: #dbe7f1;
  background: #09121e;
  --muted: #9aaec2;
  --line: #25394d;
  --surface: #101f30;
  --accent: #66e0d3;
  --number: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}
body {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(ellipse at 80% -10%, #124050 0%, transparent 52%),
    linear-gradient(#23415344 1px, transparent 1px),
    linear-gradient(90deg, #23415344 1px, transparent 1px),
    linear-gradient(160deg, #101c2c 0%, #0a1421 65%, #0b1725 100%);
  background-size: auto, 32px 32px, 32px 32px, auto;
}
[hidden] { display: none !important; }
header { height: 68px; background: #0a1421f5; border-color: var(--line); }
header nav a.selected { border-color: var(--accent); }
.connection { border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; white-space: nowrap; }
.connection i { background: #889bad; }
.connection.live { color: #a0f4e4; }
.connection.live i { background: var(--accent); box-shadow: 0 0 10px #53dfc888; }
.records-main { max-width: 1720px; margin: 0 auto; padding: 34px 36px 28px; }
.record-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.record-heading h1 { margin: 0 0 8px; color: #f1f7fb; font-size: clamp(24px, 3vw, 34px); letter-spacing: .03em; font-weight: 650; }
.record-heading span, .metrics span, .metrics small { color: var(--muted); font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.metrics article { min-height: 109px; display: grid; align-content: center; gap: 8px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, #142b3d, #101f30 72%); }
.metrics article:first-child { border-top: 2px solid #428e90; }
.metrics strong { color: #f0f8ff; font-size: 26px; line-height: 1.15; font-weight: 600; overflow-wrap: anywhere; }
.metrics article:nth-child(even) strong, .metrics .metric-time { font-family: var(--number); font-variant-numeric: tabular-nums; }
.metrics .metric-time { font-size: clamp(14px, 1.4vw, 19px); }
.metrics strong.active { color: var(--accent); }
.metrics small { font-size: 11px; }
.records-panel { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; overflow: hidden; box-shadow: 0 16px 40px #0003; }
.record-modes { display: flex; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); background: #122235; }
button, select, input { font: inherit; font-size: 12px; border: 1px solid #344b63; border-radius: 6px; color: #dfeaf5; background: #112438; min-height: 34px; padding: 7px 11px; }
button:hover:not(:disabled) { border-color: #5da9ab; background: #1b3749; }
button:disabled { opacity: .38; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.record-modes button { padding: 13px 12px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: transparent; font-size: 14px; }
.record-modes button[aria-pressed="true"] { color: #a3f0e5; border-bottom-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: end; padding: 15px 22px; }
.filters label { display: grid; gap: 7px; font-size: 11px; color: var(--muted); }
.filters input, .filters select { min-width: 112px; max-width: 280px; }
.filters > span { margin: 0 0 9px auto; white-space: nowrap; color: #b7cbdc; font: 12px var(--number); }
#export { background: #164140; border-color: #356767; color: #bcf4e9; }
.batch-notes { margin: 0; padding: 0 22px 12px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.table-scroll { overflow: auto; max-height: min(57vh, 720px); min-height: 220px; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: #1a2d41; color: #c7d8e7; font-size: 11px; font-weight: 600; padding: 12px 14px; border-bottom: 1px solid #375068; }
td { color: #d7e4ef; font-size: 12px; padding: 12px 14px; border-bottom: 1px solid #26394c; }
tbody tr:nth-child(even) { background: #132438; }
tbody tr:hover { background: #1b3347; }
td:first-child, td:nth-child(2), td:nth-child(4), .trigger-number { font-family: var(--number); }
.trigger-number { color: #a3e9de; }
.reason-text { color: #f2d5a3; line-height: 1.55; }
.reason-text + .camera-details { margin-top: 4px; }
.tag { display: inline-block; border-radius: 4px; padding: 3px 7px; font-size: 11px; background: #1a3b4d; color: #afe2ed; }
.result-failed { color: #ffbbb2; background: #482b32; }
.result-success { color: #a0f4cd; background: #1d453e; }
.result-unknown { color: #c0cbd6; background: #2b3b4e; }
.empty { height: 220px; color: var(--muted); text-align: center; }
.event-detail { min-width: 170px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.camera-details summary { color: #99e5dd; cursor: pointer; }
.camera-details dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin: 8px 0 0; }
.camera-details dd { margin: 0; text-align: right; }
.record-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 22px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
#pagination, #jump-form { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#page { white-space: nowrap; padding: 0 5px; }
#jump { width: 64px; font-family: var(--number); }
.record-note { margin: 14px 2px 0; font-size: 11px; color: var(--muted); }
#toast { position: fixed; z-index: 8; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1a3548; color: #ecf6ff; border: 1px solid #466780; border-radius: 7px; padding: 11px 16px; font-size: 13px; box-shadow: 0 8px 25px #0005; }
@media (max-width: 850px) {
  .records-main { padding: 22px 15px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metrics article { min-height: 96px; padding: 10px; }
  .metrics strong { font-size: 20px; }
  .metrics .metric-time { font-size: 13px; }
  .record-modes, .filters, .record-foot { padding-inline: 13px; }
  .filters > span { margin-left: 0; }
  .table-scroll { max-height: 51vh; }
}
@media (max-width: 420px) {
  .connection { padding: 5px 6px; font-size: 9px; }
  header nav { gap: 8px; }
  .record-heading span { font-size: 11px; }
}
