:root {
  --ink: #0b1f24;
  --muted: #60747a;
  --paper: #f8fbfa;
  --mist: #ecfeff;
  --line: #d8e7e8;
  --cyan: #0891b2;
  --cyan-soft: #c8f4fb;
  --green: #22c55e;
  --green-soft: #d8fbe4;
  --coral: #ff7a59;
  --coral-soft: #ffe4db;
  --violet: #7c3aed;
  --shadow: 0 20px 70px rgba(11, 31, 36, 0.13);
  --soft-shadow: 0 12px 34px rgba(8, 145, 178, 0.12);
  --radius: 8px;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -5%, rgba(34, 197, 94, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 8%, rgba(255, 122, 89, 0.14), transparent 30rem),
    linear-gradient(180deg, #f8fbfa 0%, #effbfc 44%, #f8fbfa 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(34, 197, 94, 0.7);
  outline-offset: 3px;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(8, 145, 178, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 145, 178, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 82%);
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: calc(100vh - 164px);
  margin: 0 auto;
  padding: 22px 0 176px;
}

.screen {
  animation: screenIn 280ms var(--ease) both;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: grid;
  gap: 4px;
}

.brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid rgba(11, 31, 36, 0.1);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 24px rgba(11, 31, 36, 0.09);
  object-fit: cover;
}

.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 780px;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.date-chip,
.status-pill,
.mini-pill,
.auth-chip,
.auth-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(11, 31, 36, 0.06);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-chip,
.auth-button {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.auth-chip small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.auth-button {
  border-color: rgba(34, 197, 94, 0.38);
  background: var(--green-soft);
}

.auth-link {
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.date-chip i,
.status-pill i,
.mini-pill i,
.auth-chip i,
.auth-button i,
.nav-item i,
.switcher-btn i,
.icon-button i {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.layout {
  display: grid;
  gap: 14px;
}

.layout-two {
  display: grid;
  gap: 14px;
}

.panel {
  position: relative;
  border: 1px solid rgba(11, 31, 36, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  transform: translateY(0);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.panel:hover {
  transform: translateY(-2px);
  border-color: rgba(8, 145, 178, 0.24);
  box-shadow: var(--shadow);
}

.panel-pad {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.panel-caption {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.number {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.hero-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.58fr) auto;
  align-items: end;
  gap: 18px;
  min-height: 184px;
  padding: 18px;
  color: #f8fbfa;
  background:
    linear-gradient(135deg, rgba(11, 31, 36, 0.96), rgba(8, 145, 178, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.04) 18px 19px);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-visual {
  align-self: stretch;
  width: min(260px, 24vw);
  min-width: 150px;
  height: 100%;
  max-height: 210px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: right center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.hero-meter h2 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 3.35rem);
  line-height: 1.05;
}

.hero-meter p {
  margin: 10px 0 0;
  color: rgba(248, 251, 250, 0.78);
  line-height: 1.6;
}

.macro-stack {
  display: grid;
  gap: 8px;
  min-width: 124px;
}

.macro-chip {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.macro-chip span {
  color: rgba(248, 251, 250, 0.68);
  font-size: 0.75rem;
}

.macro-chip strong {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.18rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: clamp(1.3rem, 6vw, 2rem);
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.progress-track {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #dfeaec;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transform-origin: left;
  animation: fillIn 650ms var(--ease) both;
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--coral), var(--green));
}

.task-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workout-kpi {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.task-btn,
.log-action,
.primary-action,
.secondary-action,
.segment-btn,
.day-row {
  min-height: 44px;
}

.task-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.task-btn:hover {
  transform: translateX(2px);
  border-color: rgba(34, 197, 94, 0.48);
}

.task-btn.is-done {
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.52);
  animation: donePulse 320ms var(--ease) both;
}

.check-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #bed4d7;
  border-radius: 50%;
  color: transparent;
  transition: all 180ms var(--ease);
}

.task-btn.is-done .check-dot {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.task-copy {
  display: grid;
  gap: 2px;
}

.task-copy strong {
  font-size: 0.95rem;
}

.task-copy span {
  color: var(--muted);
  font-size: 0.8rem;
}

.task-time {
  color: var(--cyan);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.field input:focus,
.field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.12);
}

.field input.is-invalid {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 122, 89, 0.13);
}

.field-error {
  min-height: 16px;
  color: #b53a1f;
  font-size: 0.72rem;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segment-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.segment-btn.is-active {
  background: var(--cyan-soft);
  border-color: var(--cyan);
}

.primary-action,
.log-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-action:hover,
.log-action:hover,
.secondary-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--soft-shadow);
}

.primary-action:hover,
.log-action:hover {
  background: #14343b;
}

.secondary-action:hover {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.mini-grid {
  display: grid;
  gap: 8px;
}

.week-rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.week-cell {
  display: grid;
  place-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
}

.week-cell.is-today {
  color: var(--ink);
  background: var(--cyan-soft);
  border-color: var(--cyan);
  box-shadow: 0 10px 24px rgba(8, 145, 178, 0.15);
}

.week-cell.is-done {
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.42);
}

.chart {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  height: 148px;
  padding: 14px 0 0;
}

.chart-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  text-align: center;
}

.chart-empty img {
  width: min(120px, 42vw);
  height: 92px;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 12px 18px rgba(11, 31, 36, 0.09));
}

.bar {
  flex: 1;
  min-width: 20px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--cyan), var(--green));
  transform-origin: bottom;
  animation: barGrow 700ms var(--ease) both;
}

.measurement-line {
  display: grid;
  gap: 10px;
}

.measurement-row,
.setting-row,
.plan-row {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.measurement-row:last-child,
.setting-row:last-child,
.plan-row:last-child {
  border-bottom: 0;
}

.plan-row.is-today-plan {
  margin: 0 -8px;
  padding: 12px 8px;
  border: 1px solid rgba(8, 145, 178, 0.28);
  border-radius: var(--radius);
  background: var(--cyan-soft);
}

.row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-main strong {
  font-size: 0.95rem;
}

.row-main span {
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding-left: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(var(--cyan), var(--green), var(--coral));
}

.timeline-item {
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px var(--mist);
}

.timeline-item.done::before {
  background: var(--green);
}

.timeline-item.warn::before {
  background: var(--coral);
}

.control-ring {
  width: min(220px, 62vw);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(var(--green) 0 72%, var(--coral) 72% 83%, #dfeaec 83% 100%);
  box-shadow: var(--soft-shadow);
}

.control-ring-inner {
  width: 72%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  text-align: center;
}

.control-ring strong {
  display: block;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 2.5rem;
  line-height: 1;
}

.control-ring span {
  color: var(--muted);
  font-size: 0.8rem;
}

.compact-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease);
}

.icon-button.is-selected,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  background: var(--cyan-soft);
}

.feature-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 50;
  width: min(740px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(11, 31, 36, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.nav-item.is-active {
  color: var(--ink);
  background: var(--green-soft);
}

.nav-item:active {
  transform: scale(0.97);
}

.prototype-switcher {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 60;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(11, 31, 36, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
}

.switcher-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background 180ms var(--ease), transform 180ms var(--ease);
}

.switcher-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.variant-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: center;
}

.variant-label span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: var(--ink);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 800;
}

.variant-label strong {
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 154px;
  z-index: 70;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.stagger > * {
  animation: riseIn 360ms var(--ease) both;
}

.stagger > *:nth-child(2) {
  animation-delay: 45ms;
}

.stagger > *:nth-child(3) {
  animation-delay: 90ms;
}

.stagger > *:nth-child(4) {
  animation-delay: 135ms;
}

.stagger > *:nth-child(5) {
  animation-delay: 180ms;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fillIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes barGrow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes donePulse {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(1.018);
  }
  100% {
    transform: scale(1);
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 34px;
    padding-bottom: 178px;
  }

  .layout-two {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: start;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1040px) {
  .app-shell {
    width: min(1180px, calc(100vw - 72px));
  }

  .layout-three {
    display: grid;
    grid-template-columns: 0.85fr 1.2fr 0.95fr;
    gap: 14px;
    align-items: start;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
  }

  .date-chip {
    width: max-content;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .auth-chip,
  .auth-button {
    max-width: 100%;
    white-space: normal;
  }

  .hero-meter {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    width: 100%;
    min-width: 0;
    max-height: 146px;
    object-position: center;
  }

  .macro-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .macro-chip {
    min-width: 0;
  }

  .feature-nav {
    bottom: 10px;
    width: calc(100vw - 16px);
  }

  .nav-item {
    min-height: 52px;
    font-size: 0.62rem;
  }

  .prototype-switcher {
    bottom: 78px;
  }

  .variant-label {
    min-width: 118px;
  }

  .variant-label strong {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
