*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: Inter, Arial, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #f4f7fb;
  color: #172033;
}

a {
  color: #3347d8;
  text-decoration: none;
}

img,
canvas {
  max-width: 100%;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #d7deeb;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #172033;
}

.brand-subtitle,
.muted {
  color: #5d6880;
}

.desktop-nav {
  display: none;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.desktop-nav a,
.mobile-tabbar a {
  padding: 0.85rem 1rem;
  border-radius: 999px;
  font-weight: 600;
}

.desktop-nav a.active,
.mobile-tabbar a.active {
  background: #3347d8;
  color: #ffffff;
}

.page-shell {
  padding: 1rem;
  padding-bottom: 6rem;
}

.card,
.hero-card,
.quick-link {
  background: #ffffff;
  border: 1px solid #d7deeb;
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px rgba(28, 39, 76, 0.06);
}

.card,
.hero-card {
  padding: 1rem;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff, #eef2ff);
}

.hero-actions,
.section-heading,
.goal-header,
.inline-form,
.summary-grid,
.quick-links,
.exercise-grid,
.set-grid {
  display: grid;
  gap: 1rem;
}

.summary-grid,
.exercise-grid,
.quick-links {
  margin-bottom: 1rem;
}

.quick-links {
  grid-template-columns: 1fr;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1rem;
  border: 1px solid #c6cfdf;
  border-radius: 1rem;
  background: #ffffff;
  color: #172033;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  background: #3347d8;
  border-color: #3347d8;
  color: #ffffff;
}

.button.danger {
  color: #a02138;
  border-color: #f1c7d0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3347d8;
  font-size: 0.9rem;
  font-weight: 700;
}

.pill.success {
  background: #e9f9ef;
  color: #15743b;
}

.form-grid,
.wide-form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
}

input,
select,
textarea {
  min-height: 3rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid #c8d2e3;
  border-radius: 1rem;
  background: #ffffff;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.big-stat {
  margin: 0.25rem 0;
  font-size: 1.85rem;
  font-weight: 800;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #e3e8f2;
  text-align: left;
  vertical-align: top;
}

.progress-bar {
  width: 100%;
  height: 0.7rem;
  border-radius: 999px;
  background: #e8ecf5;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3347d8, #60a5fa);
}

.goal-card,
.exercise-card,
.exercise-log-card,
.set-card,
.history-entry {
  border: 1px solid #e1e7f2;
  border-radius: 1rem;
  padding: 0.9rem;
  background: #fbfcff;
}

.chart-wrap {
  position: relative;
  min-height: 320px;
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 0.35rem;
  padding: 0.75rem;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid #d7deeb;
  backdrop-filter: blur(12px);
}

.mobile-tabbar a {
  padding-inline: 0.9rem;
  text-align: center;
  font-size: 0.82rem;
  white-space: nowrap;
}

.log-details summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 1rem;
}

@media (min-width: 700px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

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

@media (max-width: 699px) {
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr {
    display: block;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 1rem;
    border: 1px solid #e1e7f2;
    border-radius: 1rem;
    padding: 0.5rem;
    background: #fbfcff;
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(110px, 42%) 1fr;
    gap: 0.75rem;
    border-bottom: 1px solid #edf1f7;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #5d6880;
  }
}

@media (min-width: 960px) {
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .desktop-nav {
    display: flex;
  }

  .mobile-tabbar {
    display: none;
  }

  .page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding-bottom: 2rem;
  }

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

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

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

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

.login-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #eef1fb 0%, #f4f7fb 60%);
}

.login-shell {
  width: 100%;
  max-width: 26rem;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-card h1 {
  margin: 0;
}

.login-error {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #fdeceb;
  color: #b3261e;
  font-weight: 600;
}

.small {
  font-size: 0.85rem;
}

.logout-form {
  display: inline;
}

.logout-button {
  border: none;
  background: none;
  color: inherit;
  padding: 0.85rem 1rem;
  font-weight: 600;
  cursor: pointer;
}
