:root {
  --page: #f7f8f3;
  --text: #17201a;
  --muted: #5a665d;
  --green: #2f7d4f;
  --line: #dce2d7;
  --google-blue: #4d82ee;
}

* {
  box-sizing: border-box;
}

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

main {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.device-dashboard {
  width: min(1120px, calc(100% - 32px));
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0;
}

.site-logo {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-nav form {
  margin: 0;
}

.account-label {
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.8rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

a,
button {
  color: var(--green);
  font-weight: 700;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  font: inherit;
  text-decoration: none;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: var(--muted);
}

.landing-page {
  background: #f6f8f4;
}

.landing-page .site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid rgba(23, 32, 26, 0.08);
  background: rgba(246, 248, 244, 0.92);
  backdrop-filter: blur(12px);
}

.landing-main {
  width: min(1120px, calc(100% - 32px));
  padding: 48px 0 0;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  gap: 48px;
  align-items: center;
  min-height: 76vh;
  padding: 32px 0 72px;
}

.hero-copy {
  animation: rise-in 0.7s ease both;
}

.hero-copy h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: 5rem;
  line-height: 0.96;
}

.hero-subheadline {
  max-width: 640px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.55;
}

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

.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.ghost-button {
  border-color: #b8c7bc;
  color: var(--text);
}

.product-panel {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  animation: rise-in 0.8s ease 0.1s both;
}

.product-panel img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
}

.product-readout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 40px rgba(23, 32, 26, 0.14);
  backdrop-filter: blur(14px);
}

.product-readout div {
  display: grid;
  gap: 8px;
}

.product-readout span,
.feature-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.product-readout strong {
  color: var(--text);
  font-size: 1.3rem;
}

.landing-section {
  padding: 84px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: center;
}

.landing-section h2,
.landing-cta h2 {
  margin-bottom: 14px;
  font-size: 3rem;
  line-height: 1.05;
}

.landing-section p,
.landing-cta p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.split-section,
.why-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 44px;
  align-items: start;
}

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

.feature-card,
.step-card {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(23, 32, 26, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover,
.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 42px rgba(23, 32, 26, 0.1);
}

.feature-card h3,
.step-card h3 {
  margin: 18px 0 10px;
  font-size: 1.35rem;
}

.step-card span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e6f1e8;
  color: var(--green);
  font-weight: 900;
}

.why-list {
  display: grid;
  gap: 12px;
}

.why-list p {
  margin: 0;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 14px 16px;
  background: #ffffff;
  color: var(--text);
  font-weight: 750;
}

.vision-section {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.landing-cta {
  display: grid;
  justify-items: center;
  margin: 28px 0 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 54px 24px;
  background: #17201a;
  text-align: center;
}

.landing-cta h2,
.landing-cta p {
  color: #ffffff;
}

.landing-cta p {
  max-width: 560px;
  opacity: 0.78;
}

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 24px 0 34px;
  color: var(--muted);
}

.landing-footer a {
  color: var(--green);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-page {
  background: #ffffff;
}

.auth-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(420px, calc(100% - 32px));
  min-height: 100vh;
  padding: 32px 0;
}

.quiet-link {
  position: absolute;
  top: 24px;
  left: 0;
  color: #c94a43;
  text-decoration: none;
}

.auth-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px 24px;
  background: #ffffff;
  text-align: center;
}

.brand-mark {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: 1.75rem;
}

.auth-copy,
.terms-copy {
  color: var(--muted);
}

.auth-copy {
  margin-bottom: 24px;
}

.auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
}

.google-button {
  color: #ffffff;
  background: var(--google-blue);
}

.google-dot {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--google-blue);
  font-size: 0.86rem;
  font-weight: 900;
}

.terms-copy {
  margin: 14px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.device-form {
  display: grid;
  gap: 12px;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.command-form {
  display: inline-flex;
  gap: 10px;
  margin: 0;
}

.command-row {
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.device-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.device-card-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.empty-image {
  background: #eef2eb;
}

.device-card-body {
  padding: 16px;
}

.device-card-topline,
.device-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.device-card h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.device-card p {
  margin-bottom: 8px;
  color: var(--muted);
}

.device-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.device-card-stats span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.device-card-stats strong {
  color: var(--text);
  font-size: 1rem;
}

.device-card-footer {
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.device-overview {
  width: min(1120px, calc(100% - 32px));
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.metric-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.35rem;
}

.detail-section {
  margin-top: 30px;
}

.device-hero,
.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
}

.connection-card,
.sensor-panel,
.latest-image-panel,
.command-panel,
.setup-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.connection-card {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
}

.connection-card span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.connection-card strong {
  font-size: 1.25rem;
}

.connection-card small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.connection-card.good {
  border-color: #91c9a6;
}

.connection-card.warning {
  border-color: #d6b25c;
}

.dashboard-split {
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  margin-top: 30px;
}

.dashboard-split,
.controls-grid {
  column-gap: 18px;
}

.sensor-panel,
.latest-image-panel,
.command-panel,
.command-history-panel {
  padding: 18px;
}

.latest-image-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.embedded-section {
  margin-top: 20px;
}

.embedded-section .section-heading {
  margin-bottom: 10px;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  font-size: 0.92rem;
}

.trend-list {
  display: grid;
  gap: 12px;
}

.range-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.range-picker a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.range-picker a.active {
  border-color: var(--green);
  background: #f3fbf5;
  color: var(--green);
}

.trend-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.trend-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.trend-heading span {
  color: var(--muted);
  font-weight: 800;
}

.trend-heading small,
.section-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chart-shell {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
}

.y-axis,
.x-axis {
  color: var(--muted);
  font-size: 0.78rem;
}

.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 86px;
  text-align: right;
}

.chart-body {
  min-width: 0;
}

.spark-bars {
  display: grid;
  grid-template-columns: repeat(var(--point-count), minmax(3px, 1fr));
  align-items: end;
  gap: 3px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fdfefb;
}

.spark-bars span {
  position: relative;
  min-height: 4px;
  height: var(--bar-height);
  border-radius: 5px 5px 2px 2px;
  background: var(--green);
}

.spark-bars span::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 2;
  width: max-content;
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(23, 32, 26, 0.12);
  color: var(--text);
  content: attr(data-tooltip);
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.spark-bars span:hover::after,
.spark-bars span:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.x-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.trend-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.trend-summary span {
  display: grid;
  gap: 2px;
}

.trend-summary strong {
  color: var(--text);
  font-size: 0.95rem;
}

.mini-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.command-panel p {
  color: var(--muted);
}

.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  align-items: stretch;
  margin-top: 18px;
}

.command-history-panel {
  min-height: 260px;
  max-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.command-panel {
  min-height: 300px;
}

.control-groups {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.control-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.control-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-group h3,
.control-group p {
  margin-bottom: 0;
}

.control-group p {
  margin-top: 8px;
  font-size: 0.94rem;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #91c9a6;
  border-radius: 8px;
  padding: 3px 9px;
  background: #f3fbf5;
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 800;
}

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

.light-toggle-switch {
  position: relative;
  display: inline-block;
  width: 88px;
  height: 42px;
  color: #ffffff;
}

.light-toggle-switch input[type="checkbox"][data-light-switch] {
  position: absolute;
  opacity: 0;
  width: 1px;
  min-width: 0;
  height: 1px;
  min-height: 0;
  margin: 0;
  border: 0;
  padding: 0;
  appearance: none;
  pointer-events: none;
}

.light-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border: 2px solid #e8ece7;
  border-radius: 8px;
  background-color: #555b57;
  transition: background-color 0.3s;
}

.light-toggle-slider::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(23, 32, 26, 0.2);
  transition: transform 0.3s;
}

.light-toggle-switch input:checked + .light-toggle-slider {
  border-color: #20d0a5;
  background-color: #20d0a5;
}

.light-toggle-switch input:checked + .light-toggle-slider::before {
  transform: translateX(46px);
}

.light-toggle-text {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
}

.light-toggle-switch input:checked + .light-toggle-slider .light-toggle-text {
  right: auto;
  left: 14px;
}

.light-toggle-switch input:disabled + .light-toggle-slider {
  opacity: 0.72;
  cursor: default;
}

.light-toggle-switch.is-pending .light-toggle-slider {
  opacity: 0.86;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.activity-list {
  display: grid;
  gap: 0;
  max-height: 216px;
  overflow-y: auto;
  padding-right: 4px;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.activity-item:first-child {
  padding-top: 0;
}

.activity-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-item div {
  display: grid;
  gap: 3px;
}

.activity-item span:not(.status-badge),
.activity-item p {
  color: var(--muted);
  font-size: 0.84rem;
}

.activity-item p {
  margin-bottom: 0;
}

.safety-copy {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.setup-details {
  padding: 14px 16px;
}

.setup-details summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 800;
}

.setup-details p {
  margin: 12px 0 0;
}

.status-badge {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 8px;
  background: #f7f8f3;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-badge.done {
  border-color: #91c9a6;
  background: #f3fbf5;
  color: var(--green);
}

.status-badge.good {
  border-color: #91c9a6;
  background: #f3fbf5;
  color: var(--green);
}

.status-badge.warning {
  border-color: #d6b25c;
  background: #fff9e9;
  color: #72591c;
}

.status-badge.failed {
  border-color: #e3aaa5;
  background: #fff4f3;
  color: #9b332b;
}

.status-badge.waiting,
.status-badge.sent,
.status-badge.muted {
  border-color: #b9c6b7;
  background: #f7f8f3;
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.landing-page .section-heading {
  display: block;
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

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

th {
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-thumbs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-thumbs img {
  aspect-ratio: 1 / 1;
}

@media (max-width: 760px) {
  h1 {
    font-size: 2.3rem;
  }

  .landing-main {
    width: min(100% - 24px, 1120px);
    padding-top: 24px;
  }

  .hero-copy h1 {
    font-size: 3.25rem;
  }

  .hero-subheadline {
    font-size: 1.08rem;
  }

  .landing-section h2,
  .landing-cta h2 {
    font-size: 2.25rem;
  }

  .landing-hero,
  .split-section,
  .why-section,
  .device-hero,
  .dashboard-split,
  .controls-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: auto;
    gap: 28px;
    padding-bottom: 48px;
  }

  .product-panel,
  .product-panel img {
    min-height: 360px;
  }

  .product-readout,
  .feature-grid,
  .step-grid {
    grid-template-columns: 1fr;
  }

  .landing-section {
    padding: 56px 0;
  }

  .landing-page .section-heading {
    display: block;
    text-align: left;
  }

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

  .site-header,
  .site-nav {
    align-items: flex-start;
  }

  .site-header {
    gap: 16px;
  }

  .site-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .hero-copy h1 {
    font-size: 2.55rem;
  }

  .landing-section h2,
  .landing-cta h2 {
    font-size: 1.95rem;
  }

  .hero-actions {
    display: grid;
  }

  .hero-actions .button,
  .landing-cta .button {
    justify-content: center;
    width: 100%;
  }

  .product-panel,
  .product-panel img {
    min-height: 300px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
