:root {
  --bg: #f6f4f1; --card: #fff; --text: #1f1b16; --muted: #6f675e; --line: #e7e1d9;
  --accent: #e8590c; --accent-2: #ff922b; --accent-soft: #fff1e6; --ok: #2b8a3e; --ok-soft: #ebfbee;
  --err: #c92a2a; --err-soft: #fff5f5; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f; --card: #1f1b17; --text: #f3eee8; --muted: #a59b90; --line: #332d27;
    --accent: #ff7a2e; --accent-2: #ffa94d; --accent-soft: #3a2518; --ok: #69db7c; --ok-soft: #1c2c20;
    --err: #ff8787; --err-soft: #3a1d1d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
main { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; text-decoration: none; color: var(--text); font-size: 1.05rem; }
.logout { margin: 0; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around; background: var(--card);
  border-top: 1px solid var(--line); padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; text-decoration: none;
  color: var(--muted); font-size: .72rem; padding: .25rem 0; border-radius: 10px;
}
.nav a .ico { font-size: 1.25rem; line-height: 1.3; }
.nav a.active { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
@media (min-width: 760px) {
  .nav { position: sticky; top: 0; bottom: auto; justify-content: center; gap: .3rem; border-top: 0; border-bottom: 1px solid var(--line); }
  .nav a { flex: 0 0 auto; flex-direction: row; gap: .35rem; font-size: .92rem; padding: .45rem .8rem; }
  .nav a .ico { font-size: 1rem; }
  main { padding-bottom: 3rem; }
}
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 1rem 7rem; }
@media (min-width: 760px) { .foot { padding-bottom: 2rem; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; margin: 0 0 1rem;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card.success { border-color: var(--ok); background: var(--ok-soft); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.hint.warn { color: var(--accent); }
.flash {
  background: var(--ok-soft); border: 1px solid var(--ok); border-radius: var(--radius);
  padding: .8rem 1rem; margin-bottom: 1rem;
}
.flash.info { background: var(--accent-soft); border-color: var(--accent-2); }
.error {
  background: var(--err-soft); color: var(--err); border: 1px solid var(--err);
  border-radius: 10px; padding: .6rem .8rem; margin-bottom: .8rem;
}

.stack { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: .65rem .75rem; width: 100%; min-width: 0;
}
input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
label.inline select { width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  font: inherit; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0; border-radius: 10px; padding: .7rem 1.2rem; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--text); color: var(--card); }
.chip {
  font: inherit; font-size: .88rem; background: var(--accent-soft); color: var(--accent);
  border: 1px solid transparent; border-radius: 999px; padding: .35rem .8rem; cursor: pointer; white-space: nowrap;
}
.chip.danger { background: var(--err-soft); color: var(--err); }
.row { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.hello h1 { margin-bottom: .2rem; }
.quote { font-style: italic; color: var(--muted); margin: 0 0 1rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; text-decoration: none; color: inherit;
}
.stat.hl { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.stat.hl .sub, .stat.hl .lbl { color: #fff; opacity: .9; }
.stat .num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat .lbl { font-size: .85rem; font-weight: 600; color: var(--muted); }
.stat .sub { font-size: .75rem; color: var(--muted); }
.stat .sub.warn { color: var(--accent); font-weight: 700; }

.entry .sets { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .6rem; }
.entry .sets input { font-size: 1.2rem; text-align: center; font-weight: 700; }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .8rem; }

.setlist { display: flex; flex-wrap: wrap; gap: .4rem; }
.setchip {
  display: inline-flex; align-items: center; gap: .2rem; margin: 0;
  background: var(--accent-soft); border-radius: 999px; padding: .2rem .3rem .2rem .8rem; font-weight: 700;
}
.setchip button {
  border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer;
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
}
.setchip button:hover { background: var(--err-soft); color: var(--err); }

.chart { width: 100%; height: auto; display: block; }
.chart .b { fill: var(--accent-2); opacity: .55; }
.chart .b.today { fill: var(--accent); opacity: 1; }
.chart text { fill: var(--muted); font-size: 9px; text-anchor: middle; }
.chart text.v { fill: var(--text); font-weight: 700; }

.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.facts li { position: relative; padding-left: 2.4rem; min-height: 1.8rem; }
.facts li .big { position: absolute; left: 0; top: -.1rem; font-size: 1.5rem; line-height: 1.2; }
.facts li .bar { margin-top: .35rem; }
.grow { flex: 1; min-width: 0; }

.bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }

.tabs { display: flex; gap: .3rem; margin-bottom: .6rem; overflow-x: auto; }
.tabs a {
  padding: .45rem .9rem; border-radius: 999px; text-decoration: none; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); font-weight: 600; white-space: nowrap;
}
.tabs.small a { font-size: .85rem; padding: .3rem .75rem; }
.tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.group { margin-top: 0; }
table.rank { width: 100%; border-collapse: collapse; }
table.rank th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .3rem; }
table.rank td { padding: .55rem .3rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.rank .rk { width: 2.4rem; font-size: 1.2rem; text-align: center; font-weight: 700; }
table.rank .val { text-align: right; font-weight: 800; white-space: nowrap; }
table.rank .streak { text-align: right; white-space: nowrap; font-size: .9rem; width: 3.5rem; }
table.rank tr.me td { background: var(--accent-soft); }
table.rank .mini .bar { height: 4px; max-width: 220px; }
.you {
  font-size: .7rem; background: var(--accent); color: #fff; border-radius: 99px;
  padding: .05rem .45rem; vertical-align: middle; font-weight: 700;
}

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.badge {
  border: 1px dashed var(--line); border-radius: 12px; padding: .7rem; text-align: center;
  opacity: .75; display: flex; flex-direction: column; gap: .15rem;
}
.badge .em { font-size: 1.8rem; filter: grayscale(1); }
.badge.got { border: 1px solid var(--accent-2); background: var(--accent-soft); opacity: 1; }
.badge.got .em { filter: none; }

.days { list-style: none; padding: 0; margin: 0; }
.days li { padding: .6rem 0; border-top: 1px solid var(--line); }
.days li:first-child { border-top: 0; }
.dayhead { display: flex; justify-content: space-between; margin-bottom: .35rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list form { margin: 0; }
input.copy { font-family: ui-monospace, monospace; font-size: .8rem; }
.grid3 { display: grid; grid-template-columns: 1fr; gap: .6rem; align-items: end; }
@media (min-width: 640px) { .grid3 { grid-template-columns: 2fr 1fr 1fr auto; } }
