:root {
  --bg: #f4f5f1; --surface: #ffffff; --surface-2: #f9faf6; --ink: #111311; --muted: #5d615b;
  --line: #dbdcd8; --line-strong: #838483; --accent: #c6f135; --accent-soft: #effbc6; --accent-ink: #4d6100;
  --verde: #2f8a3e; --amarelo: #c98a00; --vermelho: #b3301a; --cinza: #9a9d97; --boss: #d8452b;
  --radius: 16px; --shadow: 0 1px 2px rgba(17,19,17,.06), 0 6px 20px rgba(17,19,17,.06);
  --f-display: "Bricolage Grotesque", system-ui, sans-serif; --f-body: "Bricolage Grotesque", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e100e; --surface: #181b18; --surface-2: #1f231f; --ink: #f1f3ec; --muted: #a4a8a0;
  --line: #2c302c; --line-strong: #6b706a; --accent-soft: #2b3510; --accent-ink: #c6f135;
  --verde: #5ccf6c; --amarelo: #f0b733; --vermelho: #ff7a5c; --cinza: #6b706a; --boss: #ff6b4f;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.45;
  padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }

/* topo */
.topo { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topo .wrap { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.logo img { height: 22px; display: block; }
.logo .escuro { display: none; }
:root[data-theme="dark"] .logo .claro { display: none; }
:root[data-theme="dark"] .logo .escuro { display: block; }
.nivel-pill { margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 5px 12px 5px 6px; font-weight: 700; font-size: .85rem; text-decoration: none; white-space: nowrap; }
.voltar-360 { margin-left: auto; font-size: .75rem; font-weight: 600; color: var(--muted); text-decoration: none;
  white-space: nowrap; padding: 6px 4px; }
.voltar-360:hover { color: var(--ink); text-decoration: underline; }
.voltar-360 + .nivel-pill { margin-left: 0; }
@media (max-width: 480px) { .voltar-360 { white-space: normal; width: min-content; text-align: center; line-height: 1.05;
  font-size: .68rem; padding: 4px 0; } }
.nivel-pill b { background: var(--accent); color: #111311; border-radius: 999px; min-width: 26px; height: 26px;
  display: grid; place-items: center; font-size: .9rem; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: grid; place-items: center; cursor: pointer; font-size: 1.05rem; text-decoration: none; }

/* navegação de baixo */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.nav .wrap { display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: center; height: 68px; padding: 0 8px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted);
  font-size: .75rem; font-weight: 600; padding: 6px 0; }
.nav a .ic { font-size: 1.3rem; line-height: 1; }
.nav a.ativo { color: var(--ink); }
.nav a.ativo .ic { transform: translateY(-1px); }
.nav a.mais { width: 56px; height: 56px; margin: -22px auto 0; border-radius: 18px; background: var(--accent); color: #111311;
  font-size: 1.8rem; font-weight: 800; justify-content: center; box-shadow: 0 6px 18px rgba(120,160,0,.35); }

/* cartões */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
.secao { margin-top: 24px; }
.secao-tit { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.secao-tit .conta { color: var(--muted); font-weight: 600; font-size: .9rem; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: .9rem;
  text-decoration: none; background: var(--surface); color: var(--ink); min-height: 38px; display: inline-flex; align-items: center; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 2px 7px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.atraso { background: color-mix(in srgb, var(--vermelho) 12%, var(--surface)); color: var(--vermelho); border-color: color-mix(in srgb, var(--vermelho) 35%, transparent); }
.tag.hoje { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.av { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .7rem; font-weight: 800;
  background: var(--ink); color: var(--bg); border: 2px solid var(--surface); margin-left: -6px; }
.av:first-child { margin-left: 0; }
.av.pedro { background: #3d5afe; color: #fff; } .av.caio { background: #ff7a29; color: #111; } .av.lucca { background: #111311; color: #c6f135; }
:root[data-theme="dark"] .av.lucca { background: #c6f135; color: #111311; }

/* tarefa */
.tarefa { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; }
.tarefa + .tarefa { margin-top: 8px; }
.tarefa.feito .t-tit { text-decoration: line-through; color: var(--muted); }
.check { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent;
  cursor: pointer; display: grid; place-items: center; color: transparent; font-weight: 900; transition: transform .15s; padding: 0; }
.check:active { transform: scale(.9); }
.check.on { background: var(--accent); border-color: var(--accent); color: #111311; }
.t-corpo { flex: 1; min-width: 0; text-decoration: none; }
.t-tit { font-weight: 650; display: block; overflow-wrap: anywhere; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.vazio { text-align: center; padding: 18px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 14px; }

/* barras */
.barra { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--ink); border-radius: 999px; transition: width .6s cubic-bezier(.16,1,.3,1); }
.barra.res > i { background: var(--accent); }
.barra.esf > i { background: var(--line-strong); }
.barra.boss { height: 18px; border-color: color-mix(in srgb, var(--boss) 40%, transparent); }
.barra.boss > i { background: linear-gradient(90deg, var(--boss), #ff9c6b); }
.barra-lin { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center; font-size: .82rem; margin-top: 8px; }
.barra-lin .r { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 88px; }
.marco { position: relative; }
.marco::after { content: ""; position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .45; left: var(--esp, 0); border-radius: 2px; }

/* nível */
.nivel-card { background: var(--ink); color: var(--bg); border-radius: 22px; padding: 20px; position: relative; overflow: hidden; }
.nivel-card .big { font-family: var(--f-display); font-size: 3.4rem; font-weight: 800; line-height: .9; color: var(--accent); }
.nivel-card .barra { background: rgba(255,255,255,.12); border-color: transparent; }
.nivel-card .barra > i { background: var(--accent); }
.nivel-card .lambda { position: absolute; right: -10px; bottom: -20px; width: 150px; opacity: .12; }
.trilha { display: flex; gap: 4px; margin-top: 14px; }
.trilha span { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.trilha span.ok { background: var(--accent); }
:root[data-theme="dark"] .nivel-card { background: #1f2a07; color: #f1f3ec; border: 1px solid #3b4d0c; }

.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-family: var(--f-display); font-size: 1.8rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: 4px; }
.fogo { filter: grayscale(1); opacity: .5; } .fogo.on { filter: none; opacity: 1; }

/* KR */
.kr { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; scroll-margin-top: 80px; }
.kr + .kr { margin-top: 8px; }
.kr-top { display: flex; gap: 10px; align-items: flex-start; }
.dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--cinza); }
.dot.verde { background: var(--verde); } .dot.amarelo { background: var(--amarelo); } .dot.vermelho { background: var(--vermelho); }
.kr-form { display: flex; gap: 8px; margin-top: 12px; }
.kr-form input, .kr-form select, .kr-form .btn { min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.kr-form input, .kr-form select { flex: 1; min-width: 0; }
details.kr-mais summary { cursor: pointer; font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 10px; list-style: none; }
details.kr-mais summary::-webkit-details-marker { display: none; }
.motor-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 28px 0 10px; }
.obj { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--muted); margin: 14px 0 8px; }

/* conquistas */
.conqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.conq { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.conq .ic { font-size: 2rem; line-height: 1.2; }
.conq .t { font-weight: 800; font-size: .9rem; margin-top: 4px; }
.conq .d { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.conq.bloq { opacity: .55; } .conq.bloq .ic { filter: grayscale(1) blur(.3px); opacity: .5; }
.conq.ok { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), var(--surface)); }

/* formulários */
label.l { display: block; font-weight: 700; font-size: .9rem; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 11px 12px; min-height: 46px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 80%, #6b8a00); outline-offset: 1px; }
.btn { font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 46px; cursor: pointer;
  background: var(--accent); color: #111311; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.sec { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.perigo { background: transparent; color: var(--vermelho); border: 1px solid color-mix(in srgb, var(--vermelho) 45%, transparent); }
.btn.full { width: 100%; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 6px; text-align: center; font-weight: 700; cursor: pointer; font-size: .9rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: #111311; }
.seg label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #111311; }
.erro { background: color-mix(in srgb, var(--vermelho) 12%, var(--surface)); color: var(--vermelho); border-radius: 12px; padding: 10px 12px; font-weight: 600; margin-top: 12px; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 380px; }
.login .logo-g { height: 34px; margin-bottom: 18px; }

/* quadro */
.tabs-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 4px; margin: 6px 0 12px; }
.tabs-col button { font: inherit; font-weight: 700; border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 9px 4px; cursor: pointer; }
.tabs-col button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.colunas { display: block; }
.coluna { display: none; }
.coluna.on { display: block; }
.coluna h3 { display: none; }
@media (min-width: 860px) {
  .tabs-col { display: none; }
  .colunas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
  .coluna { display: block; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
  .coluna h3 { display: flex; justify-content: space-between; margin-bottom: 10px; }
}

/* boss */
.boss-card { border-color: color-mix(in srgb, var(--boss) 35%, var(--line)); }
.boss-card .ic { font-size: 2rem; }
.vencido { color: var(--verde); font-weight: 800; }

/* celebração */
.celebra { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(10,12,10,.55); padding: 24px;
  animation: fade .25s ease-out; }
.celebra .card { max-width: 340px; width: 100%; text-align: center; padding: 26px 20px; position: relative; overflow: hidden; }
.celebra .ic { font-size: 4rem; animation: pop .6s cubic-bezier(.2,1.6,.4,1); }
.confete { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; animation: cai 1.6s ease-in forwards; }
@keyframes cai { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }
@keyframes pop { from { transform: scale(.2) rotate(-20deg); } to { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.hist li { padding: 10px 0; border-bottom: 1px solid var(--line); list-style: none; }
.hist { padding: 0; margin: 0; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); min-width: 190px; padding: 6px; display: none; }
.menu.on .menu-pop { display: block; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  font: inherit; font-weight: 600; background: none; border: 0; color: var(--ink); cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
