:root {
  --bg: #f5f1e8;
  --bg-soft: #ebe5d9;
  --ink: #17201e;
  --muted: #69736f;
  --line: #d7d0c4;
  --surface: #fffdf8;
  --surface-strong: #123c3a;
  --surface-ink: #eef8f4;
  --accent: #0d8177;
  --accent-strong: #09635b;
  --coral: #bd5d4c;
  --warning: #a46b16;
  --danger: #9e342e;
  --shadow: 0 18px 50px rgba(23, 32, 30, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--surface-ink);
  font-size: 0.95rem;
  font-weight: 850;
}

.button,
.nav-cta,
.table-button,
.checkin-actions button,
.habit-filter button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 16px;
  font-size: 0.92rem;
  font-weight: 760;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover,
.nav-cta:hover,
.table-button:hover,
.checkin-actions button:hover,
.habit-filter button:hover {
  transform: translateY(-1px);
}

.button-primary,
.nav-cta {
  background: var(--accent);
  color: #ffffff;
}

.button-primary:hover,
.nav-cta:hover {
  background: var(--accent-strong);
}

.button-secondary {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
}

.flash-stack {
  position: fixed;
  z-index: 20;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  max-width: min(92vw, 380px);
}

.flash {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.92rem;
}

.flash-success {
  border-left-color: var(--accent);
}

.flash-error {
  border-left-color: var(--danger);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(215, 208, 196, 0.75);
  background: rgba(245, 241, 232, 0.88);
  backdrop-filter: blur(16px);
}

.site-nav nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.94rem;
  font-weight: 680;
  color: var(--muted);
}

.site-nav nav a:hover {
  color: var(--ink);
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 760;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: clamp(28px, 5vw, 78px);
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: clamp(44px, 7vw, 92px) clamp(18px, 4vw, 56px) 48px;
}

.hero-copy {
  max-width: 720px;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 590px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.34rem);
  line-height: 1.55;
}

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

.hero-actions .button {
  min-width: 148px;
}

.product-preview,
.panel,
.auth-panel {
  border: 1px solid rgba(215, 208, 196, 0.84);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-preview {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.preview-top,
.preview-grid,
.preview-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-label,
.page-label,
.section-title span,
.metric-card span,
.preview-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-chip {
  border: 1px solid rgba(13, 129, 119, 0.25);
  border-radius: 999px;
  background: rgba(13, 129, 119, 0.1);
  color: var(--accent-strong);
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 760;
}

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

.preview-stat {
  border-radius: var(--radius);
  background: var(--bg);
  padding: 16px;
}

.preview-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.preview-list {
  display: grid;
  gap: 10px;
}

.preview-list div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}

.preview-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.preview-list span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
}

.preview-list strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.preview-bars,
.trend-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  height: 150px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 60, 58, 0.05), rgba(18, 60, 58, 0.1));
  padding: 16px;
}

.preview-bars i,
.trend-bars span {
  display: block;
  min-height: 8px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--surface-strong));
}

.feature-band,
.privacy-band {
  margin: 0 clamp(18px, 4vw, 56px) 26px;
  padding: clamp(32px, 5vw, 58px);
  border-top: 1px solid var(--line);
}

.feature-band h2,
.privacy-band h2 {
  max-width: 740px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.feature-band p,
.privacy-band p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.feature-row article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
  padding: 18px;
}

.feature-row strong,
.feature-row span {
  display: block;
}

.feature-row span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.privacy-band {
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--surface-ink);
}

.privacy-band p {
  color: rgba(238, 248, 244, 0.78);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(18px, 4vw, 56px);
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(13, 129, 119, 0.12), transparent 42%),
    var(--bg);
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 30px 18px;
}

.auth-brand {
  position: absolute;
  top: 24px;
  left: 28px;
}

.auth-panel {
  width: min(100%, 460px);
  padding: clamp(24px, 5vw, 38px);
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 1;
}

.auth-copy p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form,
.habit-form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 760;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 12px 13px;
  font-size: 0.96rem;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 129, 119, 0.12);
}

.field-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent-strong);
  font-weight: 800;
}

.app-body {
  background: #f7f3eb;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  border-radius: var(--radius);
  color: var(--muted);
  padding: 11px 12px;
  font-size: 0.94rem;
  font-weight: 780;
}

.side-nav a:hover {
  background: var(--bg);
  color: var(--ink);
}

.sidebar-exit {
  width: 100%;
  margin-top: auto;
}

.dashboard-main {
  display: grid;
  gap: 22px;
  padding: clamp(20px, 4vw, 42px);
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-header h1 {
  margin: 6px 0 0;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 1;
}

.level-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.level-card {
  min-width: 220px;
}

.level-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

.mini-progress {
  overflow: hidden;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--bg-soft);
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1;
}

.metric-warning {
  border-color: rgba(189, 93, 76, 0.48);
  background: #fff4ed;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-title strong {
  font-size: 1.18rem;
}

.recommendation-panel p {
  max-width: 800px;
  margin: 0;
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.45;
}

.trend-bars {
  height: 190px;
  background: var(--bg);
}

.trend-bars div {
  display: grid;
  align-items: end;
  height: 100%;
  gap: 8px;
}

.trend-bars small {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.habit-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.habit-filter button {
  min-height: 36px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.habit-filter button.is-active {
  border-color: var(--accent);
  background: rgba(13, 129, 119, 0.1);
  color: var(--accent-strong);
}

.today-list {
  display: grid;
  gap: 14px;
}

.today-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(200px, 0.8fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(245, 241, 232, 0.55);
  padding: 16px;
}

.habit-main span,
.habit-main small,
.status-line {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.habit-main h3 {
  margin: 6px 0;
  font-size: 1.25rem;
}

.habit-main p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.checkin-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.checkin-actions button {
  min-height: 38px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.checkin-actions button[value="complete"] {
  background: var(--accent);
  color: #fff;
}

.checkin-actions button[value="missed"] {
  color: var(--danger);
}

.status-line {
  grid-column: 1 / -1;
}

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

.empty-state {
  margin: 0;
  color: var(--muted);
}

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

.habit-form label:nth-child(4),
.habit-form label:nth-child(5) {
  grid-column: 1 / -1;
}

.habit-form .button {
  align-self: end;
}

.habit-table {
  display: grid;
  gap: 10px;
}

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

.habit-row:last-child {
  border-bottom: 0;
}

.habit-row strong,
.habit-row span {
  display: block;
}

.habit-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
}

.active-dot,
.paused-dot {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.8rem !important;
  font-weight: 820;
}

.active-dot {
  background: rgba(13, 129, 119, 0.1);
  color: var(--accent-strong) !important;
}

.paused-dot {
  background: rgba(105, 115, 111, 0.12);
  color: var(--muted) !important;
}

.table-button {
  min-height: 34px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

@media (max-width: 960px) {
  .site-nav nav {
    position: fixed;
    inset: 72px 16px auto 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px;
    box-shadow: var(--shadow);
  }

  .site-nav nav.is-open {
    display: flex;
  }

  .menu-button {
    display: inline-flex;
  }

  .hero-section,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
  }

  .product-preview {
    max-width: 620px;
  }

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

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .hero-copy h1 {
    font-size: clamp(2.55rem, 15vw, 4rem);
  }

  .feature-row,
  .metric-grid,
  .preview-grid,
  .habit-form,
  .today-card,
  .checkin-actions,
  .habit-row {
    grid-template-columns: 1fr;
  }

  .dashboard-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .level-card {
    width: 100%;
  }

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

  .today-card textarea,
  .status-line {
    grid-column: auto;
  }
}
