:root {
  --bg: #061015;
  --bg-2: #091b24;
  --surface: rgba(11, 29, 39, .76);
  --surface-strong: rgba(14, 38, 50, .92);
  --line: rgba(104, 239, 255, .22);
  --text: #f3fff8;
  --muted: #9bb5bf;
  --green: #53ff76;
  --cyan: #4de9ff;
  --blue: #75a7ff;
  --red: #ff6666;
  --orange: #ffbd59;
  --shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(83, 255, 118, .24), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(77, 233, 255, .22), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(117, 167, 255, .16), transparent 34%),
    linear-gradient(135deg, #051013 0%, #071620 48%, #04100b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent 70%);
}

a { color: inherit; }

.language-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 16, 21, .74);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .25);
  backdrop-filter: blur(16px);
}

.language-switch a {
  min-width: 38px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.language-switch a.active {
  color: #03100b;
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

code {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(83, 255, 118, .12);
  color: var(--green);
}

.landing,
.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px;
}

.hero {
  min-height: 690px;
  display: flex;
  flex-direction: column;
}

.nav,
.dashboard-header,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 60% 38%, #eaffef 0 10%, transparent 11%),
    linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 0 28px rgba(83, 255, 118, .35);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.back-link {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  backdrop-filter: blur(16px);
}

.hero-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  align-items: center;
  gap: 54px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: 64px;
  line-height: .98;
  letter-spacing: -.045em;
}

h2 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -.03em;
}

h3 { margin: 16px 0 8px; }

p {
  color: var(--muted);
  line-height: 1.65;
}

.lead {
  max-width: 650px;
  font-size: 19px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.button,
button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 18px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .045);
}

.button.primary {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #03100b;
  border-color: transparent;
  box-shadow: 0 16px 40px rgba(83, 255, 118, .24);
}

.device-preview,
.panel,
.metric,
.steps article,
.feature-grid div,
.feature-grid a.github-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.device-preview {
  position: relative;
  padding: 0;
  overflow: hidden;
}

.device-preview:not(.product-photo)::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .42;
  pointer-events: none;
}

.product-photo {
  min-height: 340px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(77, 233, 255, .28);
  background:
    radial-gradient(circle at 18% 72%, rgba(83, 255, 118, .18), transparent 30%),
    linear-gradient(145deg, rgba(9, 32, 42, .72), rgba(5, 16, 22, .92));
}

.product-photo::after {
  content: "";
  position: absolute;
  inset: auto 10% 5% 14%;
  height: 90px;
  border-radius: 999px;
  background: rgba(83, 255, 118, .16);
  filter: blur(42px);
  pointer-events: none;
}

.product-photo img {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: 88%;
  max-height: 330px;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 18px;
}

.hero-photo {
  min-height: 620px;
}

.hero-photo img {
  max-width: 92%;
  max-height: 580px;
  border-radius: 22px;
}

.photo-badge {
  position: absolute;
  z-index: 2;
  left: 22px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
}

.photo-badge span {
  color: #03100b;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.photo-badge strong {
  font-size: 13px;
}

.device-screen > * {
  position: relative;
  z-index: 1;
}

.preview-header,
.preview-relays,
.preview-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-header {
  padding: 14px;
  border: 1px solid rgba(77, 233, 255, .28);
  border-radius: 18px;
  background: rgba(5, 18, 24, .72);
}

.preview-leaf {
  width: 42px;
  height: 32px;
  border-radius: 16px 16px 7px 7px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(255,255,255,.55) 49% 51%, transparent 52%),
    linear-gradient(135deg, rgba(83, 255, 118, .88), rgba(77, 233, 255, .68));
  box-shadow: 0 0 24px rgba(83, 255, 118, .24);
}

.preview-header small {
  display: block;
  margin-top: 4px;
  color: var(--green);
}

.preview-header strong {
  color: #03100b;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--green);
}

.preview-metrics {
  margin: 18px 0;
}

.preview-metrics div {
  flex: 1;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(83, 255, 118, .28);
  border-radius: 18px;
  background: rgba(6, 23, 29, .74);
}

.preview-metrics small,
.metric span {
  display: block;
  color: var(--muted);
}

.preview-metrics b {
  display: block;
  margin: 8px 0;
  font-size: 36px;
  letter-spacing: -.04em;
  color: var(--green);
}

.preview-chart {
  height: 155px;
  display: flex;
  align-items: end;
  gap: 9px;
  padding: 16px;
  border: 1px solid rgba(77, 233, 255, .32);
  border-radius: 18px;
  background: rgba(3, 14, 19, .72);
}

.preview-chart span {
  flex: 1;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(var(--cyan), var(--green));
  box-shadow: 0 0 18px rgba(77, 233, 255, .2);
}

.preview-relays {
  margin-top: 16px;
  color: var(--muted);
}

.preview-relays span {
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
}

.section {
  padding: 58px 0;
}

.section.muted {
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.ai-panel {
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.hardware-section {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: 34px;
  align-items: center;
}

.hardware-copy h2 {
  max-width: 620px;
  margin: 0 0 18px;
  font-size: 46px;
  line-height: .98;
  letter-spacing: 0;
}

.hardware-copy p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.65;
}

.hardware-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hardware-pills span {
  padding: 10px 13px;
  border: 1px solid rgba(77, 233, 255, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.hardware-visuals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch;
}

.hardware-card {
  position: relative;
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(77, 233, 255, .28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 28% 76%, rgba(83, 255, 118, .15), transparent 32%),
    linear-gradient(145deg, rgba(9, 32, 42, .76), rgba(5, 16, 22, .94));
  box-shadow: var(--shadow);
}

.hardware-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.hardware-card-screen img {
  object-position: center;
}

.hardware-card-board img {
  min-height: 360px;
  box-sizing: border-box;
  padding: 14px 14px 58px;
  object-fit: contain;
  object-position: center;
}

.hardware-card figcaption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  width: fit-content;
  max-width: calc(100% - 28px);
  padding: 9px 12px;
  border: 1px solid rgba(77, 233, 255, .28);
  border-radius: 999px;
  background: rgba(5, 18, 24, .76);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
}

.steps,
.feature-grid,
.cards,
.relay-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.steps article,
.feature-grid div,
.feature-grid a.github-card {
  padding: 24px;
}

.steps article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.steps b {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #031008;
  font-weight: 900;
}

.feature-grid div,
.feature-grid a.github-card {
  color: var(--text);
  font-weight: 800;
}

.feature-grid a.github-card {
  display: block;
  text-decoration: none;
}

.feature-grid a.github-card span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.contact-section {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(340px, 1.1fr);
  gap: 22px;
  align-items: stretch;
}

.contact-copy,
.contact-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.contact-copy {
  padding: 30px;
  background:
    radial-gradient(circle at 12% 18%, rgba(83, 255, 118, .16), transparent 32%),
    linear-gradient(145deg, rgba(9, 32, 42, .78), rgba(5, 16, 22, .92));
}

.contact-copy h2 {
  max-width: 620px;
  font-size: 42px;
  line-height: 1;
}

.contact-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.contact-link {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(77, 233, 255, .22);
  border-radius: 18px;
  background: rgba(5, 18, 24, .72);
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  font-weight: 900;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.contact-link:hover {
  transform: translateY(-2px);
  border-color: rgba(83, 255, 118, .48);
  background: rgba(9, 32, 42, .9);
}

.contact-link.primary {
  background: linear-gradient(135deg, rgba(83, 255, 118, .22), rgba(77, 233, 255, .14));
  border-color: rgba(83, 255, 118, .36);
}

.contact-link span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.ai-grid div {
  display: flex;
  min-height: 178px;
  flex-direction: column;
  gap: 10px;
}

.ai-grid small {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ai-grid strong {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -.03em;
}

.ai-grid span {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.55;
}

.dashboard-header {
  padding: 20px 0 30px;
}

.dashboard-header h1 {
  font-size: 44px;
}

.status-pill {
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(83, 255, 118, .14);
  color: var(--green);
  border: 1px solid rgba(83, 255, 118, .35);
  white-space: nowrap;
}

.status-pill.offline {
  background: rgba(255, 180, 77, .14);
  color: var(--orange);
  border-color: rgba(255, 180, 77, .42);
}

.connection-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(83, 255, 118, .26);
  border-radius: 8px;
  background: rgba(83, 255, 118, .09);
}

.connection-alert.offline {
  border-color: rgba(255, 180, 77, .36);
  background: rgba(255, 180, 77, .12);
}

.connection-alert strong {
  color: var(--text);
  font-size: 15px;
}

.connection-alert span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.device-offline .metric strong {
  color: #dbe4df;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric {
  padding: 20px;
}

.metric strong {
  display: block;
  margin: 12px 0 4px;
  font-size: 36px;
  letter-spacing: -.04em;
}

.metric small {
  color: var(--muted);
}

.panel {
  margin-top: 18px;
  padding: 22px;
}

.chart-panel {
  position: relative;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart-range {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid rgba(104, 239, 255, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}

.chart-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(104, 239, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
}

.chart-range button,
.chart-tabs button {
  padding: 9px 12px;
  border: 0;
  box-shadow: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.chart-range button.active,
.chart-tabs button.active {
  background: linear-gradient(135deg, rgba(83, 255, 118, .95), rgba(77, 233, 255, .9));
  color: #03100b;
}

.chart-range label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chart-range label.active {
  padding-left: 10px;
  border-radius: 8px;
  background: rgba(83, 255, 118, .12);
  color: var(--green);
}

.chart-range input {
  width: 142px;
  min-height: 36px;
  border: 1px solid rgba(124, 244, 255, .26);
  border-radius: 8px;
  background: rgba(5, 18, 24, .72);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.day-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.day-summary article {
  min-height: 118px;
  padding: 14px;
  border: 1px solid rgba(124, 244, 255, .22);
  border-radius: 8px;
  background: rgba(5, 18, 24, .62);
}

.day-summary span,
.relay-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.day-summary strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.day-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-advisor-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(83, 255, 118, .34);
}

.ai-advisor-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(83, 255, 118, .18), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(77, 233, 255, .16), transparent 32%);
}

.ai-advisor-panel > * {
  position: relative;
  z-index: 1;
}

.ai-advisor-panel .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
}

.ai-advisor-panel .panel-title > div {
  flex: 1 1 360px;
  min-width: 0;
}

.ai-badge {
  padding: 9px 12px;
  border: 1px solid rgba(83, 255, 118, .38);
  border-radius: 999px;
  background: rgba(83, 255, 118, .12);
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.crop-selector {
  display: grid;
  gap: 6px;
  flex: 0 1 300px;
  width: min(300px, 100%);
  max-width: 100%;
  margin-left: auto;
}

.crop-selector span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.crop-selector select {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid rgba(83, 255, 118, .36);
  border-radius: 8px;
  background: rgba(5, 18, 24, .84);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.advisor-controls {
  display: grid;
  gap: 10px;
  flex: 0 0 230px;
  width: min(230px, 100%);
  max-width: 230px;
  margin-left: auto;
}

.advisor-controls .crop-selector {
  width: 100%;
  max-width: 230px;
  margin-left: 0;
}

.advisor-controls .crop-selector select {
  min-height: 40px;
  padding-left: 11px;
  font-size: 16px;
}

.advisor-controls .stage-toggle {
  min-height: 40px;
  max-width: 230px;
  font-size: 13px;
}

.stage-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid rgba(83, 255, 118, .32);
  border-radius: 8px;
  background: rgba(5, 18, 24, .72);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.stage-toggle input {
  order: 2;
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(175, 207, 194, .38);
  border-radius: 999px;
  background: rgba(175, 207, 194, .16);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.stage-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform .16s ease, background .16s ease;
}

.stage-toggle input:checked {
  border-color: rgba(83, 255, 118, .74);
  background: rgba(83, 255, 118, .24);
  box-shadow: 0 0 18px rgba(83, 255, 118, .12);
}

.stage-toggle input:checked::before {
  transform: translateX(20px);
  background: var(--green);
}

.stage-toggle span {
  min-width: 0;
}

.ai-advice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.ai-advice-grid article {
  min-height: 170px;
  padding: 18px;
  border: 1px solid rgba(77, 233, 255, .24);
  border-radius: 18px;
  background: rgba(5, 18, 24, .74);
}

.ai-advice-grid span {
  display: block;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.ai-advice-grid strong {
  display: block;
  margin: 10px 0 8px;
  color: var(--text);
  font-size: 23px;
  line-height: 1.08;
  letter-spacing: -.03em;
}

.ai-advice-grid p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.config-panel {
  border-color: rgba(124, 244, 255, .3);
}

.config-summary {
  cursor: pointer;
  list-style: none;
}

.config-summary::-webkit-details-marker {
  display: none;
}

.config-toggle-text {
  flex: 0 0 auto;
  min-width: 168px;
  padding: 15px 20px;
  border: 1px solid rgba(124, 244, 255, .52);
  border-radius: 8px;
  background: rgba(124, 244, 255, .12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.config-panel .when-open {
  display: none;
}

.config-panel[open] .when-closed {
  display: none;
}

.config-panel[open] .when-open {
  display: inline;
}

.config-content {
  margin-top: 18px;
}

.config-edit-hint {
  max-width: 720px;
  margin-top: 8px;
}

.config-edit-hint a {
  color: var(--cyan);
  font-weight: 800;
}

.config-template-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  align-items: end;
  gap: 18px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(124, 244, 255, .22);
  border-radius: 8px;
  background: rgba(5, 18, 24, .44);
}

.config-template-panel h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.config-template-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.config-template-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.config-template-selector {
  flex: 0 1 260px;
  margin-left: 0;
}

.config-template-selector select {
  border-color: rgba(83, 255, 118, .36);
}

.config-stage-toggle {
  flex: 0 0 230px;
}

.seedling-swal-popup {
  border: 1px solid rgba(83, 255, 118, .34);
  border-radius: 10px;
  background: #051218;
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .48);
}

.seedling-swal-title {
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
}

.seedling-swal-html {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.seedling-swal-confirm {
  border: 1px solid rgba(83, 255, 118, .44);
  border-radius: 8px;
  background: rgba(83, 255, 118, .16);
  color: var(--text);
  font-weight: 900;
}

.config-grid,
.config-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.config-detail-grid {
  margin-top: 12px;
}

.state-calendar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(124, 244, 255, .14);
  border-radius: 8px;
  background: rgba(5, 18, 24, .34);
}

.state-calendar h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.state-calendar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.state-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.state-calendar-legend span,
.state-day {
  position: relative;
}

.state-calendar-legend span::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 2px;
  content: "";
}

.state-calendar-legend .ok::before,
.state-day.ok {
  background: rgba(66, 242, 112, .5);
}

.state-calendar-legend .warn::before,
.state-day.warn {
  background: rgba(248, 223, 112, .55);
}

.state-calendar-legend .bad::before,
.state-day.bad {
  background: rgba(255, 98, 93, .58);
}

.state-calendar-legend .empty::before,
.state-day.empty {
  background: rgba(175, 207, 194, .16);
}

.state-calendar-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-column: 1 / -1;
  gap: 4px;
  width: 100%;
}

.state-day {
  min-width: 0;
  aspect-ratio: 2;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 4px;
  color: rgba(234, 255, 239, .76);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.state-day:hover,
.state-day:focus-visible {
  border-color: rgba(234, 255, 239, .72);
  outline: none;
  transform: translateY(-1px);
}

.state-day.active {
  border-color: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 2px rgba(124, 244, 255, .2);
}

.config-grid article,
.config-detail-grid article {
  min-height: 152px;
  padding: 16px;
  border: 1px solid rgba(124, 244, 255, .22);
  border-radius: 8px;
  background: rgba(5, 18, 24, .62);
}

.config-grid span,
.config-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1.35;
  text-transform: uppercase;
}

.config-grid strong,
.config-detail-grid strong {
  display: block;
  margin: 9px 0 6px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
}

.config-grid code,
.config-detail-grid code {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 5px 7px;
  border: 1px solid rgba(124, 244, 255, .22);
  border-radius: 6px;
  background: rgba(124, 244, 255, .08);
  color: #c9f7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.config-grid p,
.config-detail-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 16px;
  border-radius: 18px;
  background: #0b1f2a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 18px 60px rgba(0, 0, 0, .18);
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 138px;
  padding: 10px 12px;
  border: 1px solid rgba(124, 244, 255, .42);
  border-radius: 14px;
  background: rgba(13, 43, 53, .94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
  color: var(--text);
  pointer-events: none;
  transform: translateY(-50%);
  backdrop-filter: blur(18px);
}

.chart-tooltip span {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  box-shadow: 0 0 14px currentColor;
}

.chart-tooltip b,
.chart-tooltip strong,
.chart-tooltip small {
  display: block;
}

.chart-tooltip b {
  margin-top: -13px;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
}

.chart-tooltip strong {
  margin-top: 5px;
  font-size: 20px;
  line-height: 1;
}

.chart-tooltip small {
  margin-top: 5px;
  color: var(--green);
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
}

.legend span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
}

.red { color: var(--red); }
.green { color: var(--green); }
.soil { color: #7cff86; }
.blue { color: var(--blue); }
.yellow { color: #f8df70; }
.cyan { color: var(--cyan); }
.orange { color: var(--orange); }

.relay-grid div {
  padding: 18px;
  border: 1px solid rgba(83, 255, 118, .24);
  border-radius: 18px;
  background: rgba(6, 23, 29, .74);
}

.relay-grid span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.relay-grid b {
  color: var(--green);
}

.relay-grid small {
  margin-top: 8px;
  font-weight: 700;
}

.center-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.upgrade-page {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px;
}

.upgrade-page .dashboard-header h1 {
  max-width: 900px;
  font-size: 52px;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.upgrade-note p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.upgrade-panel {
  margin-top: 18px;
}

.upgrade-docs-panel {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.upgrade-docs-panel p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.firmware-summary-grid div,
.firmware-file-item {
  padding: 15px;
  border: 1px solid rgba(77, 233, 255, .22);
  border-radius: 18px;
  background: rgba(5, 18, 24, .58);
}

.firmware-summary-grid span,
.firmware-file-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.firmware-summary-grid b,
.firmware-file-item b {
  display: block;
  margin-top: 6px;
  color: var(--text);
}

.firmware-file-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.firmware-file-item.warning {
  color: var(--orange);
}

.upgrade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.upgrade-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 760px;
  margin-top: 28px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 189, 89, .26);
  border-radius: 18px;
  background: rgba(255, 189, 89, .07);
  color: var(--text);
  cursor: pointer;
}

.upgrade-option input {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--orange);
}

.upgrade-option b,
.upgrade-option small {
  display: block;
}

.upgrade-option small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.upgrade-warning {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.upgrade-done {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(83, 255, 118, .46);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(54, 255, 96, .2), rgba(67, 225, 255, .1));
  color: var(--text);
}

.upgrade-done[hidden] {
  display: none;
}

.upgrade-done b {
  color: var(--green);
}

.upgrade-done span {
  color: #dfffe8;
}

.upgrade-progress {
  margin-top: 18px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 900;
}

.progress-track {
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  transition: width .2s ease;
}

.upgrade-flash {
  margin-top: 18px;
}

.upgrade-log {
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(124, 244, 255, .28);
  border-radius: 18px;
  background: rgba(3, 14, 19, .78);
  color: #d8fff1;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .landing,
  .dashboard,
  .upgrade-page {
    padding: 18px;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid,
  .cards,
  .steps,
  .feature-grid,
  .contact-section,
  .contact-card,
  .ai-advice-grid,
  .day-summary,
  .state-calendar,
  .config-template-panel,
  .config-grid,
  .config-detail-grid,
  .relay-grid,
  .upgrade-grid,
  .hardware-section,
  .hardware-visuals {
    grid-template-columns: 1fr;
  }

  .state-calendar-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .config-template-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .upgrade-docs-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-grid {
    gap: 34px;
    padding: 46px 0 20px;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

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

  h1 {
    font-size: 42px;
  }

  .contact-copy h2 {
    font-size: 34px;
  }

  .hardware-copy h2 {
    font-size: 36px;
  }

  .hardware-card,
  .hardware-card img {
    min-height: 280px;
  }

  .dashboard-header,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .connection-alert {
    align-items: flex-start;
    flex-direction: column;
  }

  .connection-alert span {
    text-align: left;
  }

  .upgrade-page .dashboard-header h1 {
    font-size: 38px;
  }

  .firmware-summary-grid {
    grid-template-columns: 1fr;
  }

  .preview-metrics {
    flex-direction: column;
  }

  .preview-metrics div {
    width: 100%;
  }

  .product-photo {
    min-height: 300px;
    padding: 22px;
  }

  .product-photo img {
    max-width: 88%;
    max-height: 270px;
  }

  .hero-photo {
    min-height: 520px;
  }

  .hero-photo img {
    max-width: 92%;
    max-height: 470px;
  }

  .photo-badge {
    left: 14px;
    right: 14px;
    bottom: 14px;
    justify-content: space-between;
  }
}
