:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #050505;
  --surface-2: #121212;
  --line: #252525;
  --text: #ffffff;
  --muted: #b9b9b9;
  --faint: #7a7a7a;
  --sage: #7ac7a6;
  --blue: #7db7ff;
  --amber: #f2c46d;
  --rose: #ec8f9a;
  --page: min(100% - 24px, 760px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background: linear-gradient(180deg, #080808 0, var(--bg) 240px);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: var(--page);
  margin: 0 auto;
  padding: 18px 0 48px;
}

.home-header,
.page-header {
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.header-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.color-rule {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr 1.1fr;
  gap: 5px;
  height: 4px;
  margin-bottom: 18px;
}

.color-rule span {
  border-radius: 999px;
}

.color-rule span:nth-child(1) {
  background: var(--sage);
}

.color-rule span:nth-child(2) {
  background: var(--blue);
}

.color-rule span:nth-child(3) {
  background: var(--amber);
}

.color-rule span:nth-child(4) {
  background: var(--rose);
}

.header-line span,
.page-header > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.install-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: #000000;
  background: var(--sage);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: 0;
}

.home-header p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.install-hint {
  display: block;
  margin-top: 8px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 700;
}

.goal-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.week-pulse {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 7px;
  height: 58px;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}

.week-pulse span {
  width: 100%;
  min-height: 10px;
  border-radius: 999px 999px 3px 3px;
  background: var(--surface-2);
}

.week-pulse span:nth-child(4n + 1) {
  background: var(--sage);
}

.week-pulse span:nth-child(4n + 2) {
  background: var(--blue);
}

.week-pulse span:nth-child(4n + 3) {
  background: var(--amber);
}

.week-pulse span:nth-child(4n + 4) {
  background: var(--rose);
}

.goal-pill {
  min-height: 74px;
  padding: 13px 10px 13px 0;
}

.goal-pill + .goal-pill {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.goal-pill span,
.metric span,
.metric small,
.nav-row small,
.entry-row span,
.entry-row time,
.entry-row p,
.bar-row small,
.mini-chart small,
.reflection-lines span {
  color: var(--muted);
}

.goal-pill span,
.metric span {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.goal-pill strong {
  display: block;
  margin: 6px 0 8px;
  font-size: 17px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress,
.bar-row div {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress span,
.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--text);
}

.goal-pill:nth-child(1) .progress span {
  background: var(--sage);
}

.goal-pill:nth-child(2) .progress span {
  background: var(--blue);
}

.goal-pill:nth-child(3) .progress span {
  background: var(--amber);
}

.section-list {
  display: flex;
  flex-direction: column;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 82px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #000000;
}

.nav-row[data-view="entries"] .nav-icon {
  background: var(--sage);
}

.nav-row[data-view="stats"] .nav-icon {
  background: var(--blue);
}

.nav-row[data-view="reflection"] .nav-icon {
  background: var(--amber);
}

.nav-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.nav-row strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
}

.nav-row small {
  display: block;
  margin-top: 7px;
  font-size: 13px;
}

.nav-arrow,
.nav-row svg,
.back-button svg {
  flex: 0 0 auto;
}

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

.page-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 12px;
  padding-top: 4px;
  background: var(--bg);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  margin: 0 0 10px -4px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.entry-list,
.bar-list,
.reflection-lines {
  display: flex;
  flex-direction: column;
}

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

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

.entry-row strong {
  font-size: 16px;
}

.entry-row span,
.entry-row time,
.entry-row p {
  font-size: 13px;
}

.entry-row span {
  margin-top: 4px;
}

.entry-row p {
  margin: 8px 0 0;
  line-height: 1.4;
}

.entry-row time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-state {
  padding: 28px 0;
  color: var(--muted);
  text-align: left;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 78px;
  padding: 13px 10px 13px 0;
  border-bottom: 1px solid var(--line);
}

.metric:nth-child(3n + 2),
.metric:nth-child(3n + 3) {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 27px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
}

.mini-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  height: 124px;
  margin: 20px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.mini-chart div {
  display: grid;
  grid-template-rows: 1fr 18px;
  align-items: end;
  justify-items: center;
  gap: 6px;
}

.mini-chart span {
  width: 100%;
  max-width: 22px;
  min-height: 18px;
  border-radius: 4px 4px 1px 1px;
  background: var(--text);
}

.mini-chart small {
  font-size: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 13px;
}

.bar-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reflection {
  padding-top: 6px;
}

.reflection p {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.22;
}

.reflection-lines span {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

@media (max-width: 520px) {
  :root {
    --page: min(100% - 24px, 760px);
  }

  h1 {
    font-size: 31px;
  }

  .app {
    padding-top: 14px;
  }

  .goal-pill {
    min-height: 70px;
  }

  .goal-pill span {
    font-size: 10px;
  }

  .nav-row {
    min-height: 78px;
  }

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

  .metric:nth-child(3n + 2),
  .metric:nth-child(3n + 3) {
    padding-left: 0;
    border-left: 0;
  }

  .metric:nth-child(even) {
    padding-left: 12px;
    border-left: 1px solid var(--line);
  }

  .entry-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
