:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #6b766f;
  --line: #e1e6e2;
  --accent: #2f7d5b;
  --accent-text: #ffffff;
  --accent-soft: #e3f1ea;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --card: #1e2421;
    --text: #e8ece9;
    --muted: #94a09a;
    --line: #2d3531;
    --accent: #4fb386;
    --accent-text: #0d1a14;
    --accent-soft: #1f3329;
    --danger: #e5675a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 1.7rem; margin: 0 0 4px; }
h2 { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 28px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* Topbar */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; min-height: 40px; }
.top .title { flex: 1; min-width: 0; }
.top h1 { overflow-wrap: anywhere; }
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line);
  text-decoration: none; color: var(--text); font-size: 1.3rem; flex: none;
}

/* Buttons */
button, .btn {
  font: inherit; cursor: pointer; border: 0; border-radius: 10px;
  padding: 10px 16px; background: var(--accent); color: var(--accent-text); font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* Users grid */
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 20px; }
.user {
  background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 22px 12px; flex-direction: column; gap: 10px; font-size: 1.1rem;
  text-decoration: none;
}
.user:active { transform: scale(.98); }
.avatar {
  width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: #fff;
}
.user .badge { font-size: .8rem; color: var(--muted); font-weight: 500; }
.user.add { border-style: dashed; color: var(--muted); box-shadow: none; background: transparent; }
.user.add .avatar { background: var(--line); color: var(--muted); }

/* Forms */
.add-form { display: flex; gap: 8px; }
.add-form input {
  flex: 1; min-width: 0; font: inherit; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.add-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* Cards (lists) */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text);
}
.card .grow { flex: 1; min-width: 0; }
.card .name { font-weight: 600; overflow-wrap: anywhere; }
.card .chev { color: var(--muted); font-size: 1.3rem; }
.progress { height: 5px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Items */
.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.items:empty { display: none; }
.item { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .check {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left;
  background: transparent; color: var(--text); font-weight: 400; padding: 14px 6px 14px 14px; border-radius: 0;
}
.box {
  width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2px solid var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--accent-text);
}
.item .check:disabled { opacity: 1; }
.item .txt { overflow-wrap: anywhere; }
.item.done .box { background: var(--accent); border-color: var(--accent); }
.item.done .txt { text-decoration: line-through; color: var(--muted); }
.item .del {
  background: transparent; color: var(--muted); font-size: 1.4rem; padding: 8px 14px; font-weight: 400;
}
.item .del:hover { color: var(--danger); }

.banner { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.all-done { text-align: center; padding: 14px; color: var(--accent); font-weight: 600; }

/* Enheder */
.devcode {
  font: 700 2rem/1.2 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .1em;
  text-align: center; padding: 16px; margin: 8px 0 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.tag {
  display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--line); color: var(--text); vertical-align: middle;
}
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.wait { background: #fdecc8; color: #8a5a00; }
@media (prefers-color-scheme: dark) { .tag.wait { background: #3d3115; color: #f0c56a; } }
.dev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.avatar.sm { width: 42px; height: 42px; font-size: 1.1rem; flex: none; align-self: flex-start; }
.card.inactive { opacity: .6; }
.small-btn { padding: 6px 12px; font-size: .88rem; }
.card > button { flex: none; }

/* Pinkode-vindue */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10;
}
.modal {
  background: var(--card); color: var(--text); border-radius: var(--radius);
  padding: 20px; width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px;
}
.modal h3 { margin: 0; font-size: 1.25rem; }
.modal p { margin: 0 0 4px; }
.modal input {
  font: inherit; font-size: 1.5rem; letter-spacing: .3em; text-align: center;
  padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.modal input::placeholder { letter-spacing: normal; font-size: 1rem; }
.modal input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.modal .err { color: var(--danger); min-height: 1.2em; }
.modal .opt { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.modal .opt input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.modal .pick { border-top: 1px solid var(--line); padding: 6px 0 0 12px; max-height: 45vh; overflow-y: auto; }
.modal .pick[hidden] { display: none; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; max-width: calc(100% - 32px);
}
