/* ==========================================================================
   style.css — mobile-first. O tema troca sozinho conforme o país da etapa.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --raio: 16px;
  --raio-sm: 10px;
  --gap: 14px;
  --topo: env(safe-area-inset-top, 0px);
  --base: env(safe-area-inset-bottom, 0px);
  --f: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* fallback = China */
  --bg: #14060a; --bg2: #24090c; --card: #2a0f12; --card2: #371518;
  --linha: #4a1f22; --txt: #fdf3ef; --txt2: #d3a9a4;
  --acento: #ea2a1c; --acento2: #FFD24A; --sobre: #fff;
  --sombra: 0 6px 24px rgba(0,0,0,.45);
}

/* ---------- Temas por país ---------- */
body[data-tema="cn"] {
  --bg: #14060a; --bg2: #24090c; --card: #2a0f12; --card2: #371518;
  --linha: #4a1f22; --txt: #fdf3ef; --txt2: #d6a9a2;
  --acento: #EA2A1C; --acento2: #FFD24A; --sobre: #fff;
}
body[data-tema="jp"] {
  --bg: #0c0e16; --bg2: #141926; --card: #1a2030; --card2: #232b3e;
  --linha: #333c52; --txt: #f4f6fb; --txt2: #a7b0c4;
  --acento: #E01E3C; --acento2: #F7C8D4; --sobre: #fff;
}
body[data-tema="de"] {
  --bg: #0d0d0f; --bg2: #17171a; --card: #1e1e22; --card2: #28282e;
  --linha: #3a3a42; --txt: #f5f5f7; --txt2: #a9a9b4;
  --acento: #DD0000; --acento2: #FFCE00; --sobre: #fff;
}
body[data-tema="br"] {
  --bg: #061410; --bg2: #0b2018; --card: #102b20; --card2: #17392b;
  --linha: #21503c; --txt: #f2fbf6; --txt2: #9ec8b3;
  --acento: #009C3B; --acento2: #FFDF00; --sobre: #fff;
}

body {
  font-family: var(--f);
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  transition: background .45s ease, color .45s ease;
  padding-bottom: calc(78px + var(--base));
  min-height: 100vh;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(80% 45% at 12% -5%, color-mix(in srgb, var(--acento) 28%, transparent), transparent 70%),
    radial-gradient(70% 40% at 95% 0%, color-mix(in srgb, var(--acento2) 16%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg2), var(--bg) 55%);
  transition: background .45s ease;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--acento2); }

/* ---------- Cabeçalho ---------- */
.topo {
  position: sticky; top: 0; z-index: 40;
  padding: calc(10px + var(--topo)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--linha) 60%, transparent);
  display: flex; align-items: center; gap: 12px;
}
.topo .flag { width: 34px; height: 24px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.5); flex: none; }
.topo h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.2px; line-height: 1.15; }
.topo .sub { font-size: 11.5px; color: var(--txt2); margin-top: 2px; }
.topo .dir { margin-left: auto; text-align: right; font-size: 11px; color: var(--txt2); }
.topo .dir b { display: block; font-size: 18px; color: var(--acento2); line-height: 1.1; }

/* ---------- Layout ---------- */
main { padding: 16px 14px 24px; max-width: 720px; margin: 0 auto; }
.secao-tit {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--txt2); margin: 22px 4px 10px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.secao-tit::after { content: ''; flex: 1; height: 1px; background: var(--linha); }

.card {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  overflow: hidden;
  margin-bottom: var(--gap);
}
.card-p { padding: 15px; }
.linha-itens { display: flex; align-items: center; gap: 12px; }
.crescer { flex: 1; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Herói do dia ---------- */
.heroi { position: relative; border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); margin-bottom: var(--gap); }
.heroi .arte, .heroi img.foto { width: 100%; height: 190px; object-fit: cover; display: block; }
.heroi .cobre {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 25%, rgba(0,0,0,.35) 55%, rgba(0,0,0,.85));
  display: flex; flex-direction: column; justify-content: flex-end; padding: 15px;
}
.heroi .eti { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--acento2); font-weight: 700; }
.heroi h2 { margin: 4px 0 2px; font-size: 24px; letter-spacing: -.4px; }
.heroi .cid { font-size: 13px; color: #dcd4d0; }

/* ---------- Chips / etiquetas ---------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--acento) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--acento) 40%, transparent);
  color: var(--txt); white-space: nowrap; font-weight: 600;
}
.chip.ouro { background: color-mix(in srgb, var(--acento2) 16%, transparent); border-color: color-mix(in srgb, var(--acento2) 42%, transparent); color: var(--acento2); }
.chip.fraco { background: color-mix(in srgb, var(--txt2) 12%, transparent); border-color: var(--linha); color: var(--txt2); }
.chip.ok { background: rgba(34,180,110,.16); border-color: rgba(34,180,110,.45); color: #7fe0b0; }

/* ---------- Alerta ---------- */
.alerta {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,170,40,.1); border: 1px solid rgba(255,170,40,.38);
  color: #ffd79a; border-radius: var(--raio-sm); padding: 11px 13px;
  font-size: 13px; line-height: 1.45; margin-bottom: var(--gap);
}
.alerta b { color: #ffe9c4; }

/* ---------- Itens de lista ---------- */
.item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 13px 15px; border-bottom: 1px solid color-mix(in srgb, var(--linha) 55%, transparent);
  background: none; color: inherit; transition: background .15s;
}
.item:last-child { border-bottom: 0; }
.item:active { background: color-mix(in srgb, var(--acento) 12%, transparent); }
.item .ic {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  background: color-mix(in srgb, var(--acento) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--acento) 34%, transparent);
}
.item .t { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.item .s { font-size: 12px; color: var(--txt2); margin-top: 3px; line-height: 1.35; }
.item .v { text-align: right; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.item .v small { display: block; font-size: 10.5px; font-weight: 500; color: var(--txt2); }
.seta { color: var(--txt2); font-size: 17px; flex: none; }
.seta[data-acao] { padding: 10px 12px; border-radius: 10px; }
.seta[data-acao]:active { background: color-mix(in srgb, #ff5a3c 18%, transparent); color: #ff8b6a; }

/* ---------- Lista de atividades: arrastar para reordenar ---------- */
.lista-ativ .item-ativ {
  display: flex; align-items: stretch;
  border-bottom: 1px solid color-mix(in srgb, var(--linha) 55%, transparent);
}
.lista-ativ .item-ativ:last-child { border-bottom: 0; }
.lista-ativ .item-ativ.arrastando {
  background: color-mix(in srgb, var(--acento) 16%, transparent);
  border-radius: var(--raio-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.lista-ativ .item-ativ .item { border-bottom: 0; padding-left: 4px; }
.alca {
  flex: none; width: 34px; display: grid; place-items: center;
  color: var(--txt2); font-size: 17px; touch-action: none; cursor: grab;
}
.alca:active { color: var(--acento2); cursor: grabbing; }

/* ---------- Roteiro (timeline) ---------- */
.dia-grupo { margin-bottom: 26px; }
.dia-cab {
  position: sticky; top: calc(58px + var(--topo)); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.dia-cab .flag { width: 26px; height: 18px; border-radius: 3px; }
.dia-cab h3 { margin: 0; font-size: 15px; }
.dia-cab span { font-size: 11.5px; color: var(--txt2); margin-left: auto; }

.dia {
  display: flex; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; align-items: flex-start;
  border-bottom: 1px solid color-mix(in srgb, var(--linha) 50%, transparent);
}
.dia:active { background: color-mix(in srgb, var(--acento) 10%, transparent); }
.dia .data {
  flex: none; width: 56px; text-align: center; padding-top: 2px;
}
.dia .data b { display: block; font-size: 19px; line-height: 1; }
.dia .data i { font-style: normal; font-size: 9.5px; text-transform: uppercase; color: var(--txt2); letter-spacing: .3px; display: block; white-space: nowrap; }
.dia .corpo { flex: 1; min-width: 0; }
.dia .tit { font-size: 14.5px; font-weight: 650; }
.dia .desc { font-size: 12.5px; color: var(--txt2); margin-top: 3px; line-height: 1.4; }
.dia.hoje { background: color-mix(in srgb, var(--acento) 15%, transparent); }
.dia.hoje .data b { color: var(--acento2); }
.dia.passado { opacity: .5; }

/* ---------- Barras de custo ---------- */
.barra { height: 9px; border-radius: 99px; background: color-mix(in srgb, var(--txt2) 18%, transparent); overflow: hidden; margin-top: 8px; }
.barra i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--acento), var(--acento2)); transition: width .4s ease; }
.barra.estourou i { background: linear-gradient(90deg, #ff5a3c, #ff9a3c); }

.grande {
  text-align: center; padding: 20px 15px;
}
.grande .num { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.grande .lbl { font-size: 11.5px; color: var(--txt2); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 6px; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- Formulários ---------- */
label.campo { display: block; margin-bottom: 13px; }
label.campo > span { display: block; font-size: 11.5px; color: var(--txt2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=time], textarea, select {
  width: 100%; padding: 12px 13px; border-radius: var(--raio-sm);
  background: color-mix(in srgb, var(--bg) 70%, #000 8%);
  border: 1px solid var(--linha); color: var(--txt); font-size: 16px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--acento) 65%, transparent); outline-offset: 1px; }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 17px; border-radius: var(--raio-sm); font-size: 14.5px; font-weight: 700;
  background: var(--acento); color: var(--sobre); width: 100%;
}
.btn:active { transform: scale(.985); }
.btn.sec { background: color-mix(in srgb, var(--txt2) 16%, transparent); color: var(--txt); border: 1px solid var(--linha); }
.btn.perigo { background: #a01f1f; color: #fff; }
.btn.mini { width: auto; padding: 9px 13px; font-size: 13px; }
.btns { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- Galeria de fotos ---------- */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.galeria .miniatura { position: relative; aspect-ratio: 1; border-radius: var(--raio-sm); overflow: hidden; border: 1px solid var(--linha); }
.galeria .miniatura img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria .miniatura .x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; font-size: 14px; display: grid; place-items: center;
}
.add-foto {
  aspect-ratio: 1; border: 1.5px dashed var(--linha); border-radius: var(--raio-sm);
  display: grid; place-items: center; color: var(--txt2); font-size: 24px;
}

/* ---------- Modal / folha ---------- */
.folha-fundo {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.62);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: aparece .18s ease;
}
.folha {
  width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--card2), var(--bg));
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--linha);
  padding: 8px 16px calc(26px + var(--base));
  animation: sobe .26s cubic-bezier(.2,.9,.3,1);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;   /* impede o "puxar e travar" quando chega no topo do conteúdo */
  touch-action: pan-y;
}
.folha.sem-transicao { animation: none; }
/* área de toque do puxador bem maior que a barrinha visível — mais fácil de agarrar no celular */
.folha .alca-folha {
  margin: -6px -16px 8px; padding: 14px 0 12px;
  display: flex; justify-content: center;
  touch-action: none; cursor: grab;
}
.folha .puxador { width: 42px; height: 4px; border-radius: 99px; background: var(--linha); pointer-events: none; }
.folha .alca-folha:active .puxador { background: var(--acento2); }
.folha h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.3px; }
.folha .sub { color: var(--txt2); font-size: 13px; margin-bottom: 16px; }
@keyframes sobe { from { transform: translateY(28px); opacity: .4; } }
@keyframes aparece { from { opacity: 0; } }

/* ---------- Barra inferior ---------- */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px calc(8px + var(--base));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--linha);
}
.abas button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border-radius: 12px; color: var(--txt2); font-size: 10.5px; font-weight: 600;
}
.abas button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.abas button.ativa { color: var(--acento2); }
.abas button.ativa svg { stroke: var(--acento2); }

/* ---------- Cofre ---------- */
.oculto-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; }
.cofre-item .val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-all; }
.aviso-cofre {
  font-size: 12px; color: var(--txt2); line-height: 1.55;
  background: color-mix(in srgb, var(--txt2) 8%, transparent);
  border: 1px solid var(--linha); border-radius: var(--raio-sm); padding: 11px 13px;
}

.vazio { text-align: center; padding: 34px 20px; color: var(--txt2); font-size: 13.5px; line-height: 1.6; }
.vazio .ico { font-size: 40px; opacity: .5; display: block; margin-bottom: 10px; }

.oculto { display: none !important; }

@media (min-width: 640px) {
  .heroi .arte, .heroi img.foto { height: 240px; }
  main { padding: 20px; }
}
