:root {
  font-family: Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color: #203e37;
  background: #1F4D3A;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #1F4D3A;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  font-weight: 750;
  margin: 0 0 6px;
  color: #7a998d;
}

main {
  max-width: 850px;
  margin: auto;
  padding: 18px 18px 50px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  background: #e6ebe5;
  padding: 5px;
  border-radius: 15px;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 4;
  border: 1px solid #C9A34A;
}

.tabs button {
  border: 0;
  border-radius: 11px;
  padding: 12px 2px;
  background: transparent;
  font-weight: 650;
  color: #577168;
  cursor: pointer;
  font-size: 11px;
}

.tabs button.active {
  background: #fff;
  color: #1d5546;
  box-shadow: 0 1px 8px #00000012;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h2 {
  font-size: 27px;
  margin: 0 0 17px;
}

h3 {
  font-size: 17px;
  margin: 0 0 12px;
}

.card {
  background: #fff;
  border: 1px solid #C9A34A;
  border-radius: 16px;
  padding: 17px;
  margin-bottom: 14px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

.muted {
  font-size: 13px;
  line-height: 1.5;
  color: #63786d;
}

.tiny {
  font-size: 11px;
}

label {
  display: block;
  font-weight: 650;
  font-size: 13px;
  margin: 10px 0 6px;
}

input:not([type=checkbox]):not([type=file]),select,textarea {
  width: 100%;
  border: 1px solid #d4ded5;
  border-radius: 10px;
  background: #fff;
  padding: 11px;
  font: inherit;
  color: #203e37;
}

textarea {
  resize: vertical;
}

.date-label {
  width: 160px;
  margin: 0 0 15px;
}

.date-label input {
  font-size: 12px !important;
  padding: 9px !important;
}

button,.fileButton {
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 13px;
  background: #ecf3ed;
  color: #215748;
  border: 1px solid #ccddd0;
  font-weight: 700;
  font-size: 13px;
}

button.primary {
  width: 100%;
  margin-top: 14px;
  color: white;
  background: #1f5b4d;
  border-color: #1f5b4d;
  padding: 13px;
}

.danger {
  background: #fff0eb;
  color: #9f4535;
  border-color: #f4d0c6;
}

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

.exercise-head h3 {
  margin: 0;
}

.pill {
  background: #f0f6ef;
  border-radius: 20px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  color: #376653;
}

.sets-head,.set-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  gap: 9px;
  align-items: center;
}

.sets-head {
  font-size: 11px;
  font-weight: 700;
  color: #718579;
  margin: 12px 0 3px;
}

.set-row {
  margin-bottom: 7px;
}

.set-row input {
  padding: 8px !important;
}

.set-row .number {
  font-size: 12px;
  font-weight: 700;
  color: #74887a;
}

.exercise-meta {
  font-size: 12px;
  color: #688075;
  margin: 5px 0 0;
}

.exercise-controls {
  display: flex;
  justify-content: flex-end;
}

.exercise-controls button {
  padding: 6px 9px;
  margin-top: 7px;
}

.check {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 5px 13px 5px 0;
}

.check input {
  accent-color: #1f5b4d;
}

fieldset {
  border: 1px solid #d7e4d8;
  border-radius: 10px;
  margin-top: 12px;
}

legend {
  font-size: 12px;
  font-weight: 700;
}

.meal-item,.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #C9A34A;
}

.meal-item p,.history-item p {
  margin: 3px 0;
}

.meal-item button,.history-item button {
  flex-shrink: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 9px;
  margin-bottom: 15px;
}

.stat {
  background: #fff;
  border: 1px solid #C9A34A;
  border-radius: 16px;
  padding: 13px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

.stat strong {
  display: block;
  font-size: 25px;
}

.stat span {
  display: block;
  font-size: 11px;
  color: #667e73;
}

.chart {
  margin-top: 16px;
  min-height: 55px;
  overflow: auto;
}

.chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto;
  gap: 7px;
  align-items: end;
}

.inline-form input {
  min-width: 0;
}

.fileButton {
  display: inline-block;
  margin: 8px;
}

.fileButton input {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

footer {
  text-align: center;
  color: #EAF8F2;
  font-size: 11px;
  padding: 10px 0 25px;
}

@media(max-width:520px) {
  h1 {
    font-size: 23px;
  }
  main {
    padding: 14px 12px 48px;
  }
  .card {
    padding: 14px;
  }
  .date-label {
    width: 140px;
  }
  .date-label input {
    font-size: 11px !important;
  }
  .exercise-head h3 {
    font-size: 16px;
  }
}

.swap-label {
  display: block;
  font-size: 12px;
  color: #688075;
  margin: 10px 0 4px;
}

.swap-label select {
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 14px;
}

.demo-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #9fc2b3;
  text-underline-offset: 3px;
}

.demo-link span {
  font-size: 11px;
  color: #24725b;
}

.demo-links {
  display: flex;
  gap: 14px;
  margin: 6px 0 0;
  font-size: 13px;
}

.demo-links a {
  color: #24725b;
  font-weight: 600;
  text-decoration: none;
}

.water-bar {
  height: 12px;
  background: #e3eef2;
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 4px;
}

#waterFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg,#5aa9c9,#2f7fa6);
  border-radius: 99px;
  transition: width .3s;
}

.water-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}

.water-form {
  margin-top: 4px;
  grid-template-columns: 1fr 1fr auto;
}

.nutri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(110px,1fr));
  gap: 4px 9px;
}

.nutri-grid label {
  margin: 6px 0 2px;
  font-size: 12px;
}

.nutri-grid input {
  margin-top: 4px;
  padding: 9px !important;
}

.nutri-line {
  font-size: 12px;
  color: #24725b;
  font-weight: 600;
}

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

.nutri-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.nutri-table th,.nutri-table td {
  padding: 7px 5px;
  text-align: right;
  border-bottom: 1px solid #e6ede6;
  white-space: nowrap;
}

.nutri-table th:first-child {
  text-align: left;
}

.nutri-table thead th {
  font-size: 11px;
  color: #667e73;
  font-weight: 650;
}

.nutri-table small {
  display: block;
  font-weight: 500;
}

.nutri-table tfoot th,.nutri-table tfoot td {
  font-weight: 800;
  border-bottom: 0;
  color: #1d5546;
}

/* v2.1: Goals, Agenda and floating timer */

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

.agenda-stats .stat strong {
  font-size: 24px;
}

.agenda-stats .stat small {
  color: #638076;
  font-size: 11px;
}

.agenda-goal,.goal-line,.session-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #e7ece6;
}

.agenda-goal:last-child,.goal-line:last-child {
  border-bottom: 0;
}

.agenda-goal input {
  margin-top: 4px;
  accent-color: #1f5b4d;
}

.agenda-goal strong,.goal-line strong {
  font-size: 13px;
}

.agenda-goal p,.goal-line p {
  margin: 4px 0;
  font-size: 12px;
  color: #688075;
}

.goal-body {
  flex: 1;
  min-width: 0;
}

.goal-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.goal-actions button {
  padding: 5px 8px;
  font-size: 11px;
}

#dailyGoalFill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #C9A34A 0%, #E6D3A3 50%, #C9A34A 100%);
  transition: width 0.3s ease;
}

.activity-grid,.goal-form {
  display: grid;
  gap: 8px;
}

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

.activity-grid button {
  grid-column: 1/-1;
}

.goal-form input {
  width: 100%;
}

.goal-form button {
  justify-self: start;
}

.subhead {
  margin-top: 24px;
}

.starter {
  background: #f6f9f5;
  border-radius: 16px;
  padding: 13px;
  margin-top: 16px;
  border: 1px solid #C9A34A;
}

.starter h4 {
  margin: 0 0 8px;
}

.starter button {
  margin: 3px;
}

.encouragement {
  border-left: 4px solid #85b59a;
}

.encouragement h3 {
  margin-bottom: 6px;
}

.encouragement p {
  margin: 5px 0;
}

.encouragement em {
  color: #547468;
  font-size: 13px;
}

.timer-fab {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 20;
  border-radius: 99px;
  background: #1f5b4d;
  color: white;
  border: 2px solid white;
  box-shadow: 0 5px 24px #0003;
  padding: 13px 17px;
}

.timer-panel {
  position: fixed;
  z-index: 21;
  right: 15px;
  bottom: 74px;
  width: min(380px,calc(100vw - 30px));
  max-height: min(80vh,700px);
  overflow: auto;
  padding: 18px;
  background: white;
  border: 1px solid #C9A34A;
  border-radius: 16px;
  box-shadow: 0 12px 45px #163b3240;
}

.timer-panel[hidden],#timerJournal[hidden],#encouragement[hidden] {
  display: none;
}

.timer-panel h3 {
  margin: 0;
}

.timer-presets,.timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.timer-presets button,.timer-controls button {
  font-size: 12px;
  padding: 8px;
}

.timer-controls .primary {
  width: auto;
  margin: 0;
}

.timer-face {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -.05em;
  padding: 12px;
}

.timer-panel #timerJournal {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e1e8e0;
}

.timer-panel #timerJournal .primary {
  width: 100%;
}

@media(max-width:520px) {
  .tabs {
    overflow-x: auto;
    display: flex;
  }
  .tabs button {
    min-width: 74px;
    flex: 1;
  }
  .timer-fab {
    bottom: 10px;
    right: 10px;
  }
  .agenda-stats .stat strong {
    font-size: 20px;
  }
}

.sets-head,.set-row {
  grid-template-columns: 27px minmax(0,1fr) minmax(0,1fr) 65px;
}

.set-done {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  margin: 0;
}

.set-done input {
  accent-color: #1f5b4d;
}

.set-row input:not([type=checkbox]) {
  min-width: 0;
}

/* v2.2: measured time cannot be edited, and timer states are clearer. */

.timer-measured {
  display: block;
  padding: 10px 12px;
  border: 1px solid #b7d1c4;
  border-radius: 9px;
  background: #f4faf6;
  font-size: 20px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  margin: 6px 0;
}

.timer-panel button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

header.brand-header {
  background: #FAF9F5;
  border-bottom: 2px solid #C9A34A;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 0;
  margin: 0;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  object-fit: contain;
}

/* Mobile adjustments */

@media (max-width: 520px) {
  header.brand-header {
    padding: 6px 10px;
  }
  .brand-logo {
    max-width: 260px;
  }
}

/* Make page headings readable on green */

main .panel > h2,

main .panel > .toprow h2,

main .panel > .toprow .date-label {
  color: #FFFFFF;
}

/* Softer mint accents for section labels */

main .panel > .eyebrow,

main .panel > .toprow .eyebrow {
  color: #EAF8F2;
}

/* Strong & Balanced — Goal Celebration Modal */

#goalCelebration {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 24px;
  background: #FAF9F5;
  color: #1F4D3A;
  border: 1px solid #C9A34A;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#goalCelebration::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.goal-celebration-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.celebration-icon {
  font-size: 50px;
  color: #C9A34A;
}

#goalCelebration h2 {
  font-size: 28px;
  color: #1F4D3A;
  margin: 0;
}

#goalCelebration p {
  margin: 0;
  line-height: 1.6;
}

#goalCelebration .celebration-quote {
  color: #94732B;
  font-style: italic;
  font-weight: 600;
}

#closeGoalCelebration {
  width: 100%;
  margin-top: 8px;
  padding: 12px 24px;
  background: #1F4D3A;
  color: #FFFFFF;
  border: 1px solid #C9A34A;
  border-radius: 10px;
  cursor: pointer;
}

#closeGoalCelebration:hover {
  background: #2E6B4F;
}
