/* Tracking de Hábitos — identidade visual (ESPECIFICACAO 5b). Sem modo escuro. */

@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 800; src: url(/fonts/plus-jakarta-sans-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/plus-jakarta-sans-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/plus-jakarta-sans-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/plus-jakarta-sans-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 800; src: url(/fonts/plus-jakarta-sans-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --fundo: #f3f5fa;
  --cartao: #ffffff;
  --borda: #e6e9f2;
  --borda-campo: #d5dae9;
  --campo: #f8f9fd;
  --texto: #1a1f36;
  --texto2: #5f6785;
  --apagado: #aab1cc;
  --ambar: #8a5300;
  --app: #3b5bff;
  --app-bg: #eef1ff;
  --app-borda: #cfd8ff;
  --app-trilho: #d9e0ff;
  --app-suave: #9fb0ff;
  --nao-feito: #dfe3f1;
  --neutro: #e9ecf4;
  --perigo: #c2410c;
  --nav: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  color: var(--texto);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--app); }
:focus-visible { outline: 2px solid var(--app); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

.tela { padding: calc(28px + env(safe-area-inset-top)) 20px calc(var(--nav) + 32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.tela.sem-nav { padding-bottom: 40px; }

/* Cabeçalho */
.cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cab > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.titulo { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.2; }
.sub { font-size: 12.5px; color: var(--texto2); }
.voltar { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 700; color: var(--app); text-decoration: none; background: none; border: 0; padding: 0; margin: -8px 0 -6px; }

/* Cartões */
.card { background: var(--cartao); border: 1px solid var(--borda); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.app { background: var(--app-bg); border-color: var(--app-borda); }
.card.lista { padding: 8px 0; gap: 0; }
.card.lista > .rot { padding: 10px 16px 4px; }
.vazio { background: #f8f9fd; border: 1.5px dashed #c9cfe2; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--texto2); font-size: 13px; }
.rot { font-size: 10.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--texto2); }
.rot-linha { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.apoio { font-size: 11.5px; color: var(--texto2); }
.apoio13 { font-size: 12px; color: var(--texto2); }
.num-grande { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.num-medio { font-size: 16px; font-weight: 800; }
.linha { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.linha-base { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.forte { font-weight: 700; }
.app-cor { color: var(--app); }
.divisor { height: 1px; background: var(--borda); margin: 0; border: 0; }

/* Botões */
.btn { min-height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--borda-campo); background: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--texto); white-space: nowrap; }
.btn.pri { background: var(--app); border-color: var(--app); color: #fff; }
.btn.escuro { background: var(--texto); border-color: var(--texto); color: #fff; }
.btn.sec { color: var(--texto2); }
.btn.app-txt { color: var(--app); }
.btn.perigo { color: var(--perigo); border-color: #f1c7b4; }
.btn.grande { min-height: 46px; border-radius: 12px; font-size: 14px; width: 100%; }
.btn.cheio { width: 100%; }
.btn:disabled { opacity: 0.55; }
.btn-texto { min-height: 40px; border: 0; background: none; padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--texto2); }
.btn-texto.app-txt { color: var(--app); font-weight: 700; }
.acoes { display: flex; gap: 10px; }
.acoes > * { flex: 1; }
.acoes-dir { display: flex; justify-content: flex-end; gap: 4px; }

/* Pílulas / abas */
.pilulas { display: flex; gap: 10px; flex-wrap: wrap; }
.pilula { min-height: 38px; padding: 0 16px; border-radius: 19px; border: 1px solid #d5dae9; background: #fff; font-size: 13px; font-weight: 700; color: var(--texto2); text-decoration: none; display: inline-flex; align-items: center; }
.pilula.ativa { background: var(--app); border-color: var(--app); color: #fff; }
.seg { display: flex; background: #fff; border: 1px solid var(--borda); border-radius: 16px; padding: 4px; gap: 4px; }
.seg.cinza { background: #f6f7fb; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 11px; background: transparent; font-size: 14px; font-weight: 700; color: var(--texto2); }
.seg button[aria-pressed="true"] { background: var(--app); color: #fff; }

/* Seletor ‹ › */
.seletor { display: flex; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--borda); border-radius: 20px; padding: 0 2px; height: 42px; flex: none; }
.seletor button { width: 38px; height: 38px; border: 0; background: transparent; color: var(--app); font-size: 18px; font-weight: 700; }
.seletor button:disabled { color: #c9cfe2; }
.seletor span { font-size: 13px; font-weight: 700; padding: 0 4px; white-space: nowrap; min-width: 46px; text-align: center; }

/* Barras */
.barra { position: relative; height: 8px; border-radius: 4px; background: var(--app-trilho); }
.barra.g { height: 10px; border-radius: 5px; }
.barra .enche { height: 100%; border-radius: inherit; background: var(--app); max-width: 100%; transition: width .25s ease; }
.barra .marca { position: absolute; top: -3px; width: 2px; height: calc(100% + 6px); background: var(--texto); opacity: 0.3; margin-left: -1px; }

/* Lista de hábitos (Hoje) */
.hab { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 16px; border: 0; background: transparent; text-align: left; }
.hab .caixa { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--apagado); background: #fff; display: flex; align-items: center; justify-content: center; transition: background .12s; }
.hab[aria-pressed="true"] .caixa { background: var(--app); border-color: var(--app); }
.hab .nome { flex: 1; font-size: 14px; font-weight: 600; }
.hab[aria-pressed="true"] .nome { color: var(--texto2); }
.chip { flex: none; font-size: 11px; font-weight: 600; color: var(--texto2); background: var(--fundo); border-radius: 9px; padding: 3px 8px; white-space: nowrap; }
.chip.app { background: var(--app-bg); color: var(--app); font-weight: 700; }

/* Campos */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .rotulo { font-size: 12px; color: var(--texto2); }
.entrada { width: 100%; height: 44px; border: 1px solid var(--borda-campo); border-radius: 12px; padding: 0 14px; font-size: 16px; font-weight: 500; background: var(--campo); }
.entrada:focus { outline: 2px solid var(--app); outline-offset: 0; border-color: transparent; background: #fff; }
textarea.entrada { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.5; resize: vertical; font-weight: 500; }
.entrada-olho { position: relative; }
.entrada-olho .entrada { padding-right: 52px; }
.entrada-olho button { position: absolute; right: 2px; top: 0; width: 44px; height: 44px; border: 0; background: none; color: var(--texto2); display: flex; align-items: center; justify-content: center; }
.erro { font-size: 12px; color: var(--perigo); font-weight: 600; }
.ok-msg { font-size: 12px; color: var(--app); font-weight: 600; }
.add { display: flex; gap: 10px; align-items: flex-end; }
.add .campo { flex: 1; min-width: 0; }
.add .btn { height: 44px; }

/* Toggle */
.toggle { position: relative; flex: none; width: 40px; height: 24px; border-radius: 12px; background: #c9cfe2; border: 0; padding: 0; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 9px; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.toggle[aria-checked="true"] { background: var(--app); }
.toggle[aria-checked="true"]::after { left: 19px; }
.toggle-alvo { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 44px; margin: -8px -4px; background: none; border: 0; padding: 0; }

/* Linhas de lista (Ajustes, Mais) */
.item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; text-decoration: none; color: var(--texto); background: none; border: 0; width: 100%; text-align: left; font-size: 14px; }
.item .cresce { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .t { font-weight: 600; }
.item .d { font-size: 11.5px; color: var(--texto2); }
.seta { color: var(--apagado); font-size: 18px; font-weight: 600; flex: none; }
.alca { flex: none; width: 36px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--apagado); touch-action: none; cursor: grab; background: none; border: 0; margin-left: -8px; }
.arrastando { background: var(--app-bg); border-radius: 10px; box-shadow: 0 4px 16px rgba(26,31,54,.12); position: relative; z-index: 2; }
.mais-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; background: #fff; border: 1px solid var(--borda); border-radius: 16px; text-decoration: none; color: var(--texto); }
.mais-card .ic { flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--app-bg); display: flex; align-items: center; justify-content: center; color: var(--app); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 22px; background: var(--app); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; }
.dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.dias button { height: 40px; border-radius: 11px; border: 1px solid var(--borda-campo); background: #fff; font-size: 13px; font-weight: 700; color: var(--texto2); padding: 0; }
.dias button[aria-pressed="true"] { background: var(--app); border-color: var(--app); color: #fff; }
.cores { display: flex; gap: 14px; flex-wrap: wrap; }
.cores button { width: 36px; height: 36px; border-radius: 18px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--borda); padding: 0; }
.cores button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--texto); }
.valor-edit { min-width: 120px; text-align: right; }
.valor-btn { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--borda); background: var(--campo); font-weight: 700; font-size: 13px; }
.hora { height: 34px; border: 1px solid var(--borda); border-radius: 9px; padding: 0 6px; font-weight: 600; background: var(--campo); font-size: 16px; }

/* Grade de números (Salto) */
.grade2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bloco { background: #fff; border-radius: 12px; padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--texto); min-height: 58px; }
.bloco .r { font-size: 11px; color: var(--texto2); }
.bloco .v { font-size: 17px; font-weight: 800; }
.bloco .c { font-size: 11px; font-weight: 700; }

/* Resumo */
.dia-a-dia { display: flex; gap: 2px; }
.dia-a-dia > div { flex: 1; min-width: 0; height: 16px; border-radius: 3px; }
.c-feito { background: var(--app); }
.c-nao { background: var(--nao-feito); }
.c-futuro { border: 1px dashed #c9cfe2; }
.c-folga { background: repeating-linear-gradient(135deg, #eef0f6 0 3px, #f8f9fc 3px 6px); }
.c-fora { background: transparent; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--texto2); align-items: center; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.calor { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calor.cab7 { text-align: center; font-size: 11px; font-weight: 600; color: var(--texto2); }
.calor button, .calor .cel { height: 32px; border-radius: 7px; border: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; padding: 0; color: var(--texto); }
.calor .futuro { background: transparent; border: 1px dashed #d5dae9; color: var(--apagado); }
.colunas { position: relative; display: flex; align-items: flex-end; gap: 8px; }
.colunas > div:not(.linha-meta) { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.colunas .v { font-size: 11px; font-weight: 700; color: var(--texto2); }
.colunas .b { width: 100%; border-radius: 6px 6px 0 0; }
.colunas .b.vazia { border: 1px dashed #c9cfe2; border-bottom: 0; height: 6px; }
.linha-meta { position: absolute; left: 0; right: 0; border-top: 1px dashed #aab1cc; pointer-events: none; }
.eixo { display: flex; gap: 8px; }
.eixo span { flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--texto2); }
.ranking { display: flex; flex-direction: column; gap: 6px; }

/* Navegação inferior */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding: 8px 8px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--borda); display: flex; justify-content: space-around; align-items: stretch; z-index: 10; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--texto2); font-size: 10.5px; font-weight: 600; }
.nav a[aria-current="page"] { color: var(--app); font-weight: 700; }

/* Avisos */
.toast { position: fixed; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px; bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom)); background: var(--texto); color: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; z-index: 30; min-height: 48px; animation: sobe .2s ease; }
.toast button { flex: none; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255,255,255,.16); color: #fff; font-size: 13px; font-weight: 700; }
.offline { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: #fff6e5; border: 1px solid #f3dcae; color: var(--ambar); font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 12px; z-index: 40; }
.aviso { background: #fff6e5; border: 1px solid #f3dcae; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; line-height: 1.45; color: var(--ambar); }
.aviso .btn { flex: none; }
.aviso .btn:not(.pri) { background: #fff; color: var(--ambar); border: 0; }
.aviso.info .btn:not(.pri) { color: var(--app); }
.aviso.info { background: var(--app-bg); border-color: var(--app-borda); color: var(--texto); }

/* Folha (bottom sheet) e confirmação */
.fundo { position: fixed; inset: 0; background: rgba(26,31,54,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: aparece .15s ease; }
.folha { background: var(--fundo); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; max-height: 92vh; overflow-y: auto; animation: sobe .2s ease; }
.folha .pega { width: 40px; height: 4px; border-radius: 2px; background: #c9cfe2; align-self: center; }
.folha h2 { margin: 0; font-size: 17px; font-weight: 800; }
.dialogo { position: fixed; inset: 0; background: rgba(26,31,54,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialogo .caixa { background: #fff; border-radius: 18px; padding: 22px 20px 18px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.dialogo h2 { margin: 0; font-size: 16px; font-weight: 800; }
.dialogo p { margin: 0; font-size: 13px; color: var(--texto2); line-height: 1.5; }

@keyframes sobe { from { transform: translate(var(--tx, 0), 16px); opacity: 0; } to { transform: translate(var(--tx, 0), 0); opacity: 1; } }
.toast { --tx: -50%; }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

/* Entrar */
.entrar { padding: calc(110px + env(safe-area-inset-top)) 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.entrar h1 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.15; }
.entrar .intro { font-size: 14px; color: var(--texto2); margin: 4px 0 28px; line-height: 1.5; }

.carregando { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--texto2); }
