:root {
  --navy: #133d61;
  --teal: #138581;
  --green: #82b16a;
  --gold: #dfa638;
  --red: #c8433a;
  --bg: #f5f7f6;
  --card: #ffffff;
  --text: #17222b;
  --muted: #5c6b75;
  --line: #e1e7e5;
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--teal); }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { line-height: 1.5; margin: .25rem 0 .75rem; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .82rem; }

header.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .6rem;
  padding: calc(env(safe-area-inset-top) + .75rem) 1rem .75rem;
  background: var(--navy); color: #fff;
}
header.top .brand { font-weight: 700; font-size: 1.1rem; flex: 1; }
header.top .brand span { color: var(--green); }
header.top img { width: 30px; height: 30px; border-radius: 8px; }
header.top button.back { background: none; border: 0; color: #fff; font-size: 1.4rem; padding: 0 .25rem; }

main { flex: 1; padding: 1rem 1rem 6rem; }
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(19,61,97,.06); border: 1px solid var(--line); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .7rem 1.1rem; border-radius: 12px; border: 0;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--teal); color: #fff;
}
button:disabled { opacity: .55; }
.btn.block, button.block { width: 100%; }
.btn.ghost, button.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.navy, button.navy { background: var(--navy); }
.btn.gold, button.gold { background: var(--gold); color: #2b1d00; }
.btn.danger, button.danger { background: var(--red); }
button.link { background: none; color: var(--teal); min-height: 0; padding: .25rem 0; font-weight: 600; }

.help-btn {
  width: 100%; min-height: 64px; font-size: 1.15rem; border-radius: 18px;
  background: var(--red); color: #fff; margin-bottom: 1rem;
}
.big-checkin { width: 100%; min-height: 72px; font-size: 1.2rem; border-radius: 18px; }

.status-grid { display: grid; gap: .75rem; }
.status-grid button { min-height: 72px; font-size: 1.1rem; border-radius: 18px; }
.status-grid .ok { background: var(--teal); }
.status-grid .struggling { background: var(--gold); color: #2b1d00; }
.status-grid .slipped { background: var(--navy); }

.counter { text-align: center; padding: 1.25rem 1rem; background: linear-gradient(135deg, var(--navy), var(--teal)); color: #fff; border: 0; }
.counter .num { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.counter .lbl { opacity: .9; margin-top: .25rem; }
.counter h2 { color: #fff; }

.slots { display: flex; gap: .5rem; flex-wrap: wrap; }
.slot { padding: .35rem .7rem; border-radius: 999px; background: #eef3f1; color: var(--muted); font-weight: 600; font-size: .9rem; }
.slot.done { background: #e3f1df; color: #2f6b22; }

label { display: block; font-weight: 600; margin: .75rem 0 .3rem; color: var(--navy); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: .65rem .8rem; border-radius: 12px; border: 1.5px solid var(--line);
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); }
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: .5rem; align-items: center; }
.row > * { flex: 1; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-weight: 500; color: var(--text); margin: 0; }
.toggle:last-child { border-bottom: 0; }
.toggle small { display: block; color: var(--muted); font-weight: 400; }
.toggle input { width: 52px; min-height: 30px; height: 30px; appearance: none; border-radius: 999px; background: #cfd8d5; position: relative; flex: none; border: 0; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle input:checked { background: var(--teal); }
.toggle input:checked::after { left: 25px; }

.list-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eef3f1; color: var(--teal); text-transform: capitalize; }
.pill.gold { background: #fbf0d9; color: #8a5d00; }
.pill.navy { background: #e4ebf2; color: var(--navy); }
.call { min-height: 44px; padding: .5rem .9rem; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .inner { display: flex; width: 100%; max-width: 560px; }
nav.tabs a { flex: 1; text-align: center; padding: .6rem 0 .7rem; color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600; }
nav.tabs a .ico { display: block; font-size: 1.3rem; line-height: 1.4; }
nav.tabs a.active { color: var(--teal); }

.hero { text-align: center; padding: 2rem 1rem 1rem; }
.hero img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 1rem; }
.hero h1 { font-size: 2rem; }
.features { display: grid; gap: .75rem; margin: 1rem 0; }
.feature { display: flex; gap: .75rem; align-items: flex-start; }
.feature .dot { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #e6f3f2; font-size: 1.1rem; }

.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .7rem 1rem; border-radius: 12px; z-index: 20; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.error { color: var(--red); font-weight: 600; }
.center { text-align: center; }
.stack > * + * { margin-top: .75rem; }
.lock { flex: 1; display: grid; place-items: center; text-align: center; padding: 2rem; background: var(--navy); color: #fff; }
.lock h1 { color: #fff; }
.lock img { width: 88px; height: 88px; border-radius: 20px; margin-bottom: 1rem; }
.hint { background: #fbf0d9; border-radius: 12px; padding: .75rem; color: #5a4100; font-size: .92rem; }
.code-input { letter-spacing: .4em; text-align: center; font-size: 1.4rem; font-weight: 700; }
