:root {
  --creme: #F4EFE7;
  --papel: #FFFDF9;
  --navy: #1C2A48;
  --navy-2: #3B4A6B;
  --cinza: #7C8496;
  --linha: #E3DCCF;
  --red: #D52B1E;
  --verde: #2E8B57;
  --ambar: #E0A100;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--creme); color: var(--navy);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Abertura ---------- */
#splash { position: fixed; inset: 0; z-index: 50; background: var(--creme);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: opacity .45s ease; }
#splash.fora { opacity: 0; pointer-events: none; }
.splash-logo { width: 190px; height: 190px; }
.sp-ring { fill: none; stroke: var(--navy); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 503; stroke-dashoffset: 503; transform: rotate(-90deg); transform-origin: 100px 100px;
  animation: desenha 1s .1s ease-out forwards; }
.sp-sigma { fill: none; stroke: var(--red); stroke-width: 17; stroke-linejoin: miter; stroke-linecap: butt;
  stroke-dasharray: 260; stroke-dashoffset: 260;
  animation: desenha .9s .6s cubic-bezier(.6,.1,.3,1) forwards, pulso .35s 1.55s ease-out; transform-origin: 100px 100px; }
.sp-word { font-weight: 900; font-size: 34px; letter-spacing: 2px; opacity: 0; transform: translateY(12px);
  animation: sobe .5s 1.45s ease-out forwards; }
.sp-tag { font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--navy-2); opacity: 0;
  animation: sobe .5s 1.8s ease-out forwards; }
@keyframes desenha { to { stroke-dashoffset: 0; } }
@keyframes pulso { 50% { transform: scale(1.08); } }
@keyframes sobe { to { opacity: 1; transform: none; } }
.sig { color: var(--red); }

/* ---------- Topo e abas ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: baseline; justify-content: space-between; }
.brand { font-weight: 900; letter-spacing: 1.5px; font-size: 19px; }
.top .sig { color: #FF4A3B; }
.top-sub { font-size: 13px; opacity: .8; }
main { padding: 14px 14px 20px; max-width: 560px; margin: 0 auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--papel);
  border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 0 9px; font-size: 11.5px; color: var(--cinza);
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs .ic { font-size: 18px; line-height: 1; }
.tabs button.on { color: var(--red); font-weight: 700; }

/* ---------- Cartões ---------- */
.card { background: var(--papel); border: 1px solid var(--linha); border-radius: var(--radius);
  padding: 14px 15px; margin-bottom: 12px; }
.card h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--navy-2); }
.card h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.2; }
.card ul { margin: 6px 0 0; padding-left: 18px; }
.card li { margin: 3px 0; }
.muted { color: var(--cinza); font-size: 14px; }
.small { font-size: 13px; }
.destaque { border-left: 5px solid var(--red); }

.datebar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.datebar button { border: 1px solid var(--linha); background: var(--papel); border-radius: 10px; width: 44px; height: 40px; font-size: 20px; }
.datebar .d { text-align: center; }
.datebar .d b { display: block; font-size: 17px; }
.datebar .d span { font-size: 13px; color: var(--cinza); }

/* Semáforo */
.sema { display: flex; gap: 12px; align-items: center; }
.luz { width: 46px; height: 46px; border-radius: 50%; flex: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.luz.verde { background: var(--verde); } .luz.amarelo { background: var(--ambar); }
.luz.vermelho { background: var(--red); } .luz.base { background: #9AA6C2; } .luz.sem { background: #D5CFC4; }
.sema b { font-size: 17px; display: block; }

/* Metas de comida */
.metas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 8px; }
.metas div { background: var(--creme); border-radius: 10px; padding: 8px; text-align: center; }
.metas b { display: block; font-size: 17px; }
.metas span { font-size: 12px; color: var(--cinza); }

/* Checklist */
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.chk { border: 1.5px solid var(--linha); background: var(--papel); border-radius: 999px; padding: 8px 14px; }
.chk.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Formulários */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .full { grid-column: 1 / -1; }
label { font-size: 13px; color: var(--navy-2); display: block; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 11px 12px; border: 1.5px solid var(--linha);
  border-radius: 10px; background: #fff; font-size: 17px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); }
textarea { min-height: 64px; font-size: 15px; }
.escala { display: flex; gap: 6px; margin-top: 4px; }
.escala button { flex: 1; padding: 9px 0; border: 1.5px solid var(--linha); border-radius: 10px; background: #fff; }
.escala button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn { display: block; width: 100%; margin-top: 12px; padding: 13px; border: 0; border-radius: 12px;
  background: var(--red); color: #fff; font-weight: 700; font-size: 16px; }
.btn.sec { background: var(--navy); }
.btn.claro { background: var(--papel); color: var(--navy); border: 1.5px solid var(--linha); }
.btn.mini { display: inline-block; width: auto; padding: 7px 12px; font-size: 14px; margin-top: 8px; }

/* Avisos */
.aviso { border-left: 5px solid var(--ambar); }
.aviso.red { border-left-color: var(--red); }
.aviso.ok { border-left-color: var(--verde); }

/* Plano */
.semana-bloco h2 { display: flex; justify-content: space-between; }
.dia { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linha); align-items: center; }
.dia:first-of-type { border-top: 0; }
.dia .dd { width: 54px; flex: none; font-size: 13px; color: var(--cinza); }
.dia .dd b { display: block; color: var(--navy); font-size: 15px; }
.dia .tt { flex: 1; font-size: 14.5px; }
.dia .st { width: 22px; text-align: center; }
.dia.hoje { background: #FBE9E6; margin: 0 -15px; padding: 8px 15px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--linha); }
th { font-size: 12px; color: var(--cinza); font-weight: 600; border-top: 0; }

/* Gráficos */
svg.chart { width: 100%; height: auto; display: block; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--cinza); margin-top: 6px; }
.legenda i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; }

#toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .25s; z-index: 20; pointer-events: none; }
#toast.on { opacity: 1; }
