/* Veritrak — Dashboard (alt): light, editorial, warm */

.alt-body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1c1917;
  background: #faf8f5;
}

.alt-body a {
  color: #0d9488;
  text-decoration: none;
}

.alt-body a:hover {
  text-decoration: underline;
}

.alt-skip {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: #1c1917;
  color: #faf8f5;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 6px;
  transition: top 0.2s ease;
}

.alt-skip:focus {
  top: 1rem;
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

.alt-wrap {
  width: 92%;
  max-width: none;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  box-sizing: border-box;
}

/* Header */
.alt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e7e5e4;
}

.alt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #1c1917;
}

.alt-brand:hover {
  text-decoration: none;
  color: #0d9488;
}

.alt-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #0d9488;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 8px;
}

.alt-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.alt-brand-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.alt-brand-tagline {
  font-size: 0.75rem;
  color: #78716c;
}

.alt-client {
  flex: 1;
  min-width: 0;
}

.alt-client-name {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1c1917;
}

.alt-theme-wrap {
  flex-shrink: 0;
}

.alt-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  background: #fff;
  color: #57534e;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.alt-theme-toggle:hover {
  background: #faf8f5;
  border-color: #0d9488;
  color: #0d9488;
}

.alt-theme-toggle:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

.alt-theme-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.alt-theme-icon--dark {
  display: none;
}

.alt-theme-label-dark {
  display: none;
}

/* Main */
.alt-main {
  padding-bottom: 2rem;
}

.alt-section {
  margin-bottom: 2.5rem;
}

.alt-heading {
  margin: 0 0 0.35rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1c1917;
}

.alt-lead {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: #57534e;
  max-width: 52ch;
  line-height: 1.55;
}

/* KPI grid */
.alt-kpi-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.alt-kpi {
  flex: 1 1 140px;
  min-width: 140px;
  max-width: 220px;
  padding: 1.25rem 1rem;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  border-left: 4px solid #0d9488;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.alt-kpi--red {
  border-left-color: #c62828;
}

.alt-kpi--amber {
  border-left-color: #e67e22;
}

.alt-kpi--green {
  border-left-color: #059669;
}

.alt-kpi-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #78716c;
  margin-bottom: 0.25rem;
}

.alt-kpi-value {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1c1917;
}

.alt-kpi-note {
  display: block;
  font-size: 0.75rem;
  color: #78716c;
  margin-top: 0.5rem;
  line-height: 1.35;
}

/* Risk stack */
.alt-risk-stack {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alt-risk-row {
  display: grid;
  grid-template-columns: 1fr 2fr 72px;
  align-items: center;
  gap: 1rem;
}

.alt-risk-label {
  font-size: 0.875rem;
  color: #1c1917;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.alt-risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alt-risk-dot--red {
  background: #c62828;
}

.alt-risk-dot--amber {
  background: #e67e22;
}

.alt-risk-dot--green {
  background: #059669;
}

.alt-risk-track {
  height: 10px;
  border-radius: 999px;
  background: #e7e5e4;
  overflow: hidden;
}

.alt-risk-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.alt-risk-fill--red {
  background: #c62828;
}

.alt-risk-fill--amber {
  background: #e67e22;
}

.alt-risk-fill--green {
  background: #059669;
}

.alt-risk-num {
  font-size: 0.8125rem;
  color: #78716c;
  text-align: right;
}

/* Map */
.alt-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #57534e;
}

.alt-map-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.alt-map-dot--red {
  background: #c62828;
}

.alt-map-dot--amber {
  background: #e67e22;
}

.alt-map-dot--green {
  background: #059669;
}

.alt-map {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e7e5e4;
  background: #f5f5f4;
}

.alt-map .leaflet-popup-content-wrapper {
  background: #fff;
  color: #1c1917;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.alt-map .leaflet-popup-content {
  margin: 0.6rem 0.75rem;
  font-size: 0.875rem;
}

.alt-map .leaflet-popup-tip {
  background: #fff;
}

/* Table */
.alt-table-wrap {
  overflow-x: auto;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.alt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.alt-table th,
.alt-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e7e5e4;
}

.alt-table th {
  background: #faf8f5;
  color: #57534e;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alt-th-expand {
  width: 48px;
  padding-left: 0.75rem;
}

.alt-table tbody tr:hover {
  background: #faf8f5;
}

.alt-table-ref {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #78716c;
  margin-right: 0.5rem;
}

.alt-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.alt-pill--red {
  background: #fef2f2;
  color: #c62828;
}

.alt-pill--amber {
  background: #fffbeb;
  color: #e67e22;
}

.alt-pill--green {
  background: #ecfdf5;
  color: #059669;
}

.alt-table-note {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: #78716c;
}

/* Expandable rows */
.alt-td-expand {
  padding: 0.5rem;
  vertical-align: middle;
}

.expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  background: #fff;
  color: #57534e;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.expand-btn:hover {
  background: #faf8f5;
  border-color: #0d9488;
  color: #0d9488;
}

.expand-btn:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

.expand-icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  margin-top: 1px;
  transition: transform 0.2s ease;
}

.expand-btn--open .expand-icon {
  transform: rotate(180deg);
}

.property-row:has(+ .sensor-detail-row--open) td {
  border-bottom: none;
}

.sensor-detail-row {
  display: none;
}

.sensor-detail-row.sensor-detail-row--open {
  display: table-row;
}

.sensor-detail-row td {
  padding: 0;
  border-top: 1px solid #e7e5e4;
  border-bottom: 1px solid #e7e5e4;
  background: #faf8f5;
  vertical-align: top;
}

.alt-sensor-detail {
  padding: 1rem 1rem 1rem 3.5rem;
}

.alt-sensor-detail-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #78716c;
}

.alt-sensor-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.alt-sensor-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e7e5e4;
}

.alt-sensor-location {
  font-weight: 600;
  color: #1c1917;
}

.alt-sensor-where {
  color: #57534e;
  font-size: 0.8125rem;
}

.alt-sensor-humidity {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.9375rem;
}

.alt-sensor-label {
  font-size: 0.75rem;
  color: #78716c;
}

.alt-hum--ok {
  color: #059669;
}

.alt-hum--mid {
  color: #e67e22;
}

.alt-hum--high {
  color: #c62828;
}

/* Evidence */
.alt-evidence {
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.alt-evidence-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #faf8f5;
  border-bottom: 1px solid #e7e5e4;
  font-size: 0.9375rem;
}

.alt-tag {
  padding: 0.25rem 0.5rem;
  background: #ecfdf5;
  color: #059669;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
}

.alt-evidence-list {
  margin: 0;
  padding: 1.25rem 1.5rem 1.25rem 2.5rem;
  list-style: decimal;
  color: #57534e;
  font-size: 0.875rem;
  line-height: 1.6;
}

.alt-evidence-list li {
  margin-bottom: 0.5rem;
}

.alt-evidence-list li:last-child {
  margin-bottom: 0;
}

.alt-evidence-list strong {
  color: #1c1917;
}

/* CTA */
.alt-cta {
  padding: 1.5rem 1.25rem;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  border-left: 4px solid #0d9488;
  text-align: center;
}

.alt-cta p {
  margin: 0;
  font-size: 0.9375rem;
  color: #1c1917;
}

.alt-cta-link {
  font-weight: 600;
}

.alt-cta-link:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

/* Footer */
.alt-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e7e5e4;
  color: #78716c;
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.alt-footer-links a {
  margin-left: 1rem;
}

/* Dark mode — also .alt-theme-dark on html (set in head) to avoid flash */
.alt-theme-dark .alt-body,
.alt-body--dark {
  background: #1c1917;
  color: #e7e5e4;
}

.alt-theme-dark .alt-body a,
.alt-body--dark a {
  color: #2dd4bf;
}

.alt-theme-dark .alt-body .alt-skip:focus,
.alt-body--dark .alt-skip:focus {
  outline-color: #2dd4bf;
}

.alt-theme-dark .alt-body .alt-header,
.alt-body--dark .alt-header {
  border-bottom-color: #44403c;
}

.alt-theme-dark .alt-body .alt-brand,
.alt-body--dark .alt-brand {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-brand:hover,
.alt-body--dark .alt-brand:hover {
  color: #2dd4bf;
}

.alt-theme-dark .alt-body .alt-brand-tagline,
.alt-body--dark .alt-brand-tagline {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-client-name,
.alt-body--dark .alt-client-name {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-theme-toggle,
.alt-body--dark .alt-theme-toggle {
  background: #292524;
  border-color: #44403c;
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-theme-toggle:hover,
.alt-body--dark .alt-theme-toggle:hover {
  background: #44403c;
  border-color: #2dd4bf;
  color: #2dd4bf;
}

.alt-theme-dark .alt-body .alt-theme-icon--light,
.alt-body--dark .alt-theme-icon--light {
  display: none;
}

.alt-theme-dark .alt-body .alt-theme-icon--dark,
.alt-body--dark .alt-theme-icon--dark {
  display: inline;
}

.alt-theme-dark .alt-body .alt-theme-label-light,
.alt-body--dark .alt-theme-label-light {
  display: none;
}

.alt-theme-dark .alt-body .alt-theme-label-dark,
.alt-body--dark .alt-theme-label-dark {
  display: inline;
}

.alt-theme-dark .alt-body .alt-heading,
.alt-body--dark .alt-heading {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-lead,
.alt-body--dark .alt-lead {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-kpi,
.alt-body--dark .alt-kpi {
  background: #292524;
  border-color: #44403c;
  border-left-color: #0d9488;
}

.alt-theme-dark .alt-body .alt-kpi--red,
.alt-body--dark .alt-kpi--red {
  border-left-color: #c62828;
}

.alt-theme-dark .alt-body .alt-kpi--amber,
.alt-body--dark .alt-kpi--amber {
  border-left-color: #e67e22;
}

.alt-theme-dark .alt-body .alt-kpi--green,
.alt-body--dark .alt-kpi--green {
  border-left-color: #059669;
}

.alt-theme-dark .alt-body .alt-kpi-label,
.alt-body--dark .alt-kpi-label {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-kpi-value,
.alt-body--dark .alt-kpi-value {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-kpi-note,
.alt-body--dark .alt-kpi-note {
  color: #78716c;
}

.alt-theme-dark .alt-body .alt-risk-label,
.alt-body--dark .alt-risk-label {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-risk-track,
.alt-body--dark .alt-risk-track {
  background: #44403c;
}

.alt-theme-dark .alt-body .alt-risk-num,
.alt-body--dark .alt-risk-num {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-map-legend,
.alt-body--dark .alt-map-legend {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-map,
.alt-body--dark .alt-map {
  border-color: #44403c;
  background: #292524;
}

.alt-theme-dark .alt-body .alt-map .leaflet-popup-content-wrapper,
.alt-body--dark .alt-map .leaflet-popup-content-wrapper {
  background: #292524;
  color: #e7e5e4;
  border-color: #44403c;
}

.alt-theme-dark .alt-body .alt-map .leaflet-popup-tip,
.alt-body--dark .alt-map .leaflet-popup-tip {
  background: #292524;
}

.alt-theme-dark .alt-body .alt-table-wrap,
.alt-body--dark .alt-table-wrap {
  background: #292524;
  border-color: #44403c;
}

.alt-theme-dark .alt-body .alt-table th,
.alt-body--dark .alt-table th {
  background: #1c1917;
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-table td,
.alt-body--dark .alt-table td {
  border-bottom-color: #44403c;
}

.alt-theme-dark .alt-body .alt-table tbody tr:hover,
.alt-body--dark .alt-table tbody tr:hover {
  background: #44403c;
}

.alt-theme-dark .alt-body .alt-table-ref,
.alt-body--dark .alt-table-ref {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-table-note,
.alt-body--dark .alt-table-note {
  color: #78716c;
}

.alt-theme-dark .alt-body .property-row:has(+ .sensor-detail-row--open) td,
.alt-body--dark .property-row:has(+ .sensor-detail-row--open) td {
  border-bottom: none;
}

.alt-theme-dark .alt-body .sensor-detail-row td,
.alt-body--dark .sensor-detail-row td {
  border-top-color: #44403c;
  border-bottom-color: #44403c;
  background: #1c1917;
}

.alt-theme-dark .alt-body .expand-btn,
.alt-body--dark .expand-btn {
  background: #292524;
  border-color: #44403c;
  color: #a8a29e;
}

.alt-theme-dark .alt-body .expand-btn:hover,
.alt-body--dark .expand-btn:hover {
  background: #44403c;
  border-color: #2dd4bf;
  color: #2dd4bf;
}

.alt-theme-dark .alt-body .alt-sensor-detail-title,
.alt-body--dark .alt-sensor-detail-title {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-sensor-item,
.alt-body--dark .alt-sensor-item {
  background: #292524;
  border-color: #44403c;
}

.alt-theme-dark .alt-body .alt-sensor-location,
.alt-body--dark .alt-sensor-location {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-sensor-where,
.alt-body--dark .alt-sensor-where {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-sensor-label,
.alt-body--dark .alt-sensor-label {
  color: #78716c;
}

.alt-theme-dark .alt-body .alt-evidence,
.alt-body--dark .alt-evidence {
  background: #292524;
  border-color: #44403c;
}

.alt-theme-dark .alt-body .alt-evidence-hd,
.alt-body--dark .alt-evidence-hd {
  background: #1c1917;
  border-bottom-color: #44403c;
}

.alt-theme-dark .alt-body .alt-evidence-list,
.alt-body--dark .alt-evidence-list {
  color: #a8a29e;
}

.alt-theme-dark .alt-body .alt-evidence-list strong,
.alt-body--dark .alt-evidence-list strong {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-cta,
.alt-body--dark .alt-cta {
  background: #292524;
  border-color: #44403c;
  border-left-color: #0d9488;
}

.alt-theme-dark .alt-body .alt-cta p,
.alt-body--dark .alt-cta p {
  color: #e7e5e4;
}

.alt-theme-dark .alt-body .alt-footer,
.alt-body--dark .alt-footer {
  border-top-color: #44403c;
  color: #78716c;
}

/* Responsive */
@media (max-width: 768px) {
  .alt-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .alt-kpi {
    min-width: 120px;
    max-width: none;
    flex: 1 1 calc(50% - 0.5rem);
  }

  .alt-risk-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }

  .alt-risk-num {
    grid-column: 2;
    text-align: left;
  }

  .alt-sensor-item {
    grid-template-columns: 1fr auto;
    gap: 0.25rem;
  }

  .alt-sensor-where {
    grid-column: 1;
  }

  .alt-sensor-humidity {
    grid-column: 2;
    grid-row: 1;
  }

  .alt-sensor-label {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .alt-kpi {
    flex: 1 1 100%;
    max-width: none;
  }

  .alt-risk-row {
    grid-template-columns: 1fr;
  }

  .alt-risk-num {
    grid-column: 1;
  }
}
