:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --surface: #fffdfa;
  --surface-soft: #f1ece4;
  --line: rgba(45, 42, 36, .10);
  --text: #26231f;
  --muted: #7a746a;
  --olive: #6f7b4f;
  --sage: #a8b79a;
  --wine: #8f3d43;
  --terracotta: #be7656;
  --gold: #b9964f;
  --graphite: #373530;
  --green: #6f8f68;
  --shadow: 0 18px 55px rgba(67, 55, 39, .10);
  --shadow-soft: 0 8px 28px rgba(67, 55, 39, .08);
  --radius: 22px;
  --nav-height: 78px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, .92), rgba(247, 243, 236, .96)),
    radial-gradient(circle at 12% 0%, rgba(168, 183, 154, .28), transparent 20rem),
    radial-gradient(circle at 96% 4%, rgba(185, 150, 79, .18), transparent 18rem);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 18px);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.app-main,
.checkin-shell,
.focus-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 16px 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px 1fr 44px;
  align-items: center;
  gap: 12px;
  margin: -18px -16px 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(247, 243, 236, .82);
  backdrop-filter: blur(20px);
}

.mark,
.profile-chip {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.mark span {
  color: var(--olive);
  letter-spacing: .04em;
}

.topbar strong,
.topbar small {
  display: block;
}

.topbar strong {
  font-size: 16px;
}

.topbar small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.profile-chip {
  background: var(--graphite);
  color: #fffdfa;
}

.daily-hero,
.panel-soft,
.commander-card,
.finance-card,
.metric-card,
.area-card,
.auth-panel,
.check-card,
.day-summary,
.trophy-card {
  border: 1px solid rgba(45, 42, 36, .08);
  border-radius: var(--radius);
  background: rgba(255, 253, 250, .86);
  box-shadow: var(--shadow);
}

.daily-hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  animation: rise .42s ease both;
}

.daily-hero::after {
  content: "";
  position: absolute;
  inset: auto -28px -46px auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 183, 154, .34), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 10px;
  color: var(--graphite);
  font-size: clamp(34px, 10vw, 52px);
  line-height: .98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.today-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.today-strip span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--graphite);
  font-size: 13px;
  font-weight: 800;
}

.daily-progress {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.daily-progress > div:first-child,
.finance-head,
.finance-foot,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.daily-progress strong,
.finance-head strong {
  color: var(--olive);
  font-size: 28px;
  line-height: 1;
}

.daily-progress span,
.finance-foot,
.panel-title > span,
.muted {
  color: var(--muted);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #c6a257, var(--gold));
  color: #fffdfa;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(185, 150, 79, .24);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(185, 150, 79, .28);
}

.primary-button:active,
.bottom-nav a:active,
.mission-pill:active {
  transform: scale(.98);
}

.primary-button.is-pending {
  animation: breathe 2.4s ease-in-out infinite;
}

.primary-button.is-complete {
  background: linear-gradient(135deg, #7f9b73, var(--green));
  box-shadow: 0 14px 34px rgba(111, 143, 104, .22);
}

.daily-missions,
.commander-card,
.finance-card,
.metric-grid,
.area-grid,
.panel-soft {
  margin-top: 14px;
}

.panel-soft,
.commander-card,
.finance-card {
  padding: 20px;
  animation: rise .42s ease both;
}

.panel-title.compact {
  margin-bottom: 14px;
}

.mission-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.mission-pill {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.mission-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(111, 123, 79, .22);
}

.mission-code {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: var(--surface-soft);
  color: var(--olive);
  font-size: 12px;
  font-weight: 950;
}

.mission-pill strong {
  font-size: 16px;
}

.mission-pill em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.mission-pill.done {
  background: rgba(111, 143, 104, .09);
  border-color: rgba(111, 143, 104, .20);
}

.mission-pill.done em {
  color: var(--green);
}

.commander-card {
  background:
    linear-gradient(135deg, rgba(55, 53, 48, .96), rgba(76, 70, 62, .92)),
    var(--graphite);
  color: #fffdfa;
}

.commander-card .eyebrow {
  color: #dcc28a;
}

.commander-card p {
  margin: 12px 0 0;
  color: rgba(255, 253, 250, .88);
  font-size: 18px;
  line-height: 1.55;
}

.finance-card {
  background: linear-gradient(145deg, rgba(255, 253, 250, .96), rgba(241, 236, 228, .78));
}

.finance-head h2 {
  margin-top: 4px;
  font-size: 34px;
}

.finance-foot {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 750;
}

.mini-bar,
.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(38, 35, 31, .08);
  overflow: hidden;
}

.mini-bar i,
.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
}

.progress-track.finance i {
  background: linear-gradient(90deg, var(--olive), var(--gold));
}

.metric-grid,
.area-grid,
.trophy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.metric-card,
.area-card {
  padding: 18px;
  animation: rise .42s ease both;
}

.metric-card span,
.metric-card small,
.area-card span,
.area-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
  line-height: 1;
}

.area-card {
  display: grid;
  gap: 12px;
}

.area-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.area-card strong {
  font-size: 26px;
}

.area-card.italian { border-left: 4px solid var(--olive); }
.area-card.amazon { border-left: 4px solid var(--terracotta); }
.area-card.sites { border-left: 4px solid var(--gold); }
.area-card.exercise { border-left: 4px solid var(--wine); }

.lab-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 250, .94), rgba(255, 253, 250, .86)),
    repeating-linear-gradient(90deg, rgba(111, 123, 79, .06), rgba(111, 123, 79, .06) 1px, transparent 1px, transparent 18px);
}

.insight-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  color: var(--graphite);
  line-height: 1.45;
}

.chart-frame {
  position: relative;
  width: 100%;
  height: 176px;
  max-height: 176px;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.medal-list {
  display: grid;
  gap: 10px;
}

.medal,
.trophy-card {
  padding: 16px;
  border-radius: 18px;
  background: #fff;
}

.medal {
  border: 1px solid rgba(185, 150, 79, .20);
}

.medal strong,
.medal span {
  display: block;
}

.medal span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  height: var(--nav-height);
  padding: 8px;
  border: 1px solid rgba(45, 42, 36, .10);
  border-radius: 26px;
  background: rgba(255, 253, 250, .88);
  box-shadow: 0 16px 45px rgba(67, 55, 39, .16);
  backdrop-filter: blur(22px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 58px;
  border-radius: 20px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  transition: transform .16s ease, background .16s ease, color .16s ease;
}

.bottom-nav a.active {
  background: var(--graphite);
  color: #fffdfa;
}

.nav-ico {
  width: 22px;
  height: 22px;
}

.nav-ico svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-body,
.focus-body {
  display: grid;
  place-items: center;
  padding: 24px 16px calc(var(--nav-height) + 28px);
}

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

.auth-panel {
  padding: 28px;
}

.auth-panel h1 {
  margin-bottom: 12px;
  font-size: 44px;
}

.stack-form,
.checkin-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--graphite);
  font-size: 15px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

input:focus,
select:focus {
  border-color: rgba(185, 150, 79, .62);
  box-shadow: 0 0 0 4px rgba(185, 150, 79, .13);
}

.alert {
  margin: 16px 0;
  padding: 13px 14px;
  border-radius: 16px;
}

.alert.danger {
  border: 1px solid rgba(143, 61, 67, .22);
  background: rgba(143, 61, 67, .08);
}

.alert.success {
  border: 1px solid rgba(111, 143, 104, .24);
  background: rgba(111, 143, 104, .09);
}

.text-link {
  display: inline-flex;
  width: fit-content;
  color: var(--olive);
  font-weight: 900;
}

.compact-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding-top: env(safe-area-inset-top);
}

.compact-header h1 {
  margin: 0;
  font-size: 34px;
}

.check-card {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 15px;
  background: var(--surface-soft);
  color: var(--olive);
  font-weight: 950;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
}

.toggle-line input {
  width: 24px;
  min-height: 24px;
  accent-color: var(--olive);
}

.field-row,
.field-grid,
.field-grid.five {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.sticky-submit {
  position: sticky;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
  z-index: 40;
  padding: 14px 0 2px;
  background: linear-gradient(transparent, var(--bg) 34%);
}

.day-summary {
  margin-bottom: 14px;
  padding: 22px;
  border-color: rgba(111, 143, 104, .20);
}

.day-summary h2 {
  margin: 8px 0 12px;
  font-size: 28px;
}

.day-summary ul {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: var(--graphite);
}

.focus-shell h1,
.simple-hero h1 {
  max-width: 760px;
}

.focus-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.focus-list a {
  min-height: 64px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.simple-hero {
  margin-bottom: 14px;
}

.trophy-grid {
  margin-top: 14px;
}

.trophy-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.trophy-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 950;
}

.trophy-card.unlocked .trophy-mark {
  background: rgba(185, 150, 79, .14);
  color: var(--gold);
}

.trophy-card strong {
  display: block;
  margin-bottom: 5px;
}

.trophy-card p {
  margin-bottom: 8px;
}

.trophy-card small {
  color: var(--muted);
  font-weight: 800;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
  0%, 100% { transform: translateY(0); box-shadow: 0 14px 34px rgba(185, 150, 79, .22); }
  50% { transform: translateY(-1px); box-shadow: 0 18px 42px rgba(185, 150, 79, .32); }
}

@media (min-width: 760px) {
  body {
    padding-bottom: 120px;
  }

  .app-main,
  .checkin-shell,
  .focus-shell {
    width: min(100%, 1040px);
    padding: 28px 24px 0;
  }

  .topbar {
    margin: -28px -24px 18px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .daily-hero {
    padding: 34px;
  }

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

  .area-grid,
  .mission-list,
  .trophy-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .field-grid.five {
    grid-template-columns: repeat(5, 1fr);
  }

  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 28px));
    transform: translateX(-50%);
  }
}
