* { box-sizing: border-box; margin: 0; }
:root {
  --green: #2f6f4f; --bg: #f4f5f7; --card-bg: #fff; --ink: #172b4d;
  --muted: #6b778c; --late: #d9534f; --radius: 8px;
}
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: var(--radius); padding: .55rem .9rem;
  background: var(--green); color: #fff; }
.btn-light { background: rgba(255,255,255,.25); color: #fff; text-decoration: none;
  padding: .45rem .7rem; border-radius: var(--radius); display: inline-block; }
input, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid #dfe1e6;
  border-radius: var(--radius); background: #fff;
}
#toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: #172b4d; color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius);
  z-index: 50; max-width: 92vw;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--green); color: #fff; padding: .7rem .9rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
}
.topbar h1 { font-size: 1.1rem; flex: 1; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: .4rem; }

/* Login */
.login { max-width: 22rem; margin: 18vh auto 0; padding: 1rem; text-align: center; }
.login h1 { color: var(--green); margin-bottom: 1.2rem; }
.stack-form { display: grid; gap: .7rem; text-align: left; }

/* Boards home */
.boards { padding: 1rem; max-width: 34rem; margin: 0 auto; }
.boards h2 { font-size: 1rem; color: var(--muted); margin-bottom: .6rem; }
.board-list { list-style: none; display: grid; gap: .55rem; margin-bottom: 1.2rem; }
.board-list a {
  display: flex; align-items: center; gap: .6rem; background: var(--card-bg);
  padding: .9rem; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 2px rgba(9,30,66,.15); font-weight: 600;
}
.dot { width: .9rem; height: .9rem; border-radius: 50%; flex: none; }
.inline-form { display: flex; gap: .5rem; }

/* Board (columns) */
.board {
  display: flex; gap: .7rem; overflow-x: auto; padding: .8rem;
  height: calc(100dvh - 3.4rem); align-items: flex-start;
  scroll-snap-type: x proximity;
}
.column {
  background: #ebecf0; border-radius: var(--radius); padding: .5rem;
  width: 82vw; max-width: 300px; flex: none; scroll-snap-align: start;
  display: flex; flex-direction: column; max-height: 100%;
}
.column-new { background: transparent; }
.column-head { display: flex; align-items: center; justify-content: space-between;
  padding: .2rem .3rem .5rem; }
.column-name { font-weight: 700; font-size: .95rem; }
.rename-list { background: transparent; color: var(--muted); padding: .2rem .4rem; }
.cards { display: grid; gap: .5rem; overflow-y: auto; min-height: 1.5rem; }
.card {
  background: var(--card-bg); border-radius: var(--radius); padding: .6rem .7rem;
  box-shadow: 0 1px 1px rgba(9,30,66,.2);
}
.sortable-ghost { opacity: .4; }
.card-title { font-size: .95rem; }
.chips { display: flex; gap: .25rem; margin-bottom: .35rem; }
.chip { width: 2.2rem; height: .5rem; border-radius: 4px; display: inline-block; }
.card-meta { display: flex; align-items: center; gap: .5rem; margin-top: .4rem;
  font-size: .78rem; color: var(--muted); }
.card-meta .spacer { flex: 1; }
.due.late { color: var(--late); font-weight: 700; }
.avatar {
  background: var(--green); color: #fff; border-radius: 50%; width: 1.55rem;
  height: 1.55rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}
.add-card { margin-top: .5rem; }
.add-card input, #add-list input { background: rgba(255,255,255,.7); border: none; }

/* Modal */
#modal {
  position: fixed; inset: 0; background: rgba(9,30,66,.5); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box { background: #fff; border-radius: var(--radius); padding: 1rem;
  width: 100%; max-width: 24rem; max-height: 85dvh; overflow-y: auto; }
.modal-box h2 { font-size: 1.05rem; margin-bottom: .8rem; }
.member-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; }
.member-row input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .9rem; }
.modal-actions .btn-light { background: #ebecf0; color: var(--ink); }

/* Card page + users page */
.page { padding: 1rem; max-width: 40rem; margin: 0 auto; display: grid; gap: 1rem; }
.page section h3 { font-size: .85rem; text-transform: uppercase; color: var(--muted);
  margin-bottom: .45rem; }
.pick-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick {
  border: 1px solid #dfe1e6; background: #fff; color: var(--ink);
  padding: .35rem .6rem; border-radius: 999px; font-size: .85rem;
}
.pick.on { border-color: var(--green); background: var(--green); color: #fff; }
.desc { background: #fff; border-radius: var(--radius); padding: .8rem; }
.desc :is(h2,h3,h4) { margin: .5rem 0 .3rem; }
.desc ul { padding-left: 1.2rem; margin: .3rem 0; }
.desc p { margin: .3rem 0; overflow-wrap: anywhere; }
.check-row { display: flex; align-items: center; gap: .55rem; padding: .3rem 0; }
.check-row input[type=checkbox] { width: auto; }
.check-row .del { background: transparent; color: var(--muted); padding: .1rem .4rem; }
.check-row.done span { text-decoration: line-through; color: var(--muted); }
.comment { background: #fff; border-radius: var(--radius); padding: .6rem .7rem;
  margin-bottom: .5rem; }
.comment small { color: var(--muted); display: block; margin-bottom: .25rem; }
.comment-actions { display: flex; gap: .6rem; margin-top: .3rem; }
.comment-actions button { background: transparent; color: var(--muted);
  padding: 0; font-size: .8rem; }
.danger { background: #fff; color: var(--late); border: 1px solid var(--late); }
.user-list { list-style: none; display: grid; gap: .5rem; margin-bottom: 1.2rem; }
.user-list li { background: #fff; border-radius: var(--radius); padding: .7rem .8rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.user-list small { color: var(--muted); display: block; }
.user-actions { display: flex; gap: .4rem; }
.user-actions .btn-light { background: #ebecf0; color: var(--ink); }
.users { padding: 1rem; max-width: 34rem; margin: 0 auto; }
.users h2 { font-size: 1rem; color: var(--muted); margin: 1rem 0 .6rem; }
