:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-alt: #ebe5d8;
  --ink: #1e2528;
  --muted: #667074;
  --line: #d8d0c2;
  --teal: #0f766e;
  --teal-soft: #d9f0ec;
  --blue: #2563eb;
  --blue-soft: #dce8ff;
  --amber: #b45309;
  --amber-soft: #fff1d6;
  --red: #b42318;
  --red-soft: #ffe4df;
  --green: #287a3e;
  --shadow: 0 18px 40px rgba(30, 37, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.rail {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #20292c;
  color: #eef4f3;
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #d9f0ec;
  color: #0b4c46;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebdbc;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7dfdd;
  cursor: pointer;
  text-align: left;
  padding: 0 12px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(217, 240, 236, 0.14);
  color: #ffffff;
}

.metric-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 20px;
}

.metric-panel div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-value {
  font-size: 28px;
  font-weight: 760;
}

.metric-label {
  color: #b9c7c5;
  font-size: 13px;
}

.camera-panel {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 18px;
}

.camera-panel h2,
.section-heading h2,
.viewer-header h2 {
  margin: 0;
}

.camera-panel h2 {
  font-size: 14px;
}

.camera-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #d7dfdd;
  font-size: 13px;
}

.camera-row span:last-child {
  color: #aebdbc;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: #5dd39e;
}

.status-dot.weak {
  background: #f5b94f;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.top-actions,
.filter-row,
.action-row,
.clip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented,
.filter-chip,
.quiet-button,
.secondary-action,
.primary-action {
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.segmented {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
}

.segmented.active {
  border-color: #1c5c55;
  background: #1f3937;
  color: #ffffff;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.summary-block {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.summary-block.important {
  border-color: #f1b7ac;
  background: var(--red-soft);
}

.summary-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.summary-block strong {
  display: block;
  font-size: 16px;
}

.summary-block p,
.section-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.review-column,
.detail-column {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 18px;
}

.section-heading.compact {
  margin-bottom: 6px;
}

.quiet-button,
.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
}

.filter-chip {
  border: 1px solid transparent;
  background: var(--surface-alt);
  color: #3c474b;
  padding: 0 10px;
  font-size: 13px;
}

.filter-chip.active {
  border-color: #b5d9d3;
  background: var(--teal-soft);
  color: #0b4c46;
}

.event-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(30, 37, 40, 0.04);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.event-card.active {
  border-color: #6bb7ad;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.thumb {
  position: relative;
  overflow: hidden;
  width: 96px;
  height: 70px;
  border-radius: 6px;
  background: #182124;
}

.thumb img {
  width: 192px;
  height: 140px;
  object-fit: cover;
}

.thumb-one img {
  object-position: left top;
}

.thumb-two img {
  object-position: right top;
}

.thumb-three img {
  object-position: left bottom;
}

.thumb-four img {
  object-position: right bottom;
}

.event-main {
  min-width: 0;
}

.event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.event-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.event-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  border-radius: 7px;
  background: #edf0ee;
  color: #425055;
  font-size: 12px;
  padding: 4px 7px;
}

.tag.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.red {
  background: var(--red-soft);
  color: var(--red);
}

.tag.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.viewer,
.insight-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.viewer {
  overflow: hidden;
}

.viewer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.viewer-header h2 {
  margin-top: 7px;
  font-size: 20px;
  line-height: 1.2;
}

.type-pill,
.confidence {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
  padding: 0 8px;
  line-height: 1.25;
  max-width: 230px;
}

.type-pill {
  background: var(--blue-soft);
  color: var(--blue);
}

.confidence.good {
  background: #dff3e4;
  color: var(--green);
}

.confidence.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.confidence.risk {
  background: var(--red-soft);
  color: var(--red);
}

.clip-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #121719;
}

.clip-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-focus {
  position: absolute;
  width: 50%;
  height: 50%;
  border: 3px solid #ffffff;
  box-shadow:
    0 0 0 999px rgba(0, 0, 0, 0.36),
    inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.focus-one {
  top: 0;
  left: 0;
}

.focus-two {
  top: 0;
  right: 0;
}

.focus-three {
  bottom: 0;
  left: 0;
}

.focus-four {
  right: 0;
  bottom: 0;
}

.clip-strip {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.clip-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
}

.clip-button.active {
  border-color: #6bb7ad;
  background: var(--teal-soft);
  color: #0b4c46;
}

.insight-panel {
  margin-top: 14px;
  padding: 16px;
}

.notes-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.notes-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.notes-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.notes-list dd {
  margin: 0;
  line-height: 1.45;
}

.action-row {
  margin-top: 16px;
}

.primary-action {
  border: 0;
  background: var(--teal);
  color: #ffffff;
  padding: 0 14px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.3fr);
    align-items: start;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-panel div {
    display: grid;
    gap: 2px;
  }

  .camera-panel {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .content-grid,
  .summary-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .workspace,
  .rail {
    padding: 16px;
  }

  .rail {
    grid-template-columns: 1fr;
  }

  .nav-list,
  .metric-panel {
    grid-template-columns: 1fr 1fr;
  }

  .topbar,
  .viewer-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .segmented {
    flex: 1 1 auto;
  }

  .event-card {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .thumb {
    width: 80px;
    height: 64px;
  }

  .notes-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
