:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #eef2eb;
  --text: #18201b;
  --muted: #677268;
  --border: #d9dfd5;
  --primary: #315c37;
  --primary-strong: #24482a;
  --accent: #c8a348;
  --danger: #9f5148;
  --shadow: 0 18px 44px rgba(39, 54, 42, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141815;
  --surface: #1f2520;
  --surface-soft: #293027;
  --text: #f5f3e8;
  --muted: #aab3a4;
  --border: #3c463a;
  --primary: #315c37;
  --primary-strong: #24482a;
  --accent: #c8a348;
  --danger: #c9827a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--primary);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, auto) auto;
  gap: 22px;
  align-items: center;
  padding: 16px 44px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 15px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  box-shadow: inset 0 -14px 24px rgba(0, 0, 0, 0.16), 0 10px 24px rgba(0, 0, 0, 0.10);
  font-size: 15px;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
}

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1.08;
}

.brand small {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 84%, var(--primary) 8%);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.site-nav a,
.theme-toggle,
.primary-action,
.secondary-action {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.site-nav a.active,
.primary-action {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-icon {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset -4px -3px 0 rgba(0, 0, 0, 0.22);
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 42px;
  flex: 1;
}

.dashboard-view,
.content-page {
  display: none;
}

.dashboard-view.active,
.content-page.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label span,
.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.toggle-row input {
  width: auto;
  min-height: auto;
}

.filter-warning {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 10%);
}

.filter-warning[hidden] {
  display: none;
}

.filter-warning strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.filter-warning p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.filter-warning button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  cursor: pointer;
}

.status-line {
  min-height: 20px;
  margin-bottom: 12px;
  color: var(--danger);
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.chart-card,
.details-card,
.insight-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
  min-height: 128px;
}

.metric-card strong {
  display: block;
  font-size: 32px;
  line-height: 1.1;
  color: var(--primary);
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.chart-card,
.details-card {
  min-height: 340px;
  overflow: hidden;
}

.chart-card-large {
  display: flex;
  min-height: 480px;
  height: auto;
  align-self: stretch;
}

.chart-card-large .plot {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.chart-card-wide {
  grid-column: span 2;
}

.plot {
  width: 100%;
  height: 100%;
  min-height: 340px;
}

.plot-short {
  min-height: 260px;
}

.insight-panel {
  padding: 18px;
  height: 100%;
}

.insight-panel section + section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.insight-panel h2,
.details-card h2,
.content-page h1,
.content-page h2 {
  margin-top: 0;
  color: var(--text);
}

.insight-panel p,
.insight-panel li,
.content-page p {
  color: var(--muted);
  line-height: 1.65;
}

.details-card {
  padding: 16px;
}

.details-card h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.table-wrap {
  max-height: 312px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.content-page {
  max-width: 980px;
  min-height: 62vh;
  margin: 0 auto;
  padding: 28px 0;
}

.content-page h1 {
  font-size: 36px;
}

.support-grid,
.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: 14px;
  margin: 18px 0;
}

.support-panel,
.report-form,
.report-summary,
.sample-report-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.support-panel h2,
.report-summary h2,
.sample-report-panel h2 {
  margin-top: 0;
  font-size: 18px;
}

.sample-report-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 18px 0 6px;
}

.sample-report-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.report-sample-link {
  white-space: nowrap;
}

.support-panel li,
.report-summary li {
  color: var(--muted);
  line-height: 1.6;
}

.support-panel-featured {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-link,
.report-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
}

.support-link[aria-disabled="true"] {
  opacity: 0.58;
  pointer-events: none;
}

.report-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-form button,
.report-form .status-line {
  grid-column: 1 / -1;
}

.report-summary strong {
  color: var(--primary);
  font-size: 22px;
}

.video-frame {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  padding: 18px clamp(16px, 4vw, 44px);
  background: var(--primary-strong);
  color: #fff;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: #fff;
}

@media (max-width: 1180px) {
  .toolbar {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .main-grid,
  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chart-card-wide {
    grid-column: span 2;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .brand strong {
    font-size: 20px;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .toolbar,
  .main-grid,
  .chart-grid,
  .kpi-grid,
  .support-grid,
  .report-layout,
  .report-form,
  .sample-report-panel {
    grid-template-columns: 1fr;
  }

  .report-sample-link {
    width: 100%;
  }

  .chart-card-wide {
    grid-column: auto;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1;
  }

  .filter-warning {
    flex-direction: column;
  }

  .filter-warning button {
    width: 100%;
  }
}

.dial-card {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 14px;
}

.dial-card .plot-short {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

.dial-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.dial-note {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

.card-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pressure-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 340px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pressure-card span {
  display: block;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-transform: none;
}

.pressure-card strong {
  display: block;
  color: var(--primary);
  font-size: 42px;
  line-height: 1;
  margin: 14px 0 6px;
  text-align: center;
}

.pressure-card small {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.pressure-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.math-board {
  margin: 14px 0 26px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 80%, var(--accent) 8%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--surface) 80%, transparent);
}

.math-board p {
  margin: 7px 0;
  color: var(--text);
  font-family: "Segoe Print", "Bradley Hand ITC", "Comic Sans MS", cursive;
  font-size: 19px;
  line-height: 1.45;
}

.math-board-featured {
  border-color: var(--accent);
}

.content-page h3 {
  margin-top: 1.4em;
}
