:root {
  --spruce: #1F3B2E;
  --spruce-deep: #152A20;
  --snow: #F6F8F7;
  --ice: #DDE9EE;
  --ink: #1B2320;
  --mute: #6A7571;
  --amber: #E8A33D;
  --line: #CFD9D5;
  --card: #FFFFFF;
  --danger: #B3362F;
  --radius: 14px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--snow);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--mute); }
[hidden] { display: none !important; }

/* ---------- Inloggning ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: var(--spruce);
  color: #fff;
  padding: 24px;
}
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-card .mountain { width: 120px; margin-bottom: 8px; color: var(--spruce-deep); }
.login-card h1 { font-size: 2rem; }
.login-card .muted { color: #B9CBC2; margin: 4px 0 16px; }
.people-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.people-grid button {
  background: rgba(255,255,255,.08);
  border: 2px solid transparent;
  color: #fff;
  padding: 14px 12px;
  border-radius: var(--radius);
  font-size: 1.05rem;
  display: flex; align-items: center; gap: 10px; justify-content: center;
}
.people-grid button.selected { border-color: var(--amber); background: rgba(255,255,255,.16); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: .9rem; margin-bottom: 6px; color: #B9CBC2; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1); color: #fff; font: inherit; font-size: 1.2rem; letter-spacing: .2em;
}
.btn {
  border: 0; border-radius: 10px; padding: 13px 18px; font-size: 1rem; font-weight: 500;
}
.btn.primary { background: var(--amber); color: var(--spruce-deep); width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.error { color: #FFB4AE; margin-top: 12px; }

/* ---------- App-ram ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--spruce); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.topbar .muted { color: #B9CBC2; display: block; font-size: .85rem; }
.chip {
  border: 0; background: rgba(255,255,255,.14); color: #fff;
  padding: 8px 12px; border-radius: 999px; display: flex; align-items: center; gap: 8px;
}
main { padding: 16px 16px 90px; max-width: 720px; margin: 0 auto; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button {
  flex: 1; border: 0; background: none; padding: 14px 4px 12px; color: var(--mute); font-weight: 500;
  border-top: 3px solid transparent;
}
.tabs button.active { color: var(--spruce); border-top-color: var(--amber); }

/* ---------- Info ---------- */
.hero {
  background: var(--spruce); color: #fff; border-radius: var(--radius);
  padding: 24px 20px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -10px; bottom: -40px; width: 180px; height: 100px;
  background: var(--spruce-deep); opacity: .7; pointer-events: none;
  clip-path: polygon(0 100%, 35% 10%, 50% 40%, 62% 20%, 100% 100%);
}
.hero > * { position: relative; z-index: 1; }
.hero .count { font-size: 4rem; font-weight: 700; line-height: 1; }
.hero .count small { font-size: 1.1rem; font-weight: 400; margin-left: 6px; }
.hero .dates { color: #B9CBC2; margin-top: 6px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.card a { color: var(--spruce); font-weight: 500; }
.notes { margin: 8px 0 0; padding-left: 18px; }
.notes li { margin: 4px 0; }

.day { margin-bottom: 18px; }
.day h3 { font-size: 1rem; color: var(--spruce); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 2px solid var(--ice); }
.day.today h3 { border-bottom-color: var(--amber); }
.slot { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 6px 0; }
.slot time { font-weight: 700; color: var(--spruce); }
.slot .where { color: var(--mute); font-size: .9rem; }

/* ---------- Listor ---------- */
.progress { margin-bottom: 16px; }
.progress .bar { height: 10px; background: var(--ice); border-radius: 999px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--amber); width: 0; transition: width .3s; }
.progress .label { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }

.group { margin-bottom: 8px; }
.group summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 700;
}
.group summary::-webkit-details-marker { display: none; }
.group summary .cnt { font-weight: 400; color: var(--mute); font-size: .9rem; }
.group summary .cnt.done { color: var(--spruce); }
.group[open] summary { border-radius: var(--radius) var(--radius) 0 0; }
.group .items { background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 4px 0; }

.item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid #EEF2F0; }
.item input[type=checkbox] {
  width: 24px; height: 24px; accent-color: var(--spruce); flex: none; margin: 0;
}
.item label { flex: 1; cursor: pointer; }
.item.checked label { color: var(--mute); text-decoration: line-through; }
.item .rm { border: 0; background: none; color: var(--mute); font-size: 1.2rem; padding: 0 4px; }
.item .rm:hover { color: var(--danger); }
.add { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #EEF2F0; }
.add input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.add button { border: 0; background: var(--spruce); color: #fff; border-radius: 8px; padding: 0 14px; }

/* ---------- Alla ---------- */
.person-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.person-row:first-child { border-top: 0; }
.person-row .name { width: 84px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.person-row .bar { flex: 1; height: 10px; background: var(--ice); border-radius: 999px; overflow: hidden; }
.person-row .bar i { display: block; height: 100%; }
.person-row .pct { width: 48px; text-align: right; font-weight: 700; color: var(--spruce); }

.pdetail summary { gap: 12px; }
.pdetail .name { width: 110px; white-space: nowrap; font-weight: 500; display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.pdetail .bar { flex: 1; height: 10px; background: var(--ice); border-radius: 999px; overflow: hidden; }
.pdetail .bar i { display: block; height: 100%; }
.pdetail .pct { width: 48px; text-align: right; font-weight: 700; color: var(--spruce); font-size: .9rem; }
.detail { padding: 8px 14px 12px; }
.dgroup { margin-top: 10px; }
.dhead { font-weight: 700; display: flex; justify-content: space-between; border-bottom: 1px solid var(--ice); padding-bottom: 4px; margin-bottom: 4px; }
.dhead .cnt { font-weight: 400; color: var(--mute); font-size: .9rem; }
.dhead .cnt.done { color: var(--spruce); }
.ditem { padding: 3px 0; color: var(--mute); }
.ditem.ok { color: var(--ink); }
.charger { color: var(--spruce); font-size: .9rem; margin-top: 2px; }
.dognote { margin-top: 10px; padding: 10px 12px; background: var(--ice); border-radius: 10px; font-size: .95rem; }
.origin { margin-bottom: 8px; }
.origin .where { color: var(--mute); font-size: .9rem; }

.overview { background: var(--spruce); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.overview .big { font-size: 3rem; font-weight: 700; line-height: 1; }
.overview .big small { font-size: 1rem; font-weight: 400; margin-left: 8px; color: #B9CBC2; }
.overview .bar { height: 12px; background: rgba(255,255,255,.18); border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.overview .bar i { display: block; height: 100%; background: var(--amber); transition: width .3s; }
.overview .facts { color: #B9CBC2; font-size: .95rem; }
.overview .ready { margin-top: 10px; font-size: .95rem; }
.logrow { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid #EEF2F0; font-size: .95rem; }
.logrow:first-of-type { border-top: 0; }
.logrow em { font-style: normal; color: var(--spruce); }
.logrow time { color: var(--mute); font-size: .85rem; white-space: nowrap; }

/* ---------- Övrigt ---------- */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem;
  z-index: 10; max-width: 90vw; text-align: center;
}
.toast.err { background: var(--danger); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 600px) {
  .people-grid { grid-template-columns: repeat(4, 1fr); }
}
