:root {
  color-scheme: light;
  --bg: #eef2ed;
  --ink: #121815;
  --muted: #667169;
  --line: rgba(18, 24, 21, 0.12);
  --panel: rgba(255, 255, 255, 0.84);
  --panel-solid: #ffffff;
  --green: #176b4d;
  --green-2: #0e3f30;
  --lime: #d7f26d;
  --amber: #f3b34d;
  --red: #b24747;
  --blue: #2d6cdf;
  --shadow: 0 24px 70px rgba(18, 24, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(215, 242, 109, 0.28), transparent 34%),
    linear-gradient(315deg, rgba(45, 108, 223, 0.16), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--green);
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 14px 52px;
}

.topbar,
.brand,
.top-actions,
.panel-heading,
.hero-metrics,
.calendar-heading,
.date-label,
.log-item {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  gap: 12px;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--green-2);
  color: var(--lime);
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.top-actions {
  gap: 10px;
  font-weight: 800;
}

.ghost-button,
.icon-link,
.delete-button,
.submit-button {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 10px 12px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #10261d;
  color: #ffffff;
  padding: 22px;
  box-shadow: var(--shadow);
}

.calendar-hero {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.hero-copy h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.68);
}

.hero-metrics {
  gap: 10px;
  flex-wrap: wrap;
}

.hero-metrics div,
.hero-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 14px;
}

.hero-metrics span,
.hero-card span {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-metrics strong,
.hero-card strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
}

.hero-card p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

.dashboard-grid,
.insight-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 330px;
}

.dashboard-grid.single-column {
  grid-template-columns: 1fr;
}

.insight-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.75fr);
}

.day-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.day-layout .selected-day-panel {
  order: 1;
}

.day-layout .workout-panel {
  order: 2;
}

.workout-panel,
.library-panel,
.calendar-panel,
.summary-panel,
.history-panel,
.selected-day-panel,
.chart-panel,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.workout-panel,
.library-panel,
.calendar-panel,
.summary-panel,
.history-panel,
.selected-day-panel,
.chart-panel {
  padding: 18px;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.compact-heading {
  margin-bottom: 10px;
}

.log-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.menu-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  outline: none;
  padding: 13px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(23, 107, 77, 0.14);
}

.submit-button {
  align-self: end;
  min-height: 48px;
  border: 0;
  background: var(--green);
  color: #ffffff;
  padding: 0 18px;
}

.submit-button:active {
  background: var(--green-2);
}

.previous-log {
  border: 1px solid rgba(23, 107, 77, 0.22);
  border-radius: 8px;
  background: rgba(215, 242, 109, 0.18);
  padding: 12px;
}

.previous-log span,
.previous-log strong {
  display: block;
}

.previous-log span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.previous-log strong {
  font-size: 0.98rem;
}

.previous-log.is-loading {
  opacity: 0.72;
}

.set-builder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.set-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.set-builder-head span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.set-rows {
  display: grid;
  gap: 8px;
}

.set-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.set-number {
  display: grid;
  place-items: center;
  height: 46px;
  border-radius: 8px;
  background: rgba(16, 38, 29, 0.08);
  color: var(--green-2);
  font-weight: 900;
}

.remove-set-button {
  min-height: 46px;
}

.exercise-list {
  display: grid;
  gap: 9px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.exercise-pill,
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.exercise-pill span,
.summary-row span {
  color: var(--muted);
  font-weight: 800;
}

.icon-link {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.8rem;
  line-height: 1;
}

.calendar-cell {
  color: inherit;
  text-decoration: none;
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.week-row {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.calendar-cell {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 9px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.calendar-cell:not(.is-empty):hover {
  transform: translateY(-1px);
  border-color: rgba(23, 107, 77, 0.42);
  box-shadow: 0 12px 28px rgba(18, 24, 21, 0.1);
}

.calendar-grid-large .calendar-cell {
  min-height: 116px;
}

.calendar-cell strong,
.calendar-cell span,
.calendar-cell small {
  display: block;
}

.calendar-date-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
}

.calendar-date-row strong {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  line-height: 1.1;
}

.calendar-date-row i {
  position: relative;
  z-index: 1;
  border-radius: 999px;
  background: rgba(178, 71, 71, 0.94);
  color: #ffffff;
  padding: 3px 6px;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.calendar-cell span {
  margin-top: 9px;
  color: var(--green);
  font-weight: 900;
  font-size: 0.86rem;
}

.calendar-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.calendar-muscles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}

.calendar-muscles em {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.76);
  color: #10261d;
  border: 1px solid rgba(16, 38, 29, 0.12);
  padding: 2px 5px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.calendar-cell.has-training {
  border-color: rgba(178, 71, 71, 0.72);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 4px rgba(178, 71, 71, 0.48);
}

.calendar-cell.has-training::before {
  content: none;
}

.calendar-cell.has-training span {
  color: #10261d;
}

.calendar-cell.has-training small {
  color: rgba(16, 38, 29, 0.72);
}

.calendar-cell.has-log {
  border-color: rgba(178, 71, 71, 0.82);
}

.calendar-cell.is-today {
  border-color: rgba(23, 107, 77, 0.78);
  outline: 3px solid rgba(23, 107, 77, 0.2);
  box-shadow: inset 0 0 0 4px rgba(23, 107, 77, 0.5);
}

.calendar-cell.is-today .calendar-date-row i {
  background: rgba(23, 107, 77, 0.94);
}

.calendar-cell.is-selected {
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 0 0 4px rgba(45, 108, 223, 0.48),
    inset 0 0 0 7px rgba(255, 255, 255, 0.62);
}

.calendar-cell.is-today.is-selected {
  border-color: var(--green);
  box-shadow:
    inset 0 0 0 4px rgba(23, 107, 77, 0.54),
    inset 0 0 0 7px rgba(215, 242, 109, 0.48);
}

.calendar-cell.is-empty {
  background: rgba(255, 255, 255, 0.24);
}

.summary-stack,
.timeline,
.log-stack {
  display: grid;
  gap: 10px;
}

.summary-row strong {
  font-size: 1.15rem;
}

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

.timeline-day {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.timeline-day:first-child {
  border-top: 0;
  padding-top: 0;
}

.date-label {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.date-label span {
  color: var(--muted);
  font-weight: 800;
}

.log-item {
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.log-item strong,
.log-item span {
  display: block;
}

.log-item span,
.log-item p {
  color: var(--muted);
}

.log-item p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.delete-button {
  border: 1px solid rgba(178, 71, 71, 0.3);
  background: #fff6f6;
  color: var(--red);
  padding: 9px 12px;
}

.text-link {
  display: inline-flex;
  margin-top: 8px;
  text-decoration: none;
}

.muscle-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.routine-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.routine-bulk-form {
  display: grid;
  gap: 10px;
}

.routine-check-list {
  display: grid;
  gap: 8px;
}

.routine-check-item,
.menu-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
}

.routine-check-head {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  color: var(--ink);
  cursor: pointer;
  gap: 10px;
}

.routine-check-head input {
  width: auto;
  margin-top: 4px;
}

.routine-check-item strong,
.routine-check-item small,
.menu-item strong,
.menu-item span {
  display: block;
}

.routine-check-item small,
.menu-item span {
  color: var(--muted);
  font-weight: 800;
  margin-top: 4px;
}

.routine-previous {
  border: 1px solid rgba(23, 107, 77, 0.18);
  border-radius: 8px;
  background: rgba(215, 242, 109, 0.15);
  margin-top: 10px;
  padding: 9px 10px;
}

.routine-previous span,
.routine-set-head span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.routine-previous strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
}

.routine-set-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.routine-set-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.routine-set-rows {
  display: grid;
  gap: 8px;
}

.routine-set-row {
  background: rgba(255, 255, 255, 0.62);
}

.routine-submit {
  width: 100%;
}

.menu-groups {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.menu-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.muscle-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.muscle-checkbox {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  gap: 7px;
  padding: 8px 10px;
}

.muscle-checkbox input {
  width: auto;
}

.small-submit {
  justify-self: start;
  border: 0;
  border-radius: 8px;
  background: var(--green-2);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  padding: 9px 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 26px 18px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state.compact {
  padding: 18px;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.chart-panel {
  margin-top: 16px;
}

.chart-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
  margin-bottom: 14px;
}

.weight-chart {
  display: block;
  min-width: 680px;
  width: 100%;
  height: auto;
}

.weight-chart line {
  stroke: rgba(18, 24, 21, 0.22);
  stroke-width: 2;
}

.weight-chart polyline {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.weight-chart circle {
  fill: var(--lime);
  stroke: var(--green-2);
  stroke-width: 3;
}

.weight-chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weight-chart .axis-label {
  fill: var(--green-2);
  font-size: 13px;
}

.weight-chart .date-tick {
  text-anchor: middle;
}

.progress-table {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 12px;
}

.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-head {
  background: rgba(16, 38, 29, 0.08);
  color: var(--muted);
  font-weight: 900;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  width: min(920px, 100%);
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-hero {
  min-height: 540px;
  background:
    linear-gradient(135deg, rgba(215, 242, 109, 0.82), transparent 46%),
    #10261d;
  color: #ffffff;
  padding: 28px;
}

.auth-brand .brand-mark {
  background: var(--lime);
  color: var(--green-2);
}

.auth-brand p {
  color: rgba(255, 255, 255, 0.68);
}

.auth-hero h2 {
  margin-top: 88px;
  max-width: 520px;
  font-size: clamp(2.2rem, 6vw, 4.3rem);
  line-height: 0.96;
}

.auth-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.auth-metrics span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  font-weight: 900;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 0;
  padding: 28px;
  background: rgba(255, 255, 255, 0.92);
}

.auth-panel h2 {
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.error-message {
  margin-bottom: 14px;
  border: 1px solid rgba(178, 71, 71, 0.28);
  border-radius: 8px;
  background: #fff6f6;
  color: var(--red);
  padding: 10px 12px;
  font-weight: 800;
}

.auth-switch {
  margin: 18px 0 0;
  color: var(--muted);
}

@media (max-width: 860px) {
  .hero-panel,
  .dashboard-grid,
  .insight-grid,
  .day-layout,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 360px;
  }

  .auth-hero h2 {
    margin-top: 58px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .top-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-panel,
  .workout-panel,
  .library-panel,
  .calendar-panel,
  .summary-panel,
  .history-panel,
  .selected-day-panel,
  .chart-panel {
    padding: 14px;
  }

  .log-form,
  .menu-form {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  .summary-grid,
  .filter-form {
    grid-template-columns: 1fr;
  }

  .calendar-cell {
    min-height: 62px;
    padding: 6px;
  }

  .calendar-cell small {
    display: none;
  }

  .calendar-muscles em {
    font-size: 0.62rem;
    padding: 1px 4px;
  }

  .timeline-day {
    grid-template-columns: 1fr;
  }

  .log-item {
    align-items: flex-start;
  }

  .set-row {
    grid-template-columns: 38px 1fr;
  }

  .set-row .delete-button {
    grid-column: 2;
    justify-self: start;
  }

  .table-row {
    grid-template-columns: 1fr;
  }
}
