:root {
  color-scheme: dark;
  --page: #102320;
  --card: #18312c;
  --card-deep: #132a26;
  --line: #36534a;
  --text: #f1efdc;
  --muted: #b6c9bb;
  --accent: #dfebaa;
  --accent-ink: #1a2c20;
  --radius: 20px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: radial-gradient(ellipse at 78% 10%, #1b382f 0%, var(--page) 49%);
  color: var(--text);
  line-height: 1.58;
}
a { color: var(--accent); text-underline-offset: .24em; }
a:hover { color: #f0f9c8; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #e3f3a4; outline-offset: 4px; }
.shell { width: min(1152px, calc(100% - 72px)); margin-inline: auto; }
.skip-link {
  position: absolute;
  z-index: 3;
  top: .8rem;
  left: .8rem;
  padding: .6rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand, .site-nav { display: flex; align-items: center; gap: .8rem; }
.brand { color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #506b57;
  border-radius: 11px;
  color: var(--accent);
  background: #203b30;
}
.brand-icon svg { width: 26px; height: 26px; }
.brand-name { font-size: 1.15rem; font-weight: 740; }
.brand-caption { color: var(--muted); font-size: .85rem; }
.site-nav { gap: 1.15rem; }
.nav-form { margin: 0; }
.text-link { color: var(--text); text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.main { flex: 1; padding-block: clamp(42px, 8vw, 100px) clamp(48px, 7vw, 86px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); align-items: center; gap: clamp(36px, 7vw, 88px); }
.hero h1, .auth-aside h1, .page-heading h1 {
  margin: .15em 0 .24em;
  font-size: clamp(2.55rem, 6.6vw, 5.15rem);
  line-height: .99;
  font-weight: 760;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.auth-aside h1, .page-heading h1 { font-size: clamp(2.35rem, 5.8vw, 4.4rem); }
.eyebrow, .art-label, .label-muted {
  color: var(--muted);
  font-size: .77rem;
  font-weight: 720;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow { display: flex; align-items: center; gap: .55rem; margin: 0 0 1rem; }
.indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.lead { max-width: 41ch; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); margin: 0 0 1.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .72rem; }
.button {
  display: inline-flex;
  min-height: 46px;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 670;
  line-height: 1.2;
}
.button-small { min-height: 38px; font-size: .9rem; padding: .45rem .75rem; }
.button-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button-primary:hover { color: var(--accent-ink); background: #f0f9c8; border-color: #f0f9c8; }
.button-outline, .button-quiet { border-color: #62796a; }
.button-outline:hover, .button-quiet:hover { color: var(--text); background: #29463b; }
.button-wide { width: 100%; margin-top: .3rem; }
.hero-note { max-width: 48ch; margin: 1.1rem 0 0; font-size: .91rem; color: var(--muted); }
.hero-art {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at 51% 48%, #35574a, #1b3730 78%);
}
.hero-art svg { display: block; width: 100%; height: auto; }
.art-label { position: absolute; right: 8%; bottom: 8%; color: #d1e0ce; }
.feature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
  margin-top: clamp(42px, 8vw, 88px);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.feature { display: flex; align-items: flex-start; gap: .85rem; }
.feature-index { color: var(--accent); font-size: .85rem; font-variant-numeric: tabular-nums; }
.feature h2 { margin: -.13rem 0 .25rem; font-size: 1rem; }
.feature p, .auth-switch, .field-help, .device-meta, .device-note, .empty-state p { margin: 0; color: var(--muted); font-size: .92rem; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(30px, 7vw, 85px); align-items: start; max-width: 940px; margin-inline: auto; }
.auth-aside { padding-top: clamp(0px, 4vw, 42px); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.auth-card { padding: clamp(1.3rem, 4vw, 2.15rem); }
.field { display: grid; gap: .35rem; margin-bottom: 1.1rem; }
.field label { font-weight: 650; font-size: .92rem; }
.field input { min-width: 0; width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1px solid #668171; border-radius: 8px; color: var(--text); background: var(--card-deep); }
.field-help { font-size: .82rem; }
.field-help ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.form-error { color: #ffb7aa; font-size: .88rem; }
.form-error ul { margin: .25rem 0 .5rem; padding-left: 1.2rem; }
.auth-switch { margin: 1.05rem 0 0; text-align: center; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.4rem; margin-bottom: 1.8rem; }
.page-heading .lead { margin: 0; overflow-wrap: anywhere; }
.page-actions { flex-shrink: 0; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.stat { display: grid; gap: .15rem; padding: 1rem 1.3rem; }
.stat-label { color: var(--muted); font-size: .89rem; }
.stat strong { color: var(--accent); font-size: 2rem; line-height: 1.12; font-variant-numeric: tabular-nums; }
.plant-card { background: linear-gradient(145deg, #284739, var(--card) 70%); }
.plant-card .device-head { margin-bottom: .1rem; }
.plant-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: .75rem 0; }
.plant-moisture { grid-column: 1 / -1; }
.plant-metrics dt { color: var(--muted); font-size: .8rem; }
.plant-metrics dd { margin: 0; }
.plant-metrics dd:not(.device-meta) { color: var(--accent); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.plant-moisture dd:not(.device-meta) { font-size: 2.65rem; }
.plant-metrics small { font-size: .55em; }
.plant-update { margin: .3rem 0 0; color: var(--muted); font-size: .8rem; }
.plant-needs-water { background: linear-gradient(145deg, #633533, #382728 75%); border-color: #ba7067; }
.plant-needs-water .plant-moisture dd { color: #ffd3c8; }
.plant-water-status { color: #ffd4cc; background: #682e2e; }
.plant-water-status[hidden] { display: none; }
.plant-history { margin-bottom: .85rem; }
.plant-history-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; column-gap: 1rem; }
[data-moisture-chart]:not([hidden]) { display: block; width: 100%; height: clamp(190px, 30vw, 270px); }
.device-section { margin-top: clamp(1.8rem, 4vw, 3.1rem); }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.section-heading h2, .empty-state h2 { margin: 0; font-size: 1.5rem; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.device-card { padding: 1rem 1.2rem 1.2rem; overflow-wrap: anywhere; }
.device-head { display: flex; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .8rem; }
.device-icon { width: 39px; height: 39px; flex: none; display: grid; place-items: center; border: 1px solid #587365; border-radius: 10px; color: var(--accent); }
.device-icon svg { width: 26px; height: 26px; }
.status { display: inline-flex; align-items: center; gap: .43rem; padding: .28rem .52rem; border-radius: 8px; color: #dde8cf; background: #334a37; font-size: .77rem; line-height: 1.25; }
.status span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status-pending { color: #f1d8a3; background: #493e27; }
.status-connected { color: #cceca4; background: #344c2c; }
.status-offline { color: #fac1b6; background: #523631; }
.device-card h3, .empty-state h3 { margin: 0 0 .24rem; font-size: 1.14rem; }
.device-note { margin-top: .75rem; }
.empty-state { padding: clamp(1.2rem, 4vw, 2rem); }
.empty-state p { margin: .45rem 0; max-width: 56ch; }
.pending-state { max-width: 660px; }
.pending-state .status { margin-bottom: .65rem; }
.messages { margin-bottom: 1rem; }
.message { padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--card); }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { min-height: 56px; font-size: .8rem; }
@media (max-width: 850px) {
  .shell { width: calc(100% - 44px); }
  .hero { gap: 1.65rem; }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 620px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 64px; }
  .brand-caption, .footer-inner span:last-child { display: none; }
  .site-nav { gap: .75rem; }
  .hero, .auth-layout, .feature-row { grid-template-columns: 1fr; }
  .hero-art { max-width: 460px; }
  .feature-row { gap: 1.15rem; }
  .auth-aside { padding-top: 0; }
  .main { padding-top: 44px; }
  .summary { gap: .4rem; }
  .stat { padding: .75rem .5rem; }
  .stat-label { font-size: .75rem; }
  .device-grid { grid-template-columns: 1fr; }
}
@media (max-width: 350px) {
  .site-nav { gap: .5rem; }
  .brand { gap: .35rem; }
  .button-small { padding-inline: .5rem; }
}

.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.activity-card { min-width: 0; padding: 1.1rem 1.25rem; }
.activity-card h3 { margin: 0 0 .65rem; font-size: 1.08rem; }
.activity-empty, .activity-detail { margin: 0; color: var(--muted); font-size: .9rem; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { display: grid; gap: .22rem; padding-block: .55rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.activity-list time { color: var(--muted); font-size: .8rem; }
.activity-list pre { max-height: 8rem; overflow: auto; margin: .3rem 0 .2rem; padding: .55rem .65rem; border-radius: 7px; color: var(--text); background: var(--card-deep); font-size: .82rem; white-space: pre-wrap; }
.activity-list a { width: fit-content; }
@media (max-width: 620px) {
  .activity-grid { grid-template-columns: 1fr; }
}

.camera-card-action { margin: .85rem 0 0; }
.camera-rename { margin-top: .5rem; }
.camera-rename summary { width: fit-content; padding-block: .35rem; cursor: pointer; color: var(--accent); font-size: .9rem; }
.camera-rename summary:hover { color: #f0f9c8; }
.camera-rename-form { margin-top: .35rem; }
.camera-rename-form .field { margin-bottom: .55rem; }
.camera-player { padding: clamp(.55rem, 2vw, 1.1rem); }
.camera-player video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) - .5rem);
  background: #0a1513;
  object-fit: contain;
}
.camera-status { margin: .7rem .3rem .1rem; color: var(--muted); font-size: .9rem; }
