/* ── App shell ── */
#app {
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
#view-container {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--sp-4);
}

/* ── Login ── */
.screen-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
}
.login-box {
  width: 100%;
  max-width: 320px;
}
.login-logo {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  text-align: center;
  margin-bottom: var(--sp-5);
}
.logo-slash { color: var(--accent); }
.login-box form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.login-error {
  text-align: center;
  color: var(--negative);
  font-size: var(--text-sm);
}

/* ── Today view ── */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.day-info {
  text-align: center;
  flex: 1;
}
.day-info h2 {
  font-size: var(--text-md);
  text-transform: capitalize;
}
.day-info .today-badge {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: var(--weight-medium);
}

.progress-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--sp-5);
  position: relative;
}
.progress-ring {
  width: 110px;
  height: 110px;
  transform: rotate(-90deg);
}
.progress-bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}
.progress-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease);
}
.progress-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.section-title {
  font-size: var(--text-sm);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-3);
  margin-top: var(--sp-5);
}

.celebration {
  text-align: center;
  padding: var(--sp-5) 0;
  animation: fadeIn 0.4s var(--ease-spring);
}
.celebration-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: inline-grid;
  place-items: center;
  margin-bottom: var(--sp-3);
  animation: popIn 0.5s var(--ease-spring);
}
.celebration-check svg { width: 32px; height: 32px; }
.celebration p {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--green);
}
@keyframes popIn {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.empty-state {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--ink-3);
}
.empty-state p {
  margin-bottom: var(--sp-3);
}

/* ── Goals view ── */
.goals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.goal-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ── Stats view ── */
.view-stats {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.view-stats h2 {
  font-family: var(--font-mono);
}

.heatmap-section h3,
.goal-stats-section h3,
.chart-section h3 {
  font-size: var(--text-sm);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-3);
}

.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: var(--sp-2);
}
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-columns: 13px;
  grid-auto-flow: column;
  gap: 3px;
}
.heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--hm-0);
}
.heatmap-cell[data-level="1"] { background: var(--hm-1); }
.heatmap-cell[data-level="2"] { background: var(--hm-2); }
.heatmap-cell[data-level="3"] { background: var(--hm-3); }
.heatmap-cell[data-level="4"] { background: var(--hm-4); }
.heatmap-cell.future { background: transparent; }
.heatmap-cell.outside { background: transparent; }

.heatmap-months {
  display: flex;
  gap: 0;
  font-size: 10px;
  color: var(--ink-3);
  margin-bottom: var(--sp-1);
  padding-left: 0;
}
.heatmap-months span {
  flex-shrink: 0;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
  font-size: 10px;
  color: var(--ink-3);
  justify-content: flex-end;
}
.heatmap-legend .heatmap-cell {
  width: 10px;
  height: 10px;
}

.chart-wrap {
  height: 200px;
  position: relative;
}

/* ── Settings ── */
.settings-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.settings-section:last-child {
  border-bottom: none;
}
.settings-about {
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-sm);
  padding-top: var(--sp-4);
}
.settings-about .logo-slash {
  color: var(--accent);
}
