:root {
  --bg: #f3f5f1;
  --fg: #172019;
  --muted: #5d6a60;
  --card: #ffffff;
  --line: #d9dfd6;
  --green: #006437;
  --green-2: #0b7a43;
  --green-soft: #e1efe5;
  --ok: #0b7a43;
  --warn: #b3261e;
  --amber: #a15c00;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 2px 8px rgb(0 0 0 / 5%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1410;
    --fg: #e5ebe4;
    --muted: #9aa79c;
    --card: #182019;
    --line: #2c372e;
    --green: #2fa86a;
    --green-2: #3dbb79;
    --green-soft: #1b2e22;
    --ok: #4cc38a;
    --warn: #ff8a80;
    --amber: #f0b45a;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--green-2); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
small { display: block; color: var(--muted); font-size: .82rem; }
.muted { color: var(--muted); font-size: .86rem; }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

button, select, input, textarea {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); padding: 6px 10px; font-weight: 500; }
button.tiny { background: transparent; color: var(--green-2); padding: 2px 4px; font-size: .78rem; font-weight: 600; text-decoration: underline; }
button.danger { background: var(--warn); }
select, input, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 7px 9px;
  max-width: 100%;
}

/* topo e abas */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: var(--green); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { display: block; font-size: 1rem; }
.brand small { color: rgb(255 255 255 / 80%); }
.crest { font-size: 1.6rem; }
.topr { display: flex; align-items: center; gap: 10px; }
.count { font-size: .85rem; white-space: nowrap; }
.count b { font-size: 1.15rem; }
.me { background: transparent; padding: 0; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  background: transparent; color: var(--muted); border-radius: 0;
  padding: 7px 2px 8px; font-size: .72rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.tabs button span { font-size: 1.2rem; }
.tabs button.on { color: var(--green-2); box-shadow: inset 0 3px 0 var(--green-2); }
main { max-width: 900px; margin: 0 auto; padding: 14px 16px 24px; }
section { margin: 0 0 22px; }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: 58px; bottom: auto; display: flex; justify-content: center; border-top: 0; border-bottom: 1px solid var(--line); }
  .tabs button { flex-direction: row; gap: 6px; font-size: .9rem; padding: 10px 16px; }
  .tabs button span { font-size: 1rem; }
  .tabs button.on { box-shadow: inset 0 -3px 0 var(--green-2); }
}

/* pessoas */
.who {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c); color: #fff; font-size: .68rem; font-weight: 700; vertical-align: middle;
  flex: none;
}
.who.big { width: 34px; height: 34px; font-size: .85rem; box-shadow: 0 0 0 2px #fff; }

/* início */
.hero {
  background: linear-gradient(135deg, var(--green), #013d22);
  color: #fff; border-radius: 16px; padding: 18px 16px;
}
.hero h1 { margin: 2px 0 4px; font-size: 1.7rem; }
.hero p { margin: 0; color: rgb(255 255 255 / 88%); }
.hero .kick { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.links, .rank, .news, .log, .moves, .exps, .tasks, .comments { margin: 0; padding: 0; list-style: none; }
.links li, .news li, .log li, .moves li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.rank { padding-left: 20px; list-style: decimal; }
.rank li { padding: 4px 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--green-soft); }
.timeline li { position: relative; padding: 4px 0 10px 8px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 10px; width: 11px; height: 11px; border-radius: 50%; background: var(--green-2); }
.timeline li.est::before { background: var(--card); border: 2px solid var(--amber); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--green-soft); font-size: .78rem; font-weight: 600; margin: 0 4px 2px 0; }
.tag.soft { background: transparent; border: 1px solid var(--amber); color: var(--amber); }
.log li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* tabelas */
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
thead th { background: var(--green-soft); font-size: .8rem; }
tr.tot td, tr.tot th { font-weight: 700; }
.plan td:last-child, .bal td { white-space: nowrap; }
.matrix td, .matrix th { text-align: center; }
.matrix tbody th { text-align: left; white-space: nowrap; }
.mx { display: block; white-space: nowrap; font-weight: 600; padding: 2px 0; }

/* chips e cartões */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chips button { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 500; }
.chips button.on { background: var(--green); color: #fff; border-color: var(--green); }
.chips button small { display: inline; color: inherit; opacity: .7; }
.chips.sub { position: sticky; top: 58px; z-index: 4; background: var(--bg); padding: 6px 0; margin: 0; }
@media (min-width: 760px) { .chips.sub { top: 104px; } }
.group { margin: 18px 0 8px; font-size: .95rem; }
.group small { display: inline; margin-left: 6px; }
.cards { display: grid; gap: 12px; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); scroll-margin-top: 120px; min-width: 0; }
.card.escolhido, .card.reservado, .card.pago { border-color: var(--green-2); box-shadow: 0 0 0 2px var(--green-soft); }
.card.descartado { opacity: .55; }
.card header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card h3 { font-size: 1rem; overflow-wrap: anywhere; }
.price { font-size: 1.1rem; white-space: nowrap; color: var(--green-2); }
.price small { display: inline; font-weight: 500; font-size: .75rem; margin-left: 2px; }
.route { margin: 4px 0; }
.meta { margin: 4px 0; font-size: .86rem; color: var(--muted); }
.meta a, .meta .muted { margin-left: 4px; }
.obs { margin: 6px 0; font-size: .88rem; background: var(--green-soft); border-radius: 8px; padding: 6px 8px; }
.kv { margin: 6px 0; display: grid; gap: 2px; font-size: .86rem; }
.kv div { display: grid; grid-template-columns: 78px 1fr; gap: 8px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--green-2); color: #fff; vertical-align: 1px; }
.badge.st-descartado { background: var(--muted); }
.lastc { display: flex; gap: 6px; align-items: center; margin: 6px 0; font-size: .86rem; flex-wrap: wrap; }
.roteiro .cost { margin: 8px 0; font-size: .88rem; }
.roteiro .cost td { padding: 4px 6px; }
.roteiro .cost td:last-child { text-align: right; white-space: nowrap; }
.pros, .contras { margin: 6px 0; padding-left: 20px; font-size: .88rem; }
.pros li::marker { content: "＋ "; color: var(--ok); }
.contras li::marker { content: "－ "; color: var(--warn); }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--green-2); }
.days { padding-left: 18px; font-size: .88rem; }
.days ul { padding-left: 16px; margin: 2px 0 8px; }

/* votos e controles */
.votes { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.pvs { display: flex; gap: 6px; }
.pv { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .72rem; font-weight: 700; border: 2px dashed var(--line); color: var(--muted); }
.pv i { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: .8rem; }
.pv.vy, .pv.vm, .pv.vx { border-style: solid; border-color: var(--c); background: var(--c); color: #fff; }
.pv.vx { opacity: .75; }
.vbs { display: flex; gap: 4px; }
.vb { background: var(--card); border: 1px solid var(--line); padding: 5px 10px; font-size: 1rem; }
.vb.on { background: var(--green-soft); border-color: var(--green-2); box-shadow: inset 0 0 0 1px var(--green-2); }
.ctls { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 8px; }
.ctl { display: grid; gap: 2px; font-size: .72rem; color: var(--muted); }
.ctl select { font-size: .86rem; padding: 5px 6px; }
select.st-escolhido, select.st-reservado, select.st-pago { border-color: var(--green-2); color: var(--green-2); font-weight: 700; }

/* tarefas */
.checks th { font-weight: 500; min-width: 130px; }
.checks th small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.checks thead th { text-align: center; min-width: 0; }
.checks td { text-align: center; min-width: 52px; padding: 6px 4px; }
.ck { width: 30px; height: 30px; padding: 0; border-radius: 8px; background: var(--card); border: 2px solid var(--line); color: #fff; font-weight: 800; }
.ck.done { background: var(--green-2); border-color: var(--green-2); }
.note { font-size: .7rem; max-width: 80px; margin: 2px auto 0; overflow-wrap: anywhere; }
.tasks li { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tasks li.feito b { text-decoration: line-through; color: var(--muted); }
.tctl { grid-column: 2; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* gastos */
.exps li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.exps .amt { text-align: right; font-weight: 700; }
.exps .tiny { justify-self: start; }
.moves li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* portão e escolha de pessoa */
.gate { max-width: 420px; margin: 40px auto; padding: 0 16px; text-align: center; }
.gate h1 { font-size: 1.6rem; }
.gate form { display: flex; gap: 8px; }
.gate input { flex: 1; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pick button { background: var(--card); color: var(--fg); border: 2px solid var(--c); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; }

/* diálogo */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dform { padding: 16px; display: grid; gap: 10px; }
.dform h2 { margin: 0; }
.dform label { display: grid; gap: 3px; font-size: .85rem; color: var(--muted); }
.dform label.inline { display: inline-flex; gap: 6px; margin-right: 12px; color: var(--fg); }
.dform input, .dform select, .dform textarea { width: 100%; color: var(--fg); }
.dform label.inline input { width: auto; }
.dform fieldset { border: 1px solid var(--line); border-radius: 8px; }
.row { display: flex; gap: 8px; align-items: center; position: sticky; bottom: -16px; background: var(--card); padding: 10px 0; }
.row span { flex: 1; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.comments li { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.comments small { display: block; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #111; color: #fff; padding: 9px 14px; border-radius: 10px; transition: .2s; pointer-events: none; z-index: 20; }
#toast.on { opacity: 1; transform: translateX(-50%); }

details.more { margin: 6px 0; }
details.more summary { font-size: .84rem; }
.matrix { font-size: .82rem; }
.matrix th, .matrix td { padding: 6px 5px; }
.mx { font-size: .8rem; }
.err { margin: 0; color: var(--warn); font-weight: 600; }
.timeline .tiny, .news .tiny, .checks .tiny { text-decoration: none; padding: 0 2px; }
