:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7fb;
  color: #181620;
  font-synthesis: none;
  --ink: #181620;
  --muted: #6e6a78;
  --line: #dedde7;
  --paper: #ffffff;
  --lavender: #7656d8;
  --lavender-soft: #eee9ff;
  --green: #23856f;
  --green-soft: #e7f5f0;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #f7f7fb; }

body {
  min-height: 100%;
  margin: 0;
  background: #f7f7fb;
  color: var(--ink);
}

button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.login-panel {
  width: min(100%, 430px);
  margin: 0 auto;
}

.brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

.brand span { color: var(--lavender); }

.login-panel h1 {
  max-width: 370px;
  margin: 22px 0 36px;
  font-size: clamp(2.25rem, 10vw, 3.65rem);
  line-height: 1.02;
  letter-spacing: 0;
}

form { display: grid; gap: 18px; }

label {
  display: grid;
  gap: 8px;
  font-size: .84rem;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  padding: 0 14px;
  color: var(--ink);
  outline: none;
}

input:focus { border-color: var(--lavender); box-shadow: 0 0 0 3px var(--lavender-soft); }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 96px; }
.password-field button {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--lavender);
  font-weight: 750;
}

.form-error { min-height: 20px; margin: -6px 0; color: #b12c42; font-size: .86rem; }

.primary-button {
  min-height: 56px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.primary-button:disabled { opacity: .6; }
.login-panel > a { display: inline-block; margin-top: 24px; color: var(--muted); font-weight: 700; }

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(40px, env(safe-area-inset-bottom));
}

.app-header, .progress-copy, .section-heading, .history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.app-header { margin-bottom: 34px; }
.today-label { margin: 5px 0 0; color: var(--muted); text-transform: capitalize; font-size: .84rem; }

.account { display: flex; align-items: center; gap: 10px; }
.account span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; font-weight: 750; }
.account button, .section-heading button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 750;
}

.progress-section { margin-bottom: 38px; }
.progress-copy span { color: var(--muted); font-size: .78rem; }
.progress-copy strong { display: block; margin-top: 3px; font-size: 1.25rem; }
#saveStatus { color: var(--green); font-weight: 750; }
.progress-track {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 15px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #e6e4ec;
  appearance: none;
}
.progress-track::-webkit-progress-bar { background: #e6e4ec; }
.progress-track::-webkit-progress-value { background: var(--lavender); transition: width 220ms ease; }
.progress-track::-moz-progress-bar { background: var(--lavender); }
.night-ready .progress-track::-webkit-progress-value { background: var(--green); }
.night-ready .progress-track::-moz-progress-bar { background: var(--green); }

#checklistTitle { margin: 0 0 16px; font-size: clamp(1.8rem, 8vw, 2.7rem); letter-spacing: 0; }
.checklist { display: grid; border-top: 1px solid var(--line); }

.check-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 160ms ease;
}

.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-control {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #a9a5b3;
  border-radius: 50%;
  color: white;
  font-size: 1rem;
}
.check-row.checked { background: var(--green-soft); }
.check-row.checked .check-control { border-color: var(--green); background: var(--green); }
.check-number { color: #9995a2; font-size: .72rem; font-weight: 800; }
.check-copy { min-width: 0; }
.check-copy strong { display: block; font-size: .96rem; line-height: 1.25; }
.check-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: .76rem; line-height: 1.35; font-weight: 500; }
.optional-tag { color: var(--lavender); font-size: .68rem; font-weight: 800; text-transform: uppercase; }

.history-section { margin-top: 52px; }
.section-heading span { color: var(--muted); font-size: .76rem; }
.section-heading h2 { margin: 4px 0 0; font-size: 1.5rem; }
.history { display: grid; margin-top: 18px; border-top: 1px solid var(--line); }
.history-row { min-height: 54px; border-bottom: 1px solid var(--line); }
.history-row time { width: 84px; color: var(--muted); font-size: .78rem; text-transform: capitalize; }
.history-row strong { width: 34px; text-align: right; font-size: .78rem; }
.history-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #e6e4ec;
  appearance: none;
}
.history-track::-webkit-progress-bar { background: #e6e4ec; }
.history-track::-webkit-progress-value { background: var(--lavender); }
.history-track::-moz-progress-bar { background: var(--lavender); }
.empty-history { color: var(--muted); }

@media (min-width: 700px) {
  .app-shell { padding-inline: 28px; }
  .check-row { grid-template-columns: 38px 34px minmax(0, 1fr) auto; min-height: 88px; padding-inline: 8px; }
  .check-copy strong { font-size: 1.05rem; }
}

@media (max-width: 380px) {
  .app-shell { padding-inline: 14px; }
  .account span { display: none; }
  .check-row { grid-template-columns: 30px 24px minmax(0, 1fr); gap: 8px; }
  .optional-tag { grid-column: 3; justify-self: start; margin-top: -8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
