:root {
  --ink: #15251e;
  --muted: #718078;
  --forest: #123e2f;
  --forest-2: #1c5942;
  --mint: #bce8cb;
  --mist: #eff5ef;
  --cream: #f7f5ed;
  --card: #fff;
  --line: #dfe7df;
  --danger: #b83b31;
  --shadow: 0 16px 40px rgba(24, 58, 44, 0.08);
}
* { box-sizing: border-box; }
html {
  color-scheme: light;
  background: var(--cream);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 80% -10%, rgba(188,232,203,.7), transparent 34%), var(--cream);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #71b58c; outline-offset: 2px; }
[hidden] { display: none !important; }
main { width: min(100%, 760px); margin: 0 auto; }
.offline-banner {
  position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: #fff1c9;
  color: #694f00; text-align: center; font-size: .86rem; font-weight: 700;
}
.login-view { min-height: 100vh; display: grid; align-content: center; padding: 26px 20px 40px; }
.login-art {
  position: relative; height: 190px; margin-bottom: -34px; overflow: hidden;
  border-radius: 32px 32px 0 0;
  background: linear-gradient(145deg, transparent 55%, rgba(255,255,255,.12) 56%), var(--forest);
}
.drop {
  position: absolute; display: block; width: 74px; height: 96px;
  border-radius: 60% 40% 65% 35% / 65% 35% 65% 35%;
  transform: rotate(40deg); background: var(--mint); opacity: .95;
}
.drop-one { top: 35px; right: 54px; }
.drop-two { width: 34px; height: 44px; top: 102px; right: 132px; opacity: .45; }
.sprout { position: absolute; left: 28px; top: 25px; color: rgba(255,255,255,.2); font-size: 8rem; transform: rotate(-30deg); }
.login-card { position: relative; padding: 34px 26px 28px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.eyebrow, .status-label { margin: 0 0 6px; color: #6f8578; font-size: .7rem; font-weight: 800; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem, 10vw, 3.5rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -.025em; }
.login-copy { margin-bottom: 28px; color: var(--muted); line-height: 1.55; }
label { display: block; margin-bottom: 8px; font-size: .84rem; font-weight: 750; }
input {
  width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 14px;
  padding: 0 15px; background: #fbfdfb; color: var(--ink); font-size: 1.1rem;
}
.primary-button, .stop-button {
  width: 100%; min-height: 58px; border: 0; border-radius: 16px; padding: 14px 18px;
  font-weight: 800; cursor: pointer;
}
.primary-button { margin-top: 14px; background: var(--forest); color: #fff; box-shadow: 0 8px 18px rgba(18,62,47,.2); }
.primary-button:disabled, .stop-button:disabled { cursor: wait; opacity: .55; }
.stop-button { margin-top: 16px; border: 1px solid #f1c4c0; background: #fff0ee; color: var(--danger); }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: .85rem; }
.dashboard { padding: 20px 16px 64px; }
.app-header, .status-top, .section-heading, .progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.app-header { padding: 8px 4px 22px; }
.app-header h1 { margin: 0; font-size: 2rem; }
.icon-button {
  min-height: 44px; border: 1px solid var(--line); border-radius: 999px; padding: 0 15px;
  background: rgba(255,255,255,.7); color: var(--forest); font-size: .78rem; font-weight: 800; cursor: pointer;
}
.message { margin: 0 0 14px; border: 1px solid #ccdccc; border-radius: 12px; padding: 12px 14px; background: #f5fbf5; font-size: .88rem; }
.message.error { border-color: #f1c4c0; background: #fff0ee; color: var(--danger); }
.status-card {
  overflow: hidden; border-radius: 26px; padding: 24px 20px 20px;
  background: radial-gradient(circle at 90% 5%, rgba(188,232,203,.18), transparent 30%), var(--forest);
  color: #fff; box-shadow: 0 18px 40px rgba(18,62,47,.17);
}
.status-top { align-items: flex-start; }
.status-label { color: #9fbea9; }
.status-card h2 { display: flex; align-items: center; gap: 9px; }
.state-dot { width: 10px; height: 10px; border-radius: 50%; background: #d2d9d4; box-shadow: 0 0 0 5px rgba(210,217,212,.1); }
.state-dot.on { background: #8eebac; box-shadow: 0 0 0 5px rgba(142,235,172,.14); }
.state-dot.error { background: #ffb4ad; }
.status-symbol { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.09); color: var(--mint); font-size: 1.7rem; }
.metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 26px; }
.metrics > div { min-width: 0; border-left: 1px solid rgba(255,255,255,.13); padding-left: 12px; }
.metrics > div:first-child { border-left: 0; padding-left: 0; }
.metrics span, .metrics small { display: block; color: #a8c2b1; font-size: .67rem; }
.metrics strong { display: block; overflow: hidden; margin: 5px 0 1px; font-size: clamp(1.15rem,5vw,1.65rem); text-overflow: ellipsis; white-space: nowrap; }
.active-progress { margin-top: 20px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 16px; }
.progress-copy { color: #c5d8cb; font-size: .78rem; }
.progress-copy strong { color: #fff; }
.progress-track { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--mint); transition: width .4s ease; }
.control-card, .trend-card {
  margin-top: 16px; border: 1px solid rgba(223,231,223,.8); border-radius: 24px;
  padding: 22px 18px; background: var(--card); box-shadow: var(--shadow);
}
.section-heading { margin-bottom: 18px; }
.section-heading h2 { font-size: 1.22rem; }
.max-pill { border-radius: 99px; padding: 7px 10px; background: var(--mist); color: var(--forest-2); font-size: .72rem; font-weight: 800; }
.mode-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--mist); }
.mode-tab { min-height: 44px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.mode-tab.active { background: #fff; color: var(--forest); box-shadow: 0 3px 10px rgba(30,63,49,.08); }
.mode-panel { padding-top: 20px; }
.input-with-unit { position: relative; }
.input-with-unit input { padding-right: 74px; font-size: 1.35rem; font-weight: 750; }
.input-with-unit span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8rem; font-weight: 750; }
.quick-values { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-top: 10px; }
.quick-values button { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-weight: 750; cursor: pointer; }
.quick-values button.selected { border-color: #8cb9a0; background: #edf8f0; color: var(--forest); }
.panel-note, .manual-copy { margin: 14px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.manual-copy { border-radius: 14px; padding: 15px; background: var(--mist); }
.start-button { margin-top: 18px; }
.safety-note { display: flex; gap: 8px; margin: 15px 2px 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.safety-note span { color: var(--forest-2); font-weight: 900; }
.summary-section, .history-section { margin-top: 30px; padding: 0 2px; }
.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.summary-grid article { border: 1px solid var(--line); border-radius: 17px; padding: 15px 11px; background: rgba(255,255,255,.66); }
.summary-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .7rem; }
.summary-grid strong { font-size: 1.08rem; }
.trend-chart { display: grid; height: 150px; grid-template-columns: repeat(7,1fr); align-items: end; gap: 8px; padding-top: 8px; }
.trend-day { display: grid; height: 100%; grid-template-rows: 1fr auto; align-items: end; gap: 8px; text-align: center; }
.trend-bar-wrap { display: flex; height: 100%; align-items: end; justify-content: center; }
.trend-bar { width: min(26px,80%); min-height: 4px; border-radius: 8px 8px 3px 3px; background: var(--mint); }
.trend-day.today .trend-bar { background: var(--forest-2); }
.trend-day span { color: var(--muted); font-size: .68rem; }
.history-list { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.7); }
.history-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 14px; }
.history-item:last-child { border-bottom: 0; }
.history-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--mist); color: var(--forest-2); font-size: 1.1rem; }
.history-main strong, .history-main span { display: block; }
.history-main strong { margin-bottom: 3px; font-size: .88rem; }
.history-main span, .history-value span { color: var(--muted); font-size: .7rem; }
.history-value { text-align: right; }
.history-value strong { display: block; margin-bottom: 3px; font-size: .92rem; }
.history-empty { padding: 28px 18px; color: var(--muted); text-align: center; font-size: .86rem; }
@media (min-width: 620px) {
  .login-view { grid-template-columns: .82fr 1.18fr; align-items: stretch; padding-top: 70px; padding-bottom: 70px; }
  .login-art { height: auto; margin: 0 -30px 0 0; border-radius: 32px 0 0 32px; }
  .login-card { display: grid; align-content: center; min-height: 530px; padding: 48px 42px; }
  .dashboard { padding-right: 24px; padding-left: 24px; }
  .status-card, .control-card, .trend-card { padding-right: 26px; padding-left: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
