@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans-semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/open-sans-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --canvas: #0c0c0c;
  --surface: #141414;
  --surface-raised: #1b1b1b;
  --line: #2a2a2a;
  --line-strong: #3b3b3b;
  --text: #ffffff;
  --muted: #a5a5a5;
  --blue: #2da1f4;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
}

html { min-height: 100%; font-size: 16px; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: "Open Sans", Arial, sans-serif;
  letter-spacing: 0;
}

a { color: var(--blue); }
a:hover { color: #72c4ff; }
.library-container { width: min(1180px, calc(100% - 40px)); }
.page-shell { min-height: calc(100vh - 137px); }

.trackcam-nav {
  min-height: 64px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.trackcam-nav .navbar-brand { display: flex; align-items: center; gap: 14px; margin: 0; padding: 13px 0; }
.trackcam-nav .navbar-brand img { display: block; width: 180px; height: auto; }
.trackcam-nav .navbar-brand span { padding-left: 14px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 13px; font-weight: 600; }
.trackcam-nav .nav-link,
.trackcam-nav .nav-link:hover { color: var(--muted); font-size: 13px; }
.trackcam-nav .nav-link:hover { color: var(--text); }
.trackcam-nav .btn-link { text-decoration: none; }
.navbar-toggler { border-color: var(--line-strong); border-radius: 4px; }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgb(45 161 244 / 24%); }
.navbar-toggler-icon { filter: invert(1); }

main { padding: 42px 0 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-heading.compact { margin-bottom: 24px; }
.page-heading h1 { margin: 0; color: var(--text); font-size: 32px; font-weight: 700; line-height: 1.2; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.back-link { display: inline-block; margin-bottom: 10px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back-link::before { content: "\2190\00a0"; }
.back-link:hover { color: var(--text); }

.button,
.btn-primary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button-primary,
.btn-primary { border-color: var(--blue); background: var(--blue); color: #08131a; }
.button-primary:hover,
.btn-primary:hover { border-color: #72c4ff; background: #72c4ff; color: #08131a; }
.button-secondary { border-color: var(--line-strong); background: var(--surface-raised); color: var(--text); }
.button-secondary:hover { border-color: var(--muted); background: #222; color: var(--text); }
.text-action { padding: 8px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; }
.text-action:hover { color: var(--text); }

.empty-library,
.import-intro,
.progress-panel { padding: 42px 0; border-top: 1px solid var(--line); }
.empty-library h2,
.import-intro h2 { margin: 0 0 10px; color: var(--text); font-size: 22px; font-weight: 600; }
.empty-library p,
.import-intro p { max-width: 650px; margin: 0 0 26px; color: var(--muted); line-height: 1.65; }
.library-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.library-summary div { display: flex; min-height: 112px; flex-direction: column; justify-content: center; padding: 20px 24px; border-right: 1px solid var(--line); }
.library-summary div:last-child { border-right: 0; }
.library-summary strong { color: var(--text); font-size: 26px; }
.library-summary span { color: var(--muted); font-size: 14px; }
.session-section { padding-top: 38px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 21px; font-weight: 600; }
.section-heading span { color: var(--muted); font-size: 13px; }
.session-list { border-top: 1px solid var(--line); }
.session-row { display: grid; min-height: 82px; grid-template-columns: minmax(260px, 1.6fr) minmax(210px, 1fr) auto; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.session-name,
.session-counts { display: flex; flex-direction: column; gap: 3px; }
.session-name span,
.session-counts span { color: var(--muted); font-size: 13px; }
.session-row .button { min-width: 76px; }
.session-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 38px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.session-summary div { display: flex; min-height: 92px; flex-direction: column; justify-content: center; padding: 18px 22px; border-right: 1px solid var(--line); }
.session-summary div:last-child { border-right: 0; }
.session-summary strong { font-size: 23px; }
.session-summary span { color: var(--muted); font-size: 13px; }
.recording-ledger { padding-top: 4px; }
.recording-list { border-top: 1px solid var(--line); }
.recording-row { display: grid; min-height: 78px; grid-template-columns: minmax(220px, 1.6fr) minmax(190px, 1fr) auto auto; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.recording-diagnostic { grid-column: 1 / -1; margin: -12px 0 14px; color: var(--amber); font-size: 13px; overflow-wrap: anywhere; }
.recording-open { min-width: 86px; }
.recording-name,
.recording-meta { display: flex; flex-direction: column; gap: 3px; }
.recording-name strong { overflow-wrap: anywhere; }
.recording-name span,
.recording-meta span { color: var(--muted); font-size: 13px; }

.import-room { display: grid; grid-template-columns: minmax(280px, 410px) 1fr; gap: 64px; padding-top: 10px; }
.qr-panel { text-align: center; }
.qr-code { width: min(100%, 360px); margin: 0 auto 18px; padding: 18px; border: 1px solid #d5d5d5; border-radius: 4px; background: #fff; }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-panel p { margin: 0 0 4px; font-weight: 700; }
.qr-panel span { color: var(--muted); font-size: 14px; }
.import-actions { padding-top: 32px; }
.import-actions h2 { margin-bottom: 12px; font-size: 24px; font-weight: 600; }
.import-actions p { max-width: 520px; color: var(--muted); line-height: 1.65; }
.import-actions form { margin-top: 28px; }
.import-modal .modal-dialog { width: min(calc(100% - 24px), 460px); }
.import-modal .modal-content { border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.import-modal .modal-header,
.import-modal .modal-footer { border-color: var(--line); }
.import-modal .modal-title { font-size: 21px; font-weight: 600; }
.import-modal .modal-body { padding: 24px; text-align: center; }
.import-modal .modal-body .qr-code { width: min(100%, 340px); }
.import-modal .modal-body p { margin: 0 0 4px; font-weight: 700; }
.import-modal .modal-body span { color: var(--muted); font-size: 14px; }

.progress-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.progress-heading h2 { margin: 0; font-size: 21px; font-weight: 600; }
.quiet-status,
.empty-state { color: var(--muted); font-size: 14px; }
.camera-list { margin-bottom: 28px; border-top: 1px solid var(--line); }
.camera-row { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.camera-row div { display: flex; flex-direction: column; }
.camera-row div span { color: var(--muted); font-size: 13px; }
.status { font-weight: 700; text-transform: capitalize; }
.status-received { color: var(--green); }
.status-attention { color: var(--amber); }

.analysis-summary { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.analysis-summary div { display: flex; min-height: 92px; flex-direction: column; justify-content: center; padding: 18px 22px; border-right: 1px solid var(--line); }
.analysis-summary div:last-child { border-right: 0; }
.analysis-summary strong { font-size: 22px; }
.analysis-summary span { color: var(--muted); font-size: 13px; }
.analysis-context { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 18px 0 32px; color: var(--muted); font-size: 13px; }
.analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.analysis-panel { min-height: 260px; padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.analysis-panel-wide { grid-column: 1 / -1; min-height: 300px; }
.analysis-chart { display: block; width: 100%; height: 210px; }
.chart-grid { fill: none; stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-speed { stroke: var(--blue); }
.chart-motion { stroke: var(--amber); }
.route-chart { display: block; width: 100%; height: 210px; }
.route-line { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.analysis-empty { max-width: 520px; margin: 42px 0 0; color: var(--muted); line-height: 1.6; }
.evidence-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 14px 0 0; padding: 0; list-style: none; }
.evidence-list li { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; text-transform: capitalize; }
.corner-table { margin-top: 8px; border-top: 1px solid var(--line); }
.corner-row { display: grid; min-height: 48px; grid-template-columns: 80px minmax(120px, 1fr) repeat(3, minmax(90px, .7fr)); align-items: center; gap: 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.corner-row span { color: var(--muted); }
.corner-heading { min-height: 38px; color: var(--muted); font-size: 12px; text-transform: uppercase; }

.footer { min-height: 73px; padding: 24px 0; border-top: 1px solid var(--line); background: var(--surface); color: #737373; font-size: 13px; }
.footer .container { display: flex; justify-content: space-between; }
.footer a { color: #8a8a8a; }

/* Identity's generated pages inherit the same quiet tool surface. */
.form-control,
.form-select { border-color: var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--text); }
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus { border-color: var(--blue); background: var(--surface-raised); color: var(--text); box-shadow: 0 0 0 3px rgb(45 161 244 / 22%); }
.form-floating > label { color: var(--muted); }
.form-check-input { border-color: var(--line-strong); background-color: var(--surface); }
.form-check-input:checked { border-color: var(--blue); background-color: var(--blue); }
.text-danger { color: #ff7676 !important; }
hr { border-color: var(--line); opacity: 1; }

.account-heading,
.account-panel { width: min(100%, 560px); }
.account-panel { padding-top: 4px; }
.account-submit { width: 100%; }
.account-links { display: flex; justify-content: space-between; gap: 18px; margin-top: 20px; font-size: 14px; }
.account-links a { color: var(--muted); }
.account-links a:hover { color: var(--text); }

@media (max-width: 720px) {
  .library-container { width: min(100% - 24px, 1180px); }
  .trackcam-nav .navbar-brand img { width: 150px; }
  .trackcam-nav .navbar-brand span { padding-left: 10px; }
  .trackcam-nav .navbar-collapse { padding: 8px 0 14px; border-top: 1px solid var(--line); }
  main { padding: 28px 0 48px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 26px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading .button { align-self: flex-start; }
  .library-summary { grid-template-columns: 1fr; }
  .library-summary div { min-height: 84px; border-right: 0; border-bottom: 1px solid var(--line); }
  .library-summary div:last-child { border-bottom: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .session-row { grid-template-columns: 1fr auto; gap: 10px 16px; padding: 16px 0; }
  .session-counts { grid-column: 1; }
  .session-row .button { grid-column: 2; grid-row: 1 / span 2; }
  .session-summary { grid-template-columns: repeat(3, 1fr); }
  .session-summary div { min-height: 78px; padding: 12px; }
  .import-room { grid-template-columns: 1fr; gap: 14px; }
  .import-actions { padding-top: 10px; }
  .camera-row { align-items: flex-start; flex-direction: column; padding: 16px 0; gap: 8px; }
  .progress-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .recording-row { grid-template-columns: 1fr auto; gap: 10px 16px; padding: 16px 0; }
  .recording-meta { grid-column: 1; }
  .recording-row > .status { grid-column: 2; grid-row: 1; }
  .recording-open { grid-column: 2; grid-row: 2; }
  .analysis-summary { grid-template-columns: repeat(2, 1fr); }
  .analysis-summary div { min-height: 76px; padding: 12px; border-bottom: 1px solid var(--line); }
  .analysis-summary div:nth-child(2) { border-right: 0; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-panel-wide { grid-column: auto; }
  .analysis-panel { min-height: 230px; padding: 18px; }
  .analysis-chart, .route-chart { height: 180px; }
  .corner-row { grid-template-columns: 54px 1fr repeat(3, 58px); gap: 8px; }
  .account-links { align-items: flex-start; flex-direction: column; gap: 10px; }
}
.recording-video { position: relative; margin: 0 0 24px; overflow: hidden; background: #080a0c; }
.recording-video video { display: block; width: 100%; max-height: 72vh; background: #000; }
.chart-fps { stroke: var(--green); }
.telemetry-overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; color: #fff; text-shadow: 0 2px 7px rgb(0 0 0 / 90%); }
.telemetry-overlay[hidden] { display: none; }
.telemetry-speed { position: absolute; top: clamp(12px, 3%, 28px); left: clamp(12px, 3%, 28px); display: flex; align-items: baseline; gap: 7px; }
.telemetry-speed strong { font-size: clamp(28px, 5vw, 64px); font-variant-numeric: tabular-nums; line-height: 1; }
.telemetry-speed span, .telemetry-readings { font-size: clamp(11px, 1.6vw, 18px); font-weight: 600; text-transform: uppercase; }
.telemetry-readings { position: absolute; top: clamp(14px, 4%, 30px); right: clamp(12px, 3%, 28px); display: flex; gap: clamp(12px, 2.5vw, 30px); font-variant-numeric: tabular-nums; }
.telemetry-vertical { position: absolute; left: clamp(12px, 3%, 28px); bottom: clamp(48px, 9%, 76px); display: flex; gap: clamp(18px, 3vw, 34px); height: min(34%, 190px); }
.telemetry-gauge { display: grid; width: clamp(54px, 7vw, 82px); grid-template-rows: auto 1fr auto; justify-items: center; gap: 5px; font-size: clamp(9px, 1.2vw, 12px); font-weight: 600; text-transform: uppercase; }
.telemetry-gauge-line { position: relative; width: 2px; min-height: 54px; background: rgb(255 255 255 / 68%); }
.telemetry-gauge-line::after { position: absolute; top: 50%; left: -5px; width: 12px; height: 2px; background: #fff; content: ""; }
.telemetry-gauge-line i { position: absolute; top: 50%; left: 50%; width: clamp(11px, 1.5vw, 17px); aspect-ratio: 1; border: 2px solid #fff; border-radius: 50%; background: var(--blue); transform: translate(-50%, -50%); transition: top 120ms linear; }
.telemetry-gauge strong { font-size: clamp(10px, 1.4vw, 14px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.telemetry-route { position: absolute; right: clamp(12px, 3%, 28px); bottom: clamp(48px, 9%, 76px); width: min(28%, 280px); height: min(34%, 190px); overflow: visible; filter: drop-shadow(0 2px 4px rgb(0 0 0 / 80%)); }
.telemetry-route path { fill: none; stroke: rgb(255 255 255 / 72%); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.telemetry-route line { stroke: #fff; stroke-width: 8; vector-effect: non-scaling-stroke; }
.telemetry-route circle { fill: var(--blue); stroke: #fff; stroke-width: 7; vector-effect: non-scaling-stroke; }
.telemetry-toggle { position: absolute; right: 10px; bottom: 10px; z-index: 3; min-height: 36px; padding: 7px 12px; border: 1px solid rgb(255 255 255 / 55%); border-radius: 4px; background: rgb(8 10 12 / 76%); color: #fff; font-size: 12px; font-weight: 600; }
.telemetry-toggle[aria-pressed="false"] { color: rgb(255 255 255 / 62%); }
@media (max-width: 560px) {
  .telemetry-route { width: 34%; height: 30%; }
  .telemetry-vertical { height: 30%; }
  .telemetry-readings { flex-direction: column; gap: 2px; text-align: right; }
}
.video-pending { margin: 0 0 24px; padding: 12px 14px; border-left: 4px solid var(--amber, #f0a51a); background: #f7f4ec; color: #3c3527; }
