:root {
  color-scheme: light;
  --ink: #171717;
  --canvas: #ffffff;
  --surface: #f6f6f6;
  --muted: #6c6c6c;
  --line: #dedede;
  --soft: #eeeeee;
  --soft-ink: #aaaaaa;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body, figure, p, h1, h2, h3 { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #6c6c6c; outline-offset: 3px; }
.skip { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 12px; background: var(--canvas); transform: translateY(-150%); }
.skip:focus { transform: none; }
.shell { width: min(100% - 104px, 1240px); margin-inline: auto; }
.site-header { background: var(--canvas); border-bottom: 1px solid #dedede; }
.nav-row, .footer-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.nav-row { min-height: 76px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 27px; font-weight: 780; letter-spacing: -1.45px; line-height: 1; }
.wordmark span span { color: var(--ink); }
nav { display: flex; align-items: center; gap: 29px; font-size: 14px; font-weight: 650; }
.nav-link { color: var(--muted); }
.nav-link.current, .nav-link:hover { color: var(--ink); }
.nav-button { display: flex; align-items: center; gap: 11px; padding: 10px 15px; border: 1px solid #dedede; border-radius: 7px; color: var(--ink); white-space: nowrap; }
.nav-button:hover, .nav-button.current { background: #f6f6f6; }
.hero { background: radial-gradient(ellipse at 83% 24%, #eeeeee, transparent 56%), var(--surface); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: .88fr 1.12fr; align-items: center; gap: clamp(32px, 5vw, 76px); min-height: 560px; padding-block: 61px; }
.eyebrow, .small-label, .step, .panel-top, .panel-foot { font-family: var(--mono); font-size: 11px; font-weight: 650; letter-spacing: .105em; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.eyebrow > span { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--ink); transform: rotate(45deg); }
.hero h1 { color: var(--ink); font-size: clamp(46px, 5.85vw, 87px); line-height: .99; letter-spacing: -.076em; font-weight: 760; margin-top: 24px; }
.hero h1 em { color: var(--muted); font-style: normal; }
.hero-description { max-width: 395px; margin-top: 24px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 48px; padding: 0 18px; border: 1px solid transparent; border-radius: 7px; font-size: 14px; font-weight: 680; transition: background .16s, border-color .16s; }
.button.primary { color: var(--canvas); background: var(--ink); }
.button.primary:hover { background: #383838; }
.button.secondary { color: var(--ink); border-color: var(--line); background: var(--canvas); }
.button.secondary:hover { background: var(--surface); }
.button.compact { min-height: 37px; padding-inline: 13px; font-size: 13px; }
.hero .button { margin-top: 27px; }
.hero-caption { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 27px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.mini-line { width: 19px; height: 1px; background: var(--ink); }
.signal-panel { overflow: hidden; min-width: 0; border: 1px solid #383838; border-radius: 17px; background: #171717; box-shadow: 0 22px 46px #00000021; }
.panel-top, .panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 51px; padding: 11px 17px; color: #dedede; font-size: 10px; }
.panel-top { border-bottom: 1px solid #444444; }
.panel-foot { border-top: 1px solid #444444; }
.panel-top span:first-child, .panel-foot span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.panel-top i, .panel-foot i, .badge i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--soft-ink); flex: 0 0 auto; }
.panel-top i { box-shadow: 0 0 8px #ffffff44; }
.panel-foot b { color: #eeeeee; }
.signal-art { width: 100%; height: auto; }
.flow { padding: 52px 0 64px; }
.flow-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin: 12px 0 25px; }
.flow-heading h2 { font-size: clamp(30px, 3.4vw, 47px); font-weight: 750; letter-spacing: -.058em; line-height: 1.1; }
.flow-heading p, .flow-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.flow-grid, .metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.flow-card { min-height: 155px; position: relative; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: #f6f6f6; }
.flow-card .step { color: var(--ink); }
.flow-card svg { position: absolute; top: 20px; right: 20px; width: 23px; height: 23px; fill: none; stroke: var(--ink); stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.flow-card h3 { margin: 16px 0 6px; font-size: 19px; letter-spacing: -.025em; }
.site-footer { background: var(--canvas); border-top: 1px solid var(--line); }
.footer-row { min-height: 85px; color: var(--muted); font-size: 13px; }
.footer-row .wordmark { font-size: 21px; }
.footer-row > a:last-child { color: var(--ink); font-weight: 650; }
.footer-row > a:last-child:hover { text-decoration: underline; }

.sensor-body { background: var(--surface); }
.dashboard { padding: 44px 0 52px; }
.dash-head, .card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dash-head { align-items: flex-end; margin-bottom: 24px; }
.dash-head h1 { margin: 8px 0; font-size: clamp(37px, 5vw, 64px); line-height: 1.02; letter-spacing: -.063em; }
.dash-head p:last-child { color: var(--muted); line-height: 1.55; }
.badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge.neutral { color: #505050; background: #eeeeee; }
.badge.neutral i { background: #6c6c6c; }
.badge.positive { color: #171717; background: var(--soft); }
.badge.positive i { background: var(--ink); }
.snapshot-note, .snapshot-note > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.snapshot-note { justify-content: space-between; padding: 9px 12px; border-block: 1px solid var(--line); margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.snapshot-note strong { color: var(--ink); font-weight: 600; }
.metrics { margin-bottom: 16px; }
.metric { min-height: 112px; min-width: 0; display: grid; gap: 4px; padding: 13px 17px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); color: var(--muted); font-size: 13px; }
.metric.active { border-color: #6c6c6c; box-shadow: inset 0 2px var(--ink); }
.metric strong { font-size: clamp(23px, 3vw, 34px); letter-spacing: -.045em; line-height: 1.15; color: var(--ink); }
.metric strong small { font-size: 14px; letter-spacing: 0; color: var(--muted); }
.metric-id { font: 11px var(--mono); color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.sensor-grid { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 20px; background: var(--canvas); }
.card-head { margin-bottom: 14px; }
.small-label { color: var(--ink); font-size: 10px; }
.card h2 { margin-top: 4px; font-size: 21px; line-height: 1.2; letter-spacing: -.025em; }
.chart svg { display: block; width: 100%; height: auto; }
.chart polyline { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart circle { fill: var(--ink); stroke: white; stroke-width: 1.5; }
.chart-grid line { stroke: #dedede; stroke-dasharray: 3 4; }
.chart-grid text { font: 12px var(--mono); fill: var(--muted); }
.chart-point-label { font: 650 13px var(--mono); fill: var(--ink); paint-order: stroke fill; stroke: white; stroke-width: 5px; stroke-linejoin: round; }
.chart-unit { color: var(--muted); font: 12px var(--mono); }
.chart-description { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.device-list { display: grid; gap: 12px; margin: 0; }
.device-list > div { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.device-list dt { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.device-list dd { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.device-list .device-link { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.device-link span { border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; background: var(--canvas); color: var(--ink); font: 11px var(--mono); }
.phase-card, .mqtt-card { margin-top: 16px; }
.phase-table { width: 100%; border-collapse: collapse; text-align: right; font-size: 14px; }
.phase-table th, .phase-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.phase-table thead th { color: var(--muted); font-size: 12px; font-weight: 650; background: var(--surface); }
.phase-table th:first-child { text-align: left; }
.phase-table thead span { display: block; margin-top: 2px; font: 11px var(--mono); }
.phase-table td { font: 650 14px var(--mono); }
.mqtt-card summary { cursor: pointer; font-size: 17px; font-weight: 700; }
.mqtt-card summary small { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.mqtt-card[open] summary { margin-bottom: 15px; }
.topic { width: fit-content; max-width: 100%; overflow-wrap: anywhere; padding: 5px 8px; border-radius: 4px; color: #171717; background: var(--soft); font: 12px var(--mono); }
pre { min-height: 118px; max-height: 340px; margin: 10px 0 0; padding: 12px; overflow: auto; background: #171717; color: #eeeeee; border-radius: 7px; font: 12px/1.65 var(--mono); }
.inspect-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inspect-card label { display: block; margin: 11px 0 5px; color: var(--ink); font-size: 13px; font-weight: 650; }
.inspect-card input, .inspect-card textarea { display: block; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #f6f6f6; color: var(--ink); font: 13px/1.45 var(--mono); }
.inspect-card textarea { resize: vertical; min-height: 95px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.error { color: #171717; font-size: 13px; margin-top: 10px; }
#inspect-summary { margin-bottom: 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 56px); }
  .hero-grid { min-height: auto; padding-block: 45px; gap: 28px; }
  .hero h1 { font-size: clamp(45px, 7vw, 65px); }
  .panel-top, .panel-foot { min-height: 38px; padding: 8px 10px; font-size: 8px; }
  .flow { padding-block: 40px 48px; }
}

@media (max-width: 660px) {
  .shell { width: calc(100% - 34px); }
  .nav-row { min-height: 63px; gap: 10px; }
  .wordmark { font-size: 24px; gap: 7px; }
  .wordmark img { width: 30px; height: 30px; }
  nav { gap: 10px; font-size: 12px; }
  .nav-link { display: none; }
  .nav-button { padding: 8px 10px; gap: 5px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); padding-block: 35px 30px; }
  .hero h1 { margin-top: 17px; font-size: clamp(45px, 11vw, 64px); }
  .hero-description { margin-top: 17px; font-size: 15px; }
  .hero .button, .hero-caption { margin-top: 17px; }
  .flow-heading, .dash-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .flow-grid, .dash-grid, .inspect-grid { grid-template-columns: minmax(0, 1fr); }
  .flow-card { min-height: 0; }
  .footer-row { min-height: 70px; }
  .footer-row > span { display: none; }
  .dashboard { padding-block: 30px; }
  .dash-head { margin-bottom: 16px; }
  .dash-head p:last-child { font-size: 14px; }
  .metric { padding: 11px 8px; min-height: 90px; font-size: 11px; }
  .metrics { gap: 6px; }
  .metric strong { font-size: clamp(16px, 5vw, 22px); }
  .metric strong small, .metric-id { font-size: 10px; }
  .card { padding: 15px; }
  .phase-table th, .phase-table td { padding: 8px 5px; }
  .mqtt-card summary small { display: block; margin: 4px 0 0 15px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
