:root {
  --bg: #f8f5ed;
  --surface: #ffffff;
  --green: #174c3c;
  --green-soft: #e7f0ec;
  --gold: #a67c37;
  --text: #17231f;
  --muted: #66736e;
  --border: #dde4df;
  --danger: #973c34;
  --radius: 22px;
  --shadow: 0 8px 28px rgba(23,76,60,.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  font-size: 20px;
  line-height: 1.5;
}

button { font: inherit; }

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 104px;
}

.topbar {
  padding: 20px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.demo {
  margin: 4px 20px 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff4d7;
  color: #664e16;
  font-size: 14px;
  font-weight: 700;
}

main { padding: 0 20px; }

.screen { display: none; }
.screen.active { display: block; }

.hero {
  background: var(--green);
  color: white;
  padding: 26px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 14px;
  font-weight: 800;
  opacity: .78;
}

.hero h1 {
  font-size: 36px;
  line-height: 1.08;
  margin: 0 0 8px;
}

.hero p { margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
}

.card p { margin: 8px 0; }

.muted {
  color: var(--muted);
  font-size: 17px;
}

.primary {
  border: 0;
  width: 100%;
  min-height: 60px;
  margin-top: 18px;
  border-radius: 16px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.secondary {
  border: 2px solid var(--green);
  width: 100%;
  min-height: 58px;
  border-radius: 16px;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.progress-line {
  height: 12px;
  border-radius: 999px;
  background: #e5ebe8;
  overflow: hidden;
  margin-top: 12px;
}

.progress-line span {
  display: block;
  height: 100%;
  width: 75%;
  background: var(--gold);
}

.week {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.done {
  color: var(--green);
  font-weight: 800;
}

.install-card {
  border: 2px dashed #c8d4cf;
}

.install-status {
  font-size: 16px;
  color: var(--muted);
}

.guide-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 520px);
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  z-index: 10;
}

.nav-btn {
  border: 0;
  background: transparent;
  min-height: 62px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.nav-btn.active {
  background: var(--green-soft);
  color: var(--green);
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  z-index: 30;
  display: none;
  padding: 20px;
  align-items: end;
}

.sheet.show { display: flex; }

.sheet-box {
  width: min(100%, 480px);
  margin: 0 auto;
  background: white;
  border-radius: 24px;
  padding: 24px;
}

.sheet-box h2 {
  margin-top: 0;
  font-size: 26px;
}

.sheet-box ol {
  padding-left: 26px;
}

@media (min-width: 700px) {
  .app {
    margin-top: 24px;
    min-height: calc(100vh - 24px);
    border-radius: 28px 28px 0 0;
  }
}

/* =========================================
   INSTALL-FIRST UX
   ========================================= */

.install-card {
  position: relative;
  overflow: hidden;
  border: 2px solid #c99b42;
  background: #fffaf0;
  margin-top: 0;
  margin-bottom: 18px;
}

.install-card.install-attention {
  animation: installPulse 2.2s ease-in-out infinite;
}

@keyframes installPulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(23,76,60,.08),
                0 0 0 0 rgba(198,161,91,.20);
  }
  50% {
    box-shadow: 0 10px 32px rgba(23,76,60,.12),
                0 0 0 8px rgba(198,161,91,.10);
  }
}

.install-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.install-pulse-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 8px;
  border-radius: 999px;
  background: #c6a15b;
  animation: installDotPulse 1.25s ease-in-out infinite;
}

@keyframes installDotPulse {
  0%, 100% {
    transform: scale(.85);
    opacity: .55;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

.install-card.installed {
  border-color: #174c3c;
  background: #edf5f1;
  animation: none;
}

.install-card.installed .install-pulse-dot {
  background: #174c3c;
  animation: none;
}

.install-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2e2b9;
  color: #5d4818;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .03em;
  margin-bottom: 10px;
}

.install-card.installed .install-badge {
  background: #d9e9e1;
  color: #174c3c;
}

.device-label {
  font-size: 16px;
  font-weight: 800;
  color: #174c3c;
  margin: 10px 0 0;
}

.install-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(23,76,60,.06);
  color: #41504a;
  font-size: 15px;
}

.install-note strong {
  color: #17231f;
}

.install-button-attention {
  position: relative;
}

.install-button-attention::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(198,161,91,.55);
  border-radius: 20px;
  animation: installButtonPulse 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes installButtonPulse {
  0% {
    transform: scale(.98);
    opacity: .7;
  }
  100% {
    transform: scale(1.04);
    opacity: 0;
  }
}

.install-sheet-steps {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.install-sheet-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  background: #f4f6f4;
}

.install-step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 999px;
  background: #174c3c;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
}

@media (prefers-reduced-motion: reduce) {
  .install-card.install-attention,
  .install-pulse-dot,
  .install-button-attention::after {
    animation: none !important;
  }
}

/* =======================================
   SLICE 2 — AUTH / ONBOARDING
   ======================================= */

.boot,
.fatal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  background: var(--bg);
  color: var(--green);
  font-weight: 800;
}

.auth-shell,
.onboarding-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.auth-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 14px 0 28px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 34px;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.auth-card,
.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.auth-tab {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: #edf1ef;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  background: var(--green);
  color: white;
}

label {
  display: block;
  margin: 16px 0 7px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 2px solid #d9e0dc;
  border-radius: 14px;
  background: white;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(23,76,60,.12);
  border-color: var(--green);
}

.field-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.error-text {
  padding: 12px;
  border-radius: 12px;
  background: #fff0ee;
  color: #8d322b;
  font-size: 16px;
  font-weight: 700;
}

.simple-header {
  margin-bottom: 18px;
}

.simple-header h1 {
  margin: 2px 0 6px;
  font-size: 34px;
}

.simple-header p {
  color: var(--muted);
}

.onboarding-form {
  display: grid;
  gap: 16px;
}

.form-card {
  margin: 0;
}

.form-card h2 {
  margin: 8px 0 14px;
  font-size: 26px;
  line-height: 1.2;
}

.form-card h3 {
  margin: 22px 0 8px;
}

.step-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice {
  margin: 0;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 11px 15px;
  border: 2px solid #d9e0dc;
  border-radius: 14px;
  background: white;
}

.choice input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.sticky-save {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  box-shadow: 0 8px 30px rgba(23,76,60,.22);
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: #e7f0ec;
  color: var(--green);
  font-size: 24px;
  font-weight: 900;
}

.installed-mini {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #cfe0d7;
  border-radius: 15px;
  background: #edf5f1;
  color: var(--green);
}

.installed-mini > span {
  font-size: 22px;
  font-weight: 900;
}

.installed-mini strong {
  display: block;
  font-size: 16px;
}

.installed-mini small {
  display: block;
  margin-top: 2px;
  color: #53655d;
  font-size: 13px;
}

.install-compact {
  padding: 16px;
}

.install-compact-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.install-compact-row strong {
  display: block;
  font-size: 18px;
}

.compact-action {
  min-height: 50px;
  margin-top: 12px;
}

:root[data-text-size="xlarge"] body {
  font-size: 23px;
}

:root[data-text-size="xlarge"] .muted {
  font-size: 20px;
}

:root[data-text-size="xlarge"] .nav-btn {
  font-size: 15px;
}
