/* LiftApp -- hand-written mobile-first CSS. No framework.
   Judgment call: dark-ish theme (easier on the eyes at the gym), single
   accent color, generous tap targets (min 44px) throughout. */

:root {
  --bg: #0f1115;
  --bg-elevated: #181b22;
  --bg-input: #22262f;
  --border: #2b303b;
  --text: #eef0f3;
  --text-dim: #9aa1ad;
  --accent: #1e88e5;
  --accent-dim: #164a74;
  --success: #43a047;
  --danger: #e53935;
  --warning: #fb8c00;
  --radius: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }

p { margin: 0 0 .75rem; color: var(--text-dim); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar .brand .bar { color: var(--accent); }

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 1rem calc(5.5rem + var(--safe-bottom));
}

.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 10;
}
.navbar a {
  flex: 1;
  text-align: center;
  padding: .6rem 0 .5rem;
  color: var(--text-dim);
  font-size: .72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}
.navbar a .icon { font-size: 1.35rem; }
.navbar a.active { color: var(--accent); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: .8rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  width: 100%;
}
.btn:active { opacity: .85; }
.btn.secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { width: auto; padding: .5rem .8rem; min-height: 38px; font-size: .85rem; }
.btn-row { display: flex; gap: .6rem; }
.btn-row .btn { flex: 1; }

label {
  display: block;
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: .3rem;
  margin-top: .8rem;
}
input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  font-size: 1rem;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }
input[type="number"] { font-variant-numeric: tabular-nums; }

.radio-group, .checkbox-group { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: .55rem .9rem;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .9rem;
  cursor: pointer;
}
.pill input { display: none; }
.pill.checked { background: var(--accent-dim); border-color: var(--accent); color: white; }

.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.flash.error { background: #3a1a1a; color: #ffb4b0; border: 1px solid var(--danger); }
.flash.success { background: #16321a; color: #b7e8bb; border: 1px solid var(--success); }
.flash.notice { background: #332a12; color: #f0d98c; border: 1px solid var(--warning); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .3rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 500; }

.set-row {
  display: grid;
  grid-template-columns: 2rem 1fr 1fr 4.5rem 2.5rem;
  gap: .5rem;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.set-row .set-num { color: var(--text-dim); font-weight: 600; text-align: center; }
.set-row.done { opacity: .55; }
.set-row input { text-align: center; padding: .6rem .3rem; }

.exercise-block { margin-bottom: 1.2rem; }
.exercise-block .header { display: flex; justify-content: space-between; align-items: baseline; }
.target { font-size: .82rem; color: var(--text-dim); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { font-size: .8rem; color: var(--text-dim); }
.list-item.hidden-exercise { opacity: .55; }

.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.badge.active { background: var(--accent-dim); color: white; border-color: var(--accent); }

.pr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.pr-grid .stat { background: var(--bg-input); border-radius: var(--radius); padding: .7rem; text-align: center; }
.pr-grid .stat .value { font-size: 1.3rem; font-weight: 700; }
.pr-grid .stat .label { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; }

.chart-wrap { overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.chart .dot { fill: var(--accent); }
svg.chart .axis { stroke: var(--border); stroke-width: 1; }
svg.chart .label { fill: var(--text-dim); font-size: 9px; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-dim); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }

.rest-timer {
  position: fixed;
  bottom: calc(5.5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: .6rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  z-index: 20;
}

.suggestion {
  background: #1f2a1f;
  border: 1px solid var(--success);
  color: #cfe9cf;
  border-radius: var(--radius);
  padding: .7rem .9rem;
  font-size: .85rem;
  margin-top: .5rem;
}

.muted { color: var(--text-dim); font-size: .85rem; }
.section { margin-bottom: 1.5rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
