:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-alt: #eef6ff;
  --border: #d2dbe7;
  --accent: #1f6feb;
  --accent-strong: #163b73;
  --text: #102a43;
  --muted: #53657d;
  --success: #0d7a4f;
  --warning: #a54800;
  --error: #b42318;
  --shadow: 0 12px 28px rgba(16, 42, 67, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.app-header {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.app-grid {
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.training-panel,
.progress-panel {
  display: flex;
  flex-direction: column;
}

form {
  display: grid;
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.5rem;
}

label,
.stat-label {
  font-weight: 700;
  color: var(--muted);
}

select,
input,
output,
button {
  min-height: 2.75rem;
  border-radius: 0.75rem;
}

select,
input {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.7rem 0.8rem;
}

select:focus,
input:focus,
button:focus {
  outline: 3px solid rgba(31, 111, 235, 0.25);
  outline-offset: 2px;
}

select:focus:not(:focus-visible),
input:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}

select:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

output {
  display: flex;
  align-items: center;
  padding: 0.7rem 0.8rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

button {
  border: none;
  cursor: pointer;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  padding: 0.85rem 1rem;
  width: 100%;
}

button:hover {
  filter: brightness(1.05);
}

.feedback,
.save-status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.feedback[data-tone="error"],
.save-status[data-tone="error"] {
  color: var(--error);
}

.feedback[data-tone="success"],
.save-status[data-tone="success"] {
  color: var(--success);
}

.feedback[data-tone="warning"],
.save-status[data-tone="warning"] {
  color: var(--warning);
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-block {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.stat-block strong {
  display: block;
  margin-top: 0.4rem;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
}

.daily-goal {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.daily-goal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.progress-track {
  width: 100%;
  height: 0.9rem;
  background: #e5edf7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ea8ff, #1f6feb);
}

.stats-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.stats-block h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.stats-list {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.stats-list > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.stats-list dt,
.stats-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.stats-list dt {
  font-weight: 600;
  color: var(--muted);
}

.stats-list dd {
  font-weight: 700;
}

.activity-panel {
  margin-top: 1rem;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.recent-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.recent-activity-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

.recent-activity-label {
  font-weight: 700;
}

.recent-activity-meta {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

@media (max-width: 24rem) {
  .app-shell {
    padding-inline: 0.75rem;
  }

  .panel {
    padding: 0.85rem;
  }

  .progress-summary {
    grid-template-columns: 1fr;
  }

  .stats-list > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (min-width: 640px) {
  .app-shell {
    padding-top: 2rem;
  }

  .app-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: start;
  }

  .panel {
    padding: 1.25rem;
  }
}

@media (min-width: 960px) {
  .app-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }

  .activity-panel {
    grid-column: 1 / -1;
  }
}
