@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Source+Sans+3:ital,wght@0,400;0,600;1,400;1,700&display=swap');

*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.app {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px;
  color: #111;
  background: #fff;
  width: 100%;
}

/* HEADER */
.hdr {
  position: relative;
  height: 90px;
  background: linear-gradient(rgba(15,10,5,0.42),rgba(15,10,5,0.50)),
    url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?w=1200&q=60') center/cover no-repeat;
  background-color: #3a2710;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hdr-inner {
  position: relative;
  z-index: 1;
}

.hdr-title {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 2.2rem;
  color: #fff;
  font-style: italic;
  font-weight: 700;
  letter-spacing: .06em;
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
  line-height: 1;
  margin-bottom: 4px;
}

.hdr-sub {
  font-size: .68rem;
  color: rgba(255,255,255,.88);
  font-style: italic;
  letter-spacing: .01em;
}

/* NAVBAR */
.nav {
  position: relative;
  display: flex;
  justify-content: center;
  background: #fff;
  border-bottom: 1px solid #c5c5c5;
  padding: 0;
}

.nb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  padding: 6px 28px 5px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 500;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.notification-btn {
  position: absolute;
  right: 18px;
  top: 0;
  padding: 6px 12px 5px;
  color: #555;
}

.notification-btn.has-active-alerts {
  color: #a63d12;
}

.notification-btn.has-critical-alerts {
  color: #b42318;
}

.notification-badge {
  position: absolute;
  top: 3px;
  right: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #c2410c;
  font-size: .6rem;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}

.notification-btn.has-critical-alerts .notification-badge {
  background: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .16);
}

.notification-panel {
  position: absolute;
  right: 12px;
  top: 92px;
  display: none;
  flex-direction: column;
  width: min(720px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 108px));
  overflow: hidden;
  background: #fff;
  border: 1px solid #d5dfd8;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
  padding: 0;
  z-index: 1200;
}

.notification-panel.show {
  display: flex;
}

.notification-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5ece7;
  background: #f8fbf9;
}

.notification-eyebrow {
  color: #5e7667;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.notification-header h2 {
  margin: 2px 0 1px;
  color: #173c29;
  font-size: 1rem;
}

.notification-header p {
  color: #53675a;
  font-size: .72rem;
}

.notification-refresh,
.notification-error button {
  border: 1px solid #b9cec0;
  border-radius: 6px;
  padding: 6px 10px;
  color: #245b45;
  background: #fff;
  font: inherit;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
}

.notification-refresh:hover,
.notification-error button:hover {
  background: #edf6f0;
}

.notification-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #e5ece7;
}

.notification-filters label {
  display: grid;
  gap: 4px;
  color: #52657a;
  font-size: .65rem;
  font-weight: 700;
}

.notification-filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd8cf;
  border-radius: 6px;
  padding: 6px 7px;
  color: #26382d;
  background: #fff;
  font: inherit;
  font-size: .68rem;
}

.notification-list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 18px 7px;
}

.notification-list-header h3 {
  color: #26382d;
  font-size: .76rem;
}

.notification-list-header span {
  color: #65766d;
  font-size: .64rem;
}

.notification-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  min-height: 100px;
  padding: 4px 18px 16px;
}

.notification-empty {
  padding: 24px 14px;
  font-size: 0.76rem;
  color: #64748b;
  text-align: center;
}

.notification-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e3e9e4;
  border-left: 4px solid #c78320;
  border-radius: 8px;
  background: #fffdf8;
}

.notification-item.notification-critical {
  border-left-color: #b42318;
  background: #fff8f6;
}

.notification-item.is-active {
  box-shadow: inset 0 0 0 1px rgba(163, 61, 18, .08);
}

.notification-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.notification-source {
  color: #53675a;
  font-size: .63rem;
  font-weight: 700;
}

.notification-severity {
  border-radius: 999px;
  padding: 2px 7px;
  color: #7a4b08;
  background: #fff0c2;
  font-size: .59rem;
  text-transform: uppercase;
}

.notification-critical .notification-severity {
  color: #8d2119;
  background: #fee4e2;
}

.notification-item time {
  margin-left: auto;
  color: #6b7280;
  font-size: .62rem;
}

.notification-item p {
  color: #29352e;
  font-size: .72rem;
  line-height: 1.4;
}

.notification-active-label {
  color: #a63d12;
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.notification-limit-note {
  padding: 6px 2px;
  color: #65766d;
  font-size: .66rem;
  text-align: center;
}

.notification-error {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  color: #8d2119;
  background: #fff8f6;
  font-size: .72rem;
  text-align: center;
}

.nb:hover {
  color: #222;
}

.nb.on {
  color: #1a56db;
  border-bottom-color: #1a56db;
}

.nb svg {
  display: block;
  margin-bottom: 1px;
}

/* PAGES */
.pg {
  display: none;
  padding: 12px 14px;
}

.pg.on {
  display: block;
}

.hide {
  display: none !important;
}

/* DASHBOARD */
.db-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.db-panel {
  border: 1px solid #dfe6ee;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid #e3ebf4;
  background: rgba(249, 250, 251, 0.9);
}

.panel-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
  color: #5b6b7a;
  font-weight: 700;
}

.panel-title-wrap h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #17212b;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  min-height: 28px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #edf2f7;
  color: #3d4c5f;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 18px 0;
}

.compact-panel-body {
  padding-bottom: 2px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.single-column {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}

.metric-item {
  background: #ffffff;
  border: 1px solid #e7ecf1;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.62rem;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.metric-item strong {
  font-size: 0.82rem;
  color: #0f172a;
}

.sensor-detail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px 10px;
}

.sensor-detail {
  color: #49576b;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sensor-group-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.sensor-group-hint {
  color: #82909a;
  font-size: .63rem;
}

.sensor-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sensor-filter-button {
  min-width: 42px;
  padding: 5px 9px;
  border: 1px solid #d8e3de;
  border-radius: 999px;
  color: #596c63;
  background: #fff;
  font-family: inherit;
  font-size: .65rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}

.sensor-filter-button:hover {
  border-color: #a5c9b5;
  transform: translateY(-1px);
}

.sensor-filter-button.is-active {
  border-color: #246149;
  color: #fff;
  background: #246149;
}

.sensor-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.substrate-probe-card {
  display: flex;
  min-width: 0;
  min-height: 86px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid #e2ebe6;
  border-radius: 11px;
  text-align: left;
  background: linear-gradient(145deg, #fff 0%, #f6faf7 100%);
}

.substrate-probe-id {
  color: #597166;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
}

.substrate-probe-card strong {
  color: #1c372c;
  font-size: .93rem;
  font-variant-numeric: tabular-nums;
}

.substrate-probe-detail {
  max-width: 100%;
  overflow: hidden;
  color: #83918a;
  font-size: .58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.substrate-probe-status {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: .56rem;
  font-weight: 700;
}

.substrate-probe-status.is-optimal {
  color: #246149;
  background: #e6f4eb;
}

.substrate-probe-status.is-dry {
  color: #88521b;
  background: #fff1d9;
}

.substrate-probe-status.is-wet {
  color: #285a82;
  background: #e3f1fc;
}

.gas-reading-raw {
  color: #78868e;
  font-size: .65rem;
  font-weight: 500;
}

.gas-estimate-notice {
  margin-top: 2px;
  color: #8b6530;
  font-size: .63rem;
  line-height: 1.45;
}

.site-footer {
  border-top: 1px solid #dfe6ee;
  background: #f8fafc;
  padding: 12px 18px;
  color: #70542d;
  font-size: .68rem;
  line-height: 1.5;
}

.db-desc {
  padding: 12px 18px 18px;
}

.db-dlbl {
  font-size: 0.65rem;
  color: #52657a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.db-dbody {
  font-size: 0.82rem;
  color: #49576b;
  line-height: 1.5;
  min-height: 28px;
}

.condition-alert-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.condition-alert {
  padding: 7px 10px;
  border-left: 3px solid #d69a22;
  border-radius: 4px;
  background: #fff8e8;
}

.condition-alert-critical {
  border-left-color: #c62828;
  background: #fff0f0;
  color: #7d2020;
  font-weight: 600;
}

.visualization-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: start;
  gap: 12px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #dfe6ee;
  border-radius: 16px;
  background: #f8fafc;
}

.visualization-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.visualization-header h2 {
  margin: 3px 0 4px;
  color: #17212b;
  font-size: 1.15rem;
}

.visualization-note,
.chart-heading p,
.chart-range-note {
  color: #64748b;
  font-size: .7rem;
  line-height: 1.45;
}

.visualization-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.visualization-controls label {
  color: #52657a;
  font-size: .7rem;
  font-weight: 700;
}

.visualization-controls .rpt-sel {
  margin: 0;
  padding: 7px 9px;
}

.visualization-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: 8px 0 12px;
  color: #52657a;
  font-size: .68rem;
}

.chart-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0 0 2px;
  color: #52657a;
  font-size: .68rem;
  list-style: none;
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 24px;
  height: 10px;
}

.legend-reading {
  height: 0;
  border-top: 3px solid #2364d2;
}

.legend-alert {
  height: 0;
  border-top: 3px solid #c73535;
}

.legend-target {
  border: 1px solid #b7ddc4;
  border-radius: 2px;
  background: #dff2e6;
}

.legend-reference {
  height: 0;
  border-top: 3px solid #398b59;
}

.sensor-chart-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sensor-chart-card,
.classification-chart-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.sensor-chart-card.has-attention {
  border-color: #edb4b4;
}

.sensor-chart-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sensor-chart-card h3,
.chart-heading h3 {
  margin: 0;
  color: #334155;
  font-size: .78rem;
  font-weight: 700;
}

.chart-latest-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.25;
}

.chart-latest-status.is-on-target {
  color: #17633b;
  background: #e5f4eb;
}

.chart-latest-status.needs-attention {
  color: #a52424;
  background: #fde8e8;
}

.chart-latest-status.status-unavailable {
  color: #64748b;
  background: #eef2f6;
}

.sensor-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
  overflow: visible;
}

.chart-target-band {
  fill: #dff2e6;
}

.chart-grid-line {
  stroke: #e7edf3;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #718096;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 11px;
}

.chart-line-segment {
  stroke: #2364d2;
  stroke-linecap: round;
  stroke-width: 2.25;
}

.chart-line-segment.is-outside {
  stroke: #c73535;
}

.chart-point {
  fill: #2364d2;
  stroke: #fff;
  stroke-width: 1;
}

.chart-point.is-outside {
  fill: #c73535;
}

.chart-point.is-latest {
  stroke-width: 1.5;
}

.chart-threshold-line {
  stroke: #398b59;
  stroke-width: 1.5;
}

.chart-threshold-label {
  fill: #267246;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.chart-range-note {
  margin-top: 2px;
}

.chart-empty {
  padding: 38px 12px;
  color: #718096;
  font-size: .72rem;
  text-align: center;
}

.classification-chart-panel {
  grid-column: 1 / -1;
  margin-top: 0;
}

.reading-range-panel {
  grid-column: 1 / -1;
  grid-row: 5;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-heading p {
  margin-top: 3px;
}

.latest-camera-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.camera-check-card {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.camera-check-card h4 {
  color: #334155;
  font-size: .76rem;
}

.camera-check-time,
.camera-check-empty {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: .65rem;
}

.camera-check-predictions {
  display: grid;
  gap: 5px;
  margin: 10px 0;
  padding-left: 18px;
  color: #52657a;
  font-size: .69rem;
}

.camera-check-predictions strong {
  color: #25364a;
}

.camera-check-review {
  display: inline-block;
  margin-top: 9px;
  color: #1a56db;
  font-size: .68rem;
  font-weight: 700;
}

.reading-range-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 0 0 12px;
  padding: 0;
  color: #52657a;
  font-size: .65rem;
  list-style: none;
}

.reading-range-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.range-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.class-good {
  background: #438867;
}

.class-bad {
  background: #c94b4b;
}

.class-green-mold {
  background: #d97706;
}

.class-mucor {
  background: #8055a5;
}

.class-mold {
  background: #8055a5;
}

.class-other {
  background: #2563a8;
}

.range-disagreement {
  background: #d97706;
}

.range-unavailable {
  background: #cbd5e1;
}

.reading-range-chart {
  display: grid;
  gap: 12px;
}

.reading-range-row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(140px, 1fr) minmax(220px, 290px);
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f5;
}

.reading-range-label {
  color: #334155;
  font-size: .68rem;
  font-weight: 600;
}

.substrate-row-heading {
  display: grid;
  gap: 3px;
}

.substrate-row-probe-label,
.substrate-chart-status {
  color: #64748b;
  font-size: .63rem;
}

.substrate-row-chart-content {
  min-width: 0;
}

.reading-range-track {
  display: flex;
  min-height: 26px;
  overflow: hidden;
  border-radius: 6px;
  background: #edf2f7;
}

.reading-range-segment {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  white-space: nowrap;
}

.reading-range-segment.range-within {
  background: #438867;
}

.reading-range-segment.class-good {
  background: #438867;
}

.reading-range-segment.class-bad {
  background: #c94b4b;
}

.reading-range-segment.class-green-mold {
  background: #d97706;
}

.reading-range-segment.class-mucor {
  background: #8055a5;
}

.reading-range-segment.class-mold {
  background: #8055a5;
}

.reading-range-segment.class-other {
  background: #2563a8;
}

.reading-range-segment.range-disagreement {
  background: #d97706;
}

.reading-range-segment.range-unavailable {
  color: #334155;
  background: #cbd5e1;
}

.substrate-classification-summary {
  margin-top: 5px;
  color: #64748b;
  font-size: .63rem;
  line-height: 1.35;
}

.substrate-row-sensors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.substrate-reading {
  min-width: 0;
}

.substrate-reading-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  color: #52657a;
  font-size: .63rem;
}

.substrate-reading-value {
  color: #286b4b;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.substrate-reading-value.is-outside {
  color: #b45309;
}

.substrate-reading-track {
  position: relative;
  height: 10px;
  margin: 4px 2px;
  border-radius: 99px;
  background: #edf2f7;
}

.substrate-reading-target {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: inherit;
  background: #b7ddc4;
}

.substrate-reading-marker {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 14px;
  border: 1px solid #fff;
  border-radius: 2px;
  background: #2364d2;
  box-shadow: 0 0 0 1px #2364d2;
  transform: translateX(-50%);
}

.substrate-reading-marker.is-outside {
  background: #d97706;
  box-shadow: 0 0 0 1px #d97706;
}

.substrate-reading-range {
  color: #718096;
  font-size: .57rem;
}

.live-output-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #dfe6ee;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.compact-header {
  padding-top: 14px;
  padding-bottom: 12px;
}

.output-badge {
  display: inline-flex;
  border-radius: 999px;
  background: #eef2ff;
  color: #3b4cf5;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 6px 10px;
}

.live-output-body {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 0.8fr);
  gap: 18px;
  padding: 18px;
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.camera-card {
  border: 1px solid #dfeaf5;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.camera-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #52657a;
  background: #f6f9fc;
  border-bottom: 1px solid #e3ebf4;
  padding: 10px 12px;
}

.camera-action {
  border: 1px solid #d5dfec;
  background: #fff;
  color: #20314a;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.camera-feed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eef5fb;
  border-bottom: 1px solid #e3ebf4;
  overflow: hidden;
}

.camera-feed-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: transparent;
}

.camera-feed-wrap img[src] {
  display: block;
}

.camera-view-toggle {
  display: flex;
  gap: 6px;
  padding: 8px 12px 0;
  background: #fff;
}

.camera-view-button {
  border: 1px solid #d5dfec;
  background: #fff;
  color: #52657a;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
}

.camera-view-button.is-active {
  border-color: #1a56db;
  background: #eaf1ff;
  color: #1a56db;
}

.camera-view-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.camera-meta {
  padding: 10px 12px 6px;
  font-size: 0.75rem;
  color: #44556a;
  font-weight: 700;
}
.camera-last {
  padding: 0 12px 12px;
  font-size: 0.72rem;
  color: #6b7280;
  font-weight: 600;
}

.runtime-info {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #e3ebf4;
  border-radius: 8px;
  background: #f8fafc;
  color: #52657a;
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.image-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #52657a;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(238, 245, 251, 0.94);
  text-align: center;
  padding: 12px;
  letter-spacing: 0.04em;
}

.camera-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 28px;
}

.camera-modal.show {
  display: flex;
}

.camera-modal-inner {
  position: relative;
  width: min(92vw, 1400px);
  max-height: 90vh;
  background: #0f172a;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.camera-modal-inner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  background: #000;
}

.camera-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255,255,255,0.9);
  color: #111827;
}

.camera-modal-label {
  position: absolute;
  left: 16px;
  top: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}


.live-output-summary {
  border: 1px solid #e3ebf4;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
}

.summary-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 10px;
}

.summary-text {
  color: #243244;
  font-size: 0.9rem;
  line-height: 1.7;
}

.debug-classifier-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.debug-classifier-controls button,
.debug-classifier-controls select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.debug-classifier-output {
  display: none;
  max-width: 100%;
  margin-top: 12px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .db-grid {
    grid-template-columns: 1fr;
  }

  .live-output-body {
    grid-template-columns: 1fr;
  }

  .mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rpt-observation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sensor-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visualization-section {
    display: block;
  }

  .classification-chart-panel {
    margin-top: 12px;
  }

  .latest-camera-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reading-range-panel {
    margin-top: 12px;
  }

  .reading-range-row {
    grid-template-columns: minmax(100px, 150px) minmax(0, 1fr);
  }

  .substrate-row-sensors {
    grid-column: 1 / -1;
  }

  .visualization-header {
    flex-direction: column;
  }

  .visualization-controls {
    justify-content: flex-start;
  }

  #pg-report .toolbar,
  #pg-report .tb-left,
  #pg-report .tb-right {
    flex-wrap: wrap;
  }

  #pg-report .toolbar {
    align-items: flex-start;
  }

  #pg-report .tb-right {
    margin-left: auto;
  }
}

@media (max-width: 540px) {
  .mini-metrics {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rpt-observation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visualization-section {
    padding: 12px;
  }

  .sensor-chart-grid,
  .latest-camera-checks {
    grid-template-columns: 1fr;
  }

  .reading-range-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .reading-range-track {
    min-height: 24px;
  }

  .substrate-row-sensors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
  min-height: 26px;
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sbar {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  padding: 2px 7px;
  background: #fff;
  height: 24px;
}

.sbar input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: .70rem;
  width: 110px;
  color: #222;
  background: transparent;
}

.vtog {
  display: flex;
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  overflow: hidden;
  height: 24px;
}

.vt {
  background: #fff;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: #777;
  display: flex;
  align-items: center;
  transition: background .12s, color .12s;
}

.vt + .vt {
  border-left: 1px solid #b0b0b0;
}

.vt.on {
  background: #dbeafe;
  color: #1a56db;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  color: #333;
  padding: 3px 6px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.back-btn:hover {
  background: #f0f0f0;
}

.rpt-sel {
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  padding: 2px 18px 2px 7px;
  font-family: inherit;
  font-size: .72rem;
  color: #222;
  background: #fff;
  cursor: pointer;
  height: 24px;
  appearance: auto;
}

.dl-btn {
  background: #fff;
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  padding: 3px 6px;
  cursor: pointer;
  color: #444;
  display: flex;
  align-items: center;
  height: 24px;
}

.dl-btn:hover {
  background: #f3f3f3;
}

/* OBSERVATION: FOLDERS */
.obs-folders {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 2px;
}

.obs-month-group {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 12px 12px;
}

.obs-group-header {
  font-size: 0.68rem;
  color: #56657a;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

.obs-date-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.folder {
  border: 1px solid #dfe5ee;
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 10px 8px;
  transition: background .12s, border-color .12s, transform .12s;
  user-select: none;
  width: 92px;
  min-height: 92px;
  font-family: inherit;
}

.folder:hover {
  background: #f5f9ff;
  border-color: #a9c9ff;
  transform: translateY(-1px);
}

.folder svg {
  width: 52px;
  height: 44px;
}

.folder span {
  font-size: .68rem;
  color: #222;
  font-weight: 600;
  text-align: center;
}

.obs-date-card {
  padding: 12px 10px;
}

.obs-date-day {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: #111827;
}

.obs-date-month {
  font-size: 0.66rem;
  color: #5b6b7a;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.obs-date-card small {
  font-size: 0.62rem;
  color: #64748b;
  margin-top: 2px;
}

.obs-imgview {
  padding: 2px 0;
}

.obs-imggrid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 4px;
}

.obs-thumb {
  width: 76px;
  height: 64px;
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  overflow: hidden;
  background: #e0dcd6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: border-color .12s;
  flex-direction: column;
  gap: 2px;
}

.obs-thumb:hover {
  border-color: #1a56db;
}

.obs-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.obs-tlbl {
  font-size: .56rem;
  color: #555;
  text-align: center;
  padding: 1px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.obs-empty {
  color: #999;
  font-size: .76rem;
  font-style: italic;
  padding: 16px 0;
}

.obs-load-more {
  display: block;
  margin: 12px auto;
  padding: 8px 14px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  color: #245b45;
  background: #f5faf7;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}

.obs-load-more:hover {
  background: #e7f3ec;
}

.obs-gallery {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 16, 24, 0.82);
}

.obs-gallery-shell {
  display: flex;
  flex-direction: column;
  width: min(1440px, 100%);
  max-height: min(900px, 94vh);
  overflow: hidden;
  color: #17212b;
  background: #f7f9fb;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

.obs-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  color: #f7fafc;
  background: #183b31;
}

.obs-gallery-header h2 {
  margin-top: 2px;
  font-size: 1.25rem;
}

.obs-gallery-eyebrow {
  color: #b9d5ca;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.obs-gallery-date {
  margin-top: 3px;
  color: #d4e3dc;
  font-size: .75rem;
}

.obs-gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.obs-gallery-position {
  color: #e2eee8;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.obs-gallery-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  font-size: 1.5rem;
  cursor: pointer;
}

.obs-gallery-close:hover {
  background: rgba(255, 255, 255, .2);
}

.obs-gallery-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 0;
  overflow: hidden;
}

.obs-gallery-viewer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  background: #111a20;
}

.obs-gallery-stage {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 250px;
  place-items: center;
  overflow: hidden;
  background: #080c0f;
  border-radius: 10px;
}

.obs-gallery-stage img {
  display: block;
  max-width: 100%;
  max-height: min(64vh, 680px);
  object-fit: contain;
}

.obs-gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  width: 44px;
  height: 52px;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 10px;
  color: white;
  background: rgba(12, 20, 25, .72);
  font-size: 2rem;
  cursor: pointer;
}

.obs-gallery-arrow:hover:not(:disabled) {
  background: #23634e;
}

.obs-gallery-arrow:disabled {
  opacity: .35;
  cursor: default;
}

.obs-gallery-prev {
  left: 12px;
}

.obs-gallery-next {
  right: 12px;
}

.obs-gallery-image-error {
  position: absolute;
  color: #fff;
  font-size: .85rem;
}

.obs-gallery-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 8px;
  color: #e2e8ec;
  font-size: .7rem;
}

.obs-gallery-caption span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.obs-gallery-caption span:last-child {
  flex: 0 0 auto;
  color: #9daeb7;
}

.obs-gallery-thumbnails {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 1px 2px;
}

.obs-gallery-thumbnail {
  flex: 0 0 70px;
  height: 54px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #26343c;
  cursor: pointer;
}

.obs-gallery-thumbnail[aria-current="true"] {
  border-color: #a2d8bd;
}

.obs-gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
}

.obs-gallery-details {
  min-width: 0;
  overflow-y: auto;
  padding: 20px 18px;
  background: #fff;
  border-left: 1px solid #e0e6e8;
}

.obs-gallery-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 13px;
  border-bottom: 1px solid #e5ebed;
}

.obs-gallery-detail-heading .obs-gallery-eyebrow {
  color: #536a61;
}

.obs-gallery-type {
  padding: 4px 8px;
  border-radius: 999px;
  color: #245b45;
  background: #e7f3ec;
  font-size: .62rem;
  font-weight: 700;
}

.obs-gallery-metadata {
  margin: 2px 0 16px;
}

.obs-gallery-metadata > div {
  padding: 10px 0;
  border-bottom: 1px solid #edf0f1;
}

.obs-gallery-metadata dt {
  margin-bottom: 3px;
  color: #71808a;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.obs-gallery-metadata dd {
  overflow-wrap: anywhere;
  color: #1e2b32;
  font-size: .77rem;
  font-weight: 600;
}

.obs-gallery-detections h3 {
  margin-bottom: 9px;
  color: #22343d;
  font-size: .8rem;
}

.obs-gallery-class-list {
  display: grid;
  gap: 7px;
}

.obs-gallery-class-item,
.obs-gallery-no-detections {
  padding: 9px 10px;
  border: 1px solid #e4ebea;
  border-radius: 8px;
  background: #f7faf9;
  font-size: .71rem;
}

.obs-gallery-class-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.obs-gallery-class-item span:last-child {
  color: #286147;
  font-weight: 700;
  white-space: nowrap;
}

.obs-gallery-no-detections,
.obs-gallery-note {
  color: #68767d;
}

.obs-gallery-note {
  margin-top: 16px;
  font-size: .66rem;
  line-height: 1.5;
}

/* REPORT */
.rpt-description {
  margin: -2px 0 10px;
  color: #627268;
  font-size: .72rem;
  line-height: 1.45;
}

#pg-report .toolbar,
#pg-report .tb-left,
#pg-report .tb-right {
  flex-wrap: wrap;
}

#pg-report .tb-right {
  margin-left: auto;
}

.addid-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.addid-lbl {
  font-size: .72rem;
  font-weight: 700;
  color: #222;
}

.addid-inp {
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: .72rem;
  width: 140px;
  outline: none;
  height: 24px;
}

.addid-inp[type="date"] {
  width: 110px;
}

.rpt-wrap {
  border: 1px solid #d9e2dc;
  border-radius: 10px;
  background: #fff;
  overflow-x: auto;
}

.rpt-observations-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.rpt-observations-wrap > .rpt-wrap {
  width: 100%;
  min-width: 0;
}

.rpt-observation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rpt-observation-summary-note {
  margin: 0;
  color: #65766d;
  font-size: .7rem;
  line-height: 1.45;
}

.rpt-observation-tabs {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dfe8e2;
}

.rpt-observation-tab {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: #52657a;
  background: transparent;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
}

.rpt-observation-tab:hover {
  color: #245b45;
  background: #f3f8f4;
}

.rpt-observation-tab.is-active {
  margin-bottom: -9px;
  border-color: #dfe8e2 #dfe8e2 #fff;
  color: #245b45;
  background: #fff;
}

.rpt-observation-tab:focus-visible {
  outline: 2px solid #438867;
  outline-offset: 2px;
}

.rpt-observation-tab-panel[hidden] {
  display: none;
}

.rpt-observation-tab-panel {
  min-width: 0;
}

.rpt-observation-panel-note {
  margin: 0 0 10px;
  color: #65766d;
  font-size: .7rem;
  line-height: 1.5;
}

.rpt-substrate-history-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dfe8e2;
  border-radius: 12px;
  background: #fbfdfb;
}

.rpt-section-heading h2 {
  margin: 0;
  color: #1e3a2d;
  font-size: .95rem;
}

.rpt-section-heading p {
  margin: 4px 0 0;
  color: #65766d;
  font-size: .7rem;
  line-height: 1.45;
}

.rpt-substrate-history-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.rpt-substrate-history-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 12px;
  border: 1px solid #e0e9e2;
  border-radius: 9px;
  background: #fff;
}

.rpt-substrate-history-card h3 {
  margin: 0;
  color: #244332;
  font-size: .78rem;
}

.rpt-substrate-history-latest,
.rpt-substrate-history-confidence,
.rpt-substrate-history-counts {
  margin: 0;
  color: #52657a;
  font-size: .67rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.rpt-substrate-history-latest {
  color: #334155;
  font-weight: 700;
}

.rpt-substrate-history-button {
  margin-top: auto;
  padding: 5px 8px;
  border: 1px solid #c8d9ce;
  border-radius: 6px;
  color: #245b45;
  background: #f5faf7;
  font-family: inherit;
  font-size: .67rem;
  font-weight: 700;
  cursor: pointer;
}

.rpt-substrate-history-button:hover {
  background: #e7f3ec;
}

.rpt-substrate-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.rpt-substrate-view-button {
  color: #fff;
  border-color: #28523a;
  background: #28523a;
}

.rpt-substrate-view-button:hover {
  border-color: #1e3f2c;
  background: #1e3f2c;
}

.rpt-substrate-history-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: #65766d;
  font-size: .72rem;
}

.rpt-substrate-history-note {
  margin: 0 0 14px;
  color: #65766d;
  font-size: .74rem;
  line-height: 1.5;
}

.rpt-substrate-history-events {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rpt-substrate-history-event {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(130px, .8fr) minmax(0, 1.6fr);
  gap: 5px 12px;
  padding: 11px 12px;
  border: 1px solid #e4e9e5;
  border-left: 3px solid #438867;
  border-radius: 8px;
  background: #fbfcfb;
  font-size: .72rem;
}

.rpt-substrate-history-event.is-disagreement {
  border-left-color: #d97706;
}

.rpt-substrate-history-event.is-not-compared {
  border-left-color: #2563a8;
}

.rpt-substrate-history-event.is-unavailable {
  border-left-color: #94a3b8;
}

.rpt-substrate-history-event time {
  color: #52657a;
  font-variant-numeric: tabular-nums;
}

.rpt-substrate-history-status {
  color: #245b45;
}

.rpt-substrate-history-status.is-disagreement {
  color: #9a5b05;
}

.rpt-substrate-history-status.is-not-compared {
  color: #2563a8;
}

.rpt-substrate-history-status.is-unavailable {
  color: #64748b;
}

.rpt-substrate-history-cameras,
.rpt-substrate-history-confidence {
  color: #64748b;
}

.rpt-substrate-history-event .rpt-substrate-history-confidence {
  grid-column: 2 / -1;
}

.rpt-substrate-event-images-button {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 4px;
  padding: 6px 9px;
  border: 1px solid #c8d9ce;
  border-radius: 6px;
  color: #245b45;
  background: #f5faf7;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
}

.rpt-substrate-event-images-button:hover {
  background: #e7f3ec;
}

.rpt-substrate-layout-dialog {
  width: min(1060px, calc(100% - 32px));
}

.rpt-substrate-layout-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.rpt-substrate-zone-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -7px 0 12px;
  color: #52657a;
  font-size: .7rem;
}

.rpt-substrate-zone-legend span {
  width: 16px;
  height: 12px;
  border: 2px solid #d6a900;
  border-radius: 2px;
  background: rgba(35, 100, 58, .2);
}

.rpt-substrate-camera-frame {
  min-width: 0;
  margin: 0;
}

.rpt-substrate-camera-frame figcaption {
  margin-bottom: 7px;
  color: #334155;
  font-size: .74rem;
  font-weight: 700;
}

.rpt-substrate-zone-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #cbd5d0;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #e8ede9 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(225deg, #e8ede9 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(315deg, #e8ede9 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, #e8ede9 25%, #fff 25%) 0 0 / 16px 16px;
}

.rpt-substrate-zone-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.rpt-substrate-zone-frame.image-unavailable::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #64748b;
  background: #f1f5f2;
  content: "Capture image unavailable";
  font-size: .75rem;
}

.rpt-substrate-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 2px;
  border-right: 1px solid rgba(255, 255, 255, .9);
  color: #fff;
  background: rgba(23, 45, 34, .12);
  font-size: clamp(.5rem, 1vw, .7rem);
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  text-align: center;
  pointer-events: none;
}

.rpt-substrate-zone strong {
  font-size: clamp(.54rem, 1.1vw, .75rem);
  white-space: nowrap;
}

.rpt-substrate-zone span {
  max-width: 100%;
  font-size: clamp(.42rem, .78vw, .62rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.rpt-substrate-zone.is-selected {
  border: 3px solid #ffd54f;
  background: rgba(35, 100, 58, .25);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45);
  color: #fff;
}

.rpt-observation-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #dfe8e2;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f6faf7);
}

.rpt-observation-stat strong {
  color: #1e513b;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.rpt-observation-stat span {
  color: #65766d;
  font-size: .67rem;
}

.rpt-observations-table {
  min-width: 900px;
}

.rpt-observations-table td:nth-child(4) {
  min-width: 230px;
}

.rpt-observations-table td:nth-child(5),
.rpt-observations-table th:nth-child(5) {
  min-width: 130px;
}

.rpt-detection-list {
  display: grid;
  gap: 5px;
  min-width: 210px;
}

.rpt-detection-item {
  display: grid;
  grid-template-columns: minmax(95px, .65fr) minmax(0, 1.35fr);
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid #e4ece5;
  border-radius: 6px;
  background: #fbfdfb;
  line-height: 1.35;
}

.rpt-detection-substrate {
  color: #28523a;
  font-size: .67rem;
}

.rpt-detection-class {
  color: #44564a;
  font-size: .67rem;
  overflow-wrap: anywhere;
}

.rpt-preview-btn {
  padding: 5px 9px;
  border: 1px solid #c8d9ce;
  border-radius: 6px;
  color: #245b45;
  background: #f5faf7;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.rpt-preview-btn:hover:not(:disabled) {
  background: #e7f3ec;
}

.rpt-preview-btn:disabled {
  color: #89938e;
  cursor: default;
}

.rpt-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .72rem;
}

.rpt-tbl thead tr {
  background: #f2f7f3;
}

.rpt-tbl th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: .70rem;
  color: #344a3c;
  border-bottom: 1px solid #d9e5dc;
  border-right: 1px solid #e6ede8;
  white-space: nowrap;
}

.rpt-tbl th:last-child {
  border-right: none;
}

.rpt-tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid #edf1ee;
  border-right: 1px solid #f0f3f1;
  color: #344054;
  vertical-align: middle;
}

.rpt-tbl td:last-child {
  border-right: none;
}

.rpt-tbl tr.er td {
  background: #fff;
  color: #555;
  text-align: center;
  padding: 18px;
}

.rpt-tbl tbody tr:not(.er):hover td {
  background: #f8fbf8;
}

#rpt-env-wrap .rpt-tbl td:last-child,
#rpt-env-wrap .rpt-tbl th:last-child {
  min-width: 150px;
}

#rpt-sub-wrap .rpt-tbl td:nth-child(5) {
  min-width: 190px;
  white-space: pre-line;
  line-height: 1.45;
}

#rpt-sub-wrap .rpt-tbl td:nth-child(6) {
  min-width: 170px;
  white-space: pre-line;
  line-height: 1.45;
}

#rpt-sub-wrap .rpt-tbl td:last-child,
#rpt-sub-wrap .rpt-tbl th:last-child {
  min-width: 150px;
}

.pg-lbl {
  font-size: .60rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════ */
/* STATUS INDICATORS & STYLING */
/* ═══════════════════════════════════════════════════════════════ */

.status-normal,
.status-good {
  color: #0f7938;
  background-color: #d1f0d8;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
  font-size: .70rem;
}

.status-warning {
  color: #856404;
  background-color: #fff3cd;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
  font-size: .70rem;
}

.status-critical {
  color: #721c24;
  background-color: #f8d7da;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
  font-size: .70rem;
}

.status-unknown {
  color: #52657a;
  background-color: #eef2f6;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
  font-size: .70rem;
}

.report-status-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #cbd8ce;
  border-radius: 6px;
  color: #28523a;
  background: #fff;
  font: inherit;
  font-size: .68rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.report-status-cell {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.report-status-toggle:hover {
  border-color: #8fb39a;
  background: #f1f7f2;
}

.report-status-toggle:focus-visible {
  outline: 2px solid #2364d2;
  outline-offset: 3px;
  border-radius: 3px;
}

.report-status-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(520px, calc(100% - 32px));
  max-height: min(80vh, 640px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #d9e3dc;
  border-radius: 14px;
  color: #26352e;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .3);
}

.report-status-dialog::backdrop {
  background: rgba(15, 23, 42, .48);
}

.report-status-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5ece7;
  background: #f7faf8;
}

.report-status-dialog-header h2 {
  margin: 3px 0 0;
  color: #1e3a2d;
  font-size: 1.05rem;
}

.report-status-dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #d3ded6;
  border-radius: 50%;
  color: #3e5147;
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.report-status-dialog-close:hover {
  background: #edf4ef;
}

.report-status-dialog-body {
  padding: 18px 20px 20px;
}

.report-status-dialog-body h3 {
  margin: 18px 0 8px;
  color: #334155;
  font-size: .8rem;
}

.report-status-dialog-summary {
  display: inline-flex;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}

.report-status-dialog-summary.status-critical {
  color: #721c24;
  background: #f8d7da;
}

.report-status-dialog-summary.status-warning {
  color: #856404;
  background: #fff3cd;
}

.report-status-dialog-summary.status-normal,
.report-status-dialog-summary.status-good {
  color: #0f7938;
  background: #d1f0d8;
}

.report-status-dialog-summary.status-unknown {
  color: #52657a;
  background: #eef2f6;
}

.report-status-dialog .report-status-alerts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: #52657a;
  font-size: .82rem;
  line-height: 1.5;
  list-style: none;
}

.report-status-dialog .report-status-alerts li {
  padding: 10px 12px;
  border: 1px solid #e4e9e5;
  border-left: 3px solid #d6a23c;
  border-radius: 7px;
  background: #fbfcfb;
  overflow-wrap: anywhere;
}

.report-status-dialog .report-status-alert-critical {
  border-left-color: #c73535;
  background: #fff7f7;
  color: #8a1f1f;
  font-weight: 600;
}

.report-status-dialog .report-status-alert-warning {
  border-left-color: #d6a23c;
  background: #fffdf7;
}

@media (max-width: 540px) {
  .report-status-dialog {
    width: calc(100% - 24px);
    max-height: 86vh;
  }

  .report-status-dialog-header,
  .report-status-dialog-body {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 820px) {
  .notification-panel {
    right: 8px;
    top: 92px;
    width: min(680px, calc(100vw - 16px));
    max-height: calc(100vh - 100px);
  }

  .rpt-substrate-layout-images {
    grid-template-columns: 1fr;
  }

  .rpt-substrate-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rpt-substrate-history-event {
    grid-template-columns: 1fr 1fr;
  }

  .rpt-substrate-history-cameras,
  .rpt-substrate-history-event .rpt-substrate-history-confidence {
    grid-column: 1 / -1;
  }

  .obs-gallery {
    padding: 10px;
  }

  .obs-gallery-content {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .obs-gallery-viewer {
    min-height: 52vh;
  }

  .obs-gallery-details {
    border-top: 1px solid #e0e6e8;
    border-left: 0;
  }

  .obs-gallery-stage img {
    max-height: 48vh;
  }
}

@media (max-width: 540px) {
  .notification-panel {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    max-height: none;
  }

  .notification-filters {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px;
  }

  .notification-header,
  .notification-list-header,
  .notification-list {
    padding-right: 14px;
    padding-left: 14px;
  }

  .rpt-observation-summary,
  .rpt-substrate-history-grid {
    grid-template-columns: 1fr;
  }

  .rpt-substrate-history-event {
    grid-template-columns: 1fr;
  }
  .obs-gallery {
    padding: 0;
  }

  .obs-gallery-shell {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .obs-gallery-header {
    padding: 13px 15px;
  }

  .obs-gallery-header h2 {
    font-size: 1.05rem;
  }

  .obs-gallery-viewer {
    min-height: 44vh;
    padding: 10px;
  }

  .obs-gallery-caption span:last-child {
    display: none;
  }
}
