:root {
  color-scheme: light;
  --ink: #191919;
  --muted: #68635b;
  --line: #ddd6ca;
  --paper: #fbfaf6;
  --surface: #f1ece2;
  --surface-strong: #e4dbc9;
  --blue: #6fa8dc;
  --green: #b7e1cd;
  --red: #ff3333;
  --gold: #b58b2b;
  --shadow: 0 16px 42px rgba(54, 42, 24, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(111, 168, 220, 0.16), transparent 38%),
    linear-gradient(180deg, #f7f4ed 0%, #ece5d7 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 16px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 12vw, 3.6rem);
  line-height: 0.92;
}

.today-pill {
  min-width: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-card,
.hero-panel,
.input-panel,
.goal-key,
.sync-panel,
.week-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 250, 246, 0.88);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 82px;
  padding: 12px;
}

.metric-card span {
  display: block;
  min-height: 28px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.15rem, 5vw, 1.55rem);
  line-height: 1;
}

.metric-card.accent.exceeds {
  background: var(--blue);
}

.metric-card.accent.hit {
  background: var(--green);
}

.metric-card.accent.miss {
  background: var(--red);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr 112px;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 18px;
  overflow: hidden;
}

.day-copy h2 {
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 7vw, 2.35rem);
  line-height: 1;
}

.day-copy p:last-child {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.35;
}

.progress-ring {
  display: grid;
  width: 104px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--progress, 0deg), var(--surface-strong) 0deg);
}

.progress-ring span {
  display: grid;
  width: 70px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  font-weight: 900;
}

.input-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font-size: 1.06rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface);
}

.segment {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segment.active {
  background: var(--ink);
  color: white;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.day-tab {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  font-weight: 900;
}

.day-tab span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.day-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.day-tab.active span {
  color: rgba(255, 255, 255, 0.72);
}

.goal-key {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  overflow: hidden;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.sync-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
}

.sync-panel strong {
  display: block;
  font-size: 1.05rem;
}

.sync-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sync-actions button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.key-item {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 8px;
}

.exceeds {
  background: var(--blue);
}

.hit {
  background: var(--green);
}

.miss {
  background: var(--red);
}

.week-list {
  margin-top: 12px;
  overflow: hidden;
}

.week-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.week-row:first-child {
  border-top: 0;
}

.week-row time {
  font-size: 0.8rem;
  font-weight: 900;
}

.week-row p {
  color: var(--muted);
  font-size: 0.82rem;
}

.bank-badge {
  min-width: 76px;
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

@media (max-width: 380px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .progress-ring {
    width: 96px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }
}
