:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --text: #202124;
  --muted: #6b665c;
  --line: #ddd7ca;
  --accent: #226f54;
  --accent-dark: #18513d;
  --danger: #9b2c2c;
  --shadow: 0 18px 45px rgba(43, 38, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(34, 111, 84, 0.1), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
.primary-link {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 520px);
}

.auth-panel,
.empty-state,
.add-form,
.habit {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: clamp(28px, 8vw, 52px);
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.primary-link:hover,
.check-button:hover,
.add-row button:hover {
  background: var(--accent-dark);
}

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

.topbar h1 {
  margin: 0;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.add-form {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 8px;
}

.add-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
}

.add-row input {
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
}

.add-row button,
.check-button {
  background: var(--accent);
  color: #fff;
}

.add-row button {
  font-size: 1.55rem;
}

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

.habit {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
}

.habit-main .muted {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 8px;
  margin: 0;
}

.stats div {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 1.45rem;
  font-weight: 900;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-button {
  min-width: 92px;
  padding: 0 14px;
}

.check-button:disabled {
  background: #d7efe5;
  color: var(--accent-dark);
  cursor: default;
}

.ghost-button,
.archive-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  padding: 0 14px;
}

.archive-button {
  color: var(--danger);
}

.empty-state {
  padding: 32px;
  border-radius: 8px;
}

.empty-state .muted {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .topbar,
  .habit,
  .actions {
    align-items: stretch;
  }

  .topbar,
  .habit {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

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

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .actions form,
  .actions button,
  .ghost-button {
    width: 100%;
  }
}
