/* Layout: coluna unica de leitura (max 640px), cabecalho com data e sequencia, tres abas na base: Hoje, Semana, 30 dias. */
:root {
  --bg: #1d1d1b;
  --surface: #272725;
  --surface2: #31312e;
  --line: #3d3d39;
  --fg: #f4f2ec;
  --muted: #a6a39a;
  --accent: #ffe100;
  --on-accent: #1a1a18;
  --accent-text: #ffe100;
  --ok: #8fd18a;
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f4ee; --surface: #ffffff; --surface2: #ece9df; --line: #d9d5c8;
    --fg: #1d1d1b; --muted: #6a675e; --accent: #ffe100; --on-accent: #1a1a18;
    --accent-text: #7a6500; --ok: #2f7a2c; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f4ee; --surface: #ffffff; --surface2: #ece9df; --line: #d9d5c8;
  --fg: #1d1d1b; --muted: #6a675e; --accent: #ffe100; --on-accent: #1a1a18;
  --accent-text: #7a6500; --ok: #2f7a2c; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  padding-block: 0 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.01em; line-height: 1.1; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.eyebrow { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header { padding-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.streak { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.datenav { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.datenav button { width: 40px; height: 40px; border-radius: 8px; border: 0; background: var(--surface2); font-size: 18px; }
.datenav button:disabled { opacity: 0.35; cursor: default; }
.datenav .label { text-align: center; flex: 1; min-width: 0; }
.datenav .label strong { display: block; font-weight: 500; text-transform: capitalize; }
.datenav .label button { width: auto; height: auto; background: none; color: var(--accent-text); font-size: 12px; padding: 0; text-decoration: underline; }

section.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row > div { min-width: 0; }

.energy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.energy button { height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); font-weight: 600; }
.energy button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.energy-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.bar { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } }

.check { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 52px; }
.box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; font-size: 15px; font-weight: 700; color: transparent; }
.check[aria-pressed="true"] .box, .check.auto.on .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check.auto { cursor: default; }
.check .t { flex: 1; min-width: 0; }
.check .t small { display: block; color: var(--muted); font-size: 12px; }

.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 20px; line-height: 1; }
.stepper output { min-width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.item { display: flex; align-items: center; gap: 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; min-height: 52px; }
.item .t { flex: 1; min-width: 0; }
.item .t small { display: block; color: var(--muted); font-size: 12px; }
.item.done { border-color: var(--accent); }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.col { background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.col .k { font-size: 12px; color: var(--muted); }
.col .v { font-family: var(--font-display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.col .stepper { margin-top: 4px; }
.col .stepper button { width: 36px; height: 36px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--fg); }
textarea { min-height: 84px; resize: vertical; }
select { background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; width: 100%; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; }
.week .d { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.week .b { width: 100%; max-width: 36px; background: var(--surface2); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.week .b.on { background: var(--accent); }
.week .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week .w { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.week .d.sel .w { color: var(--accent-text); font-weight: 600; }
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.totals .col .v { font-size: 24px; }

.grid30 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.grid30 button { aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line); background: var(--surface2); padding: 0; font-size: 10px; color: var(--muted); }
.grid30 button.part { background: color-mix(in srgb, var(--accent) 35%, var(--surface2)); color: var(--fg); border-color: transparent; }
.grid30 button.full { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.grid30 button.sel { outline: 2px solid var(--fg); outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.btn { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 12px 16px; font-weight: 600; min-height: 46px; }
.btn.ghost { background: var(--surface2); color: var(--fg); border: 1px solid var(--line); }
.notice { background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.saved { font-size: 12px; color: var(--ok); min-height: 16px; }
footer { padding-bottom: 8px; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 5;
  padding: 8px max(16px, env(safe-area-inset-left, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
nav.tabs .in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
nav.tabs button { border: 0; background: none; border-radius: 10px; padding: 12px 6px; font-weight: 500; color: var(--muted); min-height: 46px; }
nav.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

[hidden] { display: none !important; }
.wrap { width: 100%; }
main.wrap { margin-top: 18px; }
body { overflow-wrap: anywhere; }
button, .col .stepper button, .datenav button { min-width:44px; min-height:44px; }
.grid30 { grid-template-columns:repeat(7,minmax(0,1fr)); gap:7px; }
.grid30 button { font-size:12px; min-width:0; min-height:44px; }
input, textarea, select { font-size:16px !important; }
input:not([type=checkbox]):not([type=hidden]), input[type=email], input[type=password] { width:100%; background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:12px; color:var(--fg); min-height:46px; }
input[type=checkbox] { width:22px;height:22px;flex:none;accent-color:var(--accent); }
a { color:var(--accent-text); }
.stack { display:flex;flex-direction:column;gap:16px; }
.card { background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px; }
.accountbar {display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:16px;}
.accountbar .small { flex:1; }
.brand {font-size:12px;}
.brand img {max-width:180px;max-height:44px;}
dialog {background:var(--surface);color:var(--fg);border:1px solid var(--line);border-radius:16px;padding:24px;width:calc(100% - 32px);max-width:460px;max-height:90dvh;overflow:auto;}
dialog::backdrop {background:rgb(0 0 0 / .8);}
.auth-shell {min-height:100dvh;max-width:440px;justify-content:center;padding-block:32px;}
.auth-shell header {padding:0 0 12px;}
.auth-links {display:flex;flex-wrap:wrap;gap:8px;}
.auth-links button {flex:1;}
.checklabel {display:flex;align-items:center;gap:12px;min-height:44px;font-size:13px;}
.status {font-size:13px;color:var(--muted);white-space:pre-line;}
.error {color:#f4a099;}
@media(prefers-color-scheme:light) {.error {color:#a9231b;}}
.danger {border-color:#c65850 !important;}
@media(prefers-reduced-motion:reduce) {* {scroll-behavior:auto !important;animation:none !important;transition:none !important;}}
.admin-list {display:grid;gap:12px;}
.admin-list article {background:var(--surface2);padding:14px;border-radius:12px;}
.admin-list article p {margin-bottom:8px;}
.admin-actions {display:flex;gap:8px;flex-wrap:wrap;}
@media(min-width:900px) {body {padding-top:14px;} .auth-shell {padding-top:40px;}}

.col {padding:10px;}
.col .stepper output {min-width:24px;}
.grid30 {grid-template-columns:repeat(5,minmax(0,1fr));}
@media(min-width:560px) {.grid30 {grid-template-columns:repeat(10,minmax(0,1fr));}}
@media(max-width:350px) {.cols {grid-template-columns:1fr;} .item {flex-wrap:wrap;}}
