:root {
  --bg: #080c10;
  --bg2: #0e1520;
  --card: #111a26;
  --card2: #162234;
  --line: #223047;
  --text: #f3f7fb;
  --muted: #9fb0c3;
  --soft: #d7e1ec;
  --accent: #68e1b7;
  --accent2: #7aa8ff;
  --warn: #ffd166;
  --bad: #ff6b6b;
  --ok: #68e1b7;
  --purple: #c89bff;
  --shadow: 0 16px 50px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, rgba(104,225,183,.16), transparent 28%), linear-gradient(180deg, #080c10, #0b1119 48%, #080c10);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell {
  width: min(1120px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: 18px 16px 92px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0 18px;
  backdrop-filter: blur(12px);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 5vw, 46px); letter-spacing: -0.04em; }
h2 { font-size: 22px; letter-spacing: -.02em; }
h3 { font-size: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-size: 11px; font-weight: 800; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.compact { padding: 14px; border-radius: 18px; }
.hero {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 16px;
  margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.kpi {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 14px;
}
.kpi span { color: var(--muted); font-size: 12px; display: block; }
.kpi strong { font-size: 24px; letter-spacing: -.03em; display: block; margin-top: 4px; }
.progress-bar {
  height: 12px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,.08);
}
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: inherit; transition: width .25s ease; }
.motivation {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.quote { font-size: 20px; line-height: 1.25; letter-spacing: -.02em; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border: 1px solid rgba(104,225,183,.3);
  background: rgba(104,225,183,.09);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0 16px; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.primary-btn, .secondary-btn, .ghost-btn, .danger-btn {
  border: 0;
  border-radius: 15px;
  min-height: 44px;
  padding: 11px 14px;
  color: var(--text);
  font-weight: 800;
}
.primary-btn { background: linear-gradient(135deg, #2bd9a7, #638cff); color: #061015; }
.secondary-btn { background: var(--card2); border: 1px solid var(--line); }
.ghost-btn { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.danger-btn { background: rgba(255,107,107,.14); color: #ffd2d2; border: 1px solid rgba(255,107,107,.28); }
.full { width: 100%; }
label { color: var(--soft); font-size: 13px; font-weight: 750; display: grid; gap: 7px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8,12,16,.7);
  color: var(--text);
  border-radius: 14px;
  padding: 12px;
  min-height: 44px;
  outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(104,225,183,.12); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  border-radius: 16px;
  padding: 12px;
  user-select: none;
}
.check-card input { width: auto; min-height: auto; transform: scale(1.15); accent-color: var(--accent); }
.check-card.done { border-color: rgba(104,225,183,.55); background: rgba(104,225,183,.09); }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pill { padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: var(--muted); font-size: 12px; }
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  background: rgba(11,17,25,.82);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 8px;
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 50px rgba(0,0,0,.45);
}
.tab {
  display: grid;
  gap: 3px;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 17px;
  min-height: 54px;
  font-size: 18px;
  font-weight: 800;
}
.tab span { font-size: 11px; }
.tab.active { background: rgba(104,225,183,.13); color: var(--text); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.05);
  font-size: 11px;
  color: var(--muted);
}
.day-cell.today { outline: 2px solid var(--accent); }
.day-cell.good { background: rgba(104,225,183,.18); color: var(--text); }
.day-cell.partial { background: rgba(255,209,102,.16); color: var(--text); }
.day-cell.bad { background: rgba(255,107,107,.16); color: var(--text); }
.day-cell.cheat { box-shadow: inset 0 -3px 0 var(--purple); }
.month-card h3 { margin-bottom: 10px; }
.challenge-card { display: grid; gap: 10px; }
.challenge-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.small { font-size: 12px; color: var(--muted); }
.table { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 1.3fr .7fr .7fr;
  gap: 8px;
  align-items: center;
  padding: 11px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.chart-wrap { width: 100%; height: 260px; }
canvas { width: 100%; height: 100%; }
.modal {
  border: 0;
  background: transparent;
  width: min(740px, calc(100% - 24px));
  color: var(--text);
}
.modal::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(8px); }
.modal-card { background: #0b1119; border: 1px solid var(--line); border-radius: 28px; padding: 18px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 16px; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }
.install-tip { display: none; }
@media (max-width: 820px) {
  .hero, .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .check-grid { grid-template-columns: 1fr; }
  .app-shell { padding-bottom: 100px; }
  .tabbar { bottom: 10px; }
  .row { grid-template-columns: 1fr; }
}
@media (display-mode: browser) {
  .install-tip { display: block; }
}

.target-note { color: var(--muted); font-weight: 700; font-size: 11px; display: inline; margin-left: 4px; }
.mini-toolbar { margin: 0 0 10px; }
.small-btn { min-height: 36px; padding: 8px 11px; border-radius: 12px; font-size: 12px; }
.target-pills .pill { color: var(--soft); }

.rest-card { display: grid; gap: 12px; }
.timer-display {
  font-size: clamp(54px, 14vw, 86px);
  font-weight: 900;
  letter-spacing: -.06em;
  line-height: 1;
  text-align: center;
  padding: 20px 0 8px;
}
.timer-progress { margin-top: 0; height: 14px; }
.timer-buttons { justify-content: center; }
.exercise-list { display: grid; gap: 10px; }
.exercise-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  border-radius: 18px;
}
.exercise-row.done { border-color: rgba(104,225,183,.55); background: rgba(104,225,183,.08); }
.exercise-check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.exercise-check input { width: auto; min-height: auto; transform: scale(1.12); accent-color: var(--accent); }
.exercise-plan { display: flex; flex-wrap: wrap; gap: 6px; }
.exercise-plan span { color: var(--muted); border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); border-radius: 999px; padding: 6px 8px; font-size: 12px; }
.exercise-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.exercise-actions { display: flex; gap: 8px; justify-content: end; }
.workout-kpis { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .tabbar { grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px; }
  .tab { min-height: 50px; font-size: 16px; }
  .tab span { font-size: 10px; }
  .exercise-row { grid-template-columns: 1fr; }
  .exercise-actions { justify-content: stretch; }
  .exercise-actions button { flex: 1; }
  .exercise-inputs { grid-template-columns: repeat(3, 1fr); }
  .workout-kpis { grid-template-columns: repeat(2, 1fr); }
}


.user-pill{
  margin:6px 0 0;
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:5px 10px;
  background:rgba(255,255,255,.04);
}
.coach-card .quote{
  font-size:20px;
  line-height:1.45;
}
.coach-actions .coach-btn{
  width:100%;
  text-align:left;
  cursor:pointer;
  border:1px solid var(--line);
}
.coach-actions .coach-btn:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.22);
}
.coach-actions .coach-btn strong{
  display:block;
  font-size:16px;
  margin-bottom:6px;
}
.coach-actions .coach-btn span{
  display:block;
  color:var(--muted);
  font-size:13px;
}

.app-shell.locked { display: none; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.auth-card {
  width: min(480px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2bd9a7, #638cff);
  color: #061015;
  font-size: 28px;
  margin-bottom: 16px;
}
.auth-card h1 { font-size: 34px; margin-bottom: 8px; }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
.auth-error { color: #ffd2d2; background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.28); border-radius: 14px; padding: 10px; font-size: 13px; display: none; }
.auth-actions { display: grid; gap: 10px; }
.link-btn { background: transparent; border: 0; color: var(--accent); padding: 8px; font-weight: 800; }
.win-list { display: grid; gap: 8px; margin-top: 12px; }
.win-item {
  border: 1px solid rgba(104,225,183,.25);
  background: rgba(104,225,183,.075);
  border-radius: 14px;
  padding: 10px;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.35;
}
.win-item.empty { border-style: dashed; color: var(--muted); background: rgba(255,255,255,.025); text-align: left; }
@media (max-width: 820px) {
  .auth-card { padding: 18px; border-radius: 24px; }
  .auth-card h1 { font-size: 30px; }
  .tabbar { grid-template-columns: repeat(7, 1fr); }
}
@media (min-width: 821px) {
  .tabbar { grid-template-columns: repeat(7, 1fr); }
}
