/* Cosmic Titanium */
@font-face { font-family: Ui; src: url(/fonts/ui.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: Title; src: url(/fonts/title.woff2) format('woff2'); font-weight: 100 800; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #070b13; --surface: #111827; --raised: #18263c;
  --blue: #5865f2; --cyan: #38d9f5; --white: #f4f7ff; --dim: #92a4ba; --amber: #fbbf24;
  /* azul um pouco mais fundo para texto branco continuar legível */
  --blue-ink: #4552e0;
  --edge: rgb(180 205 255 / .1);
  --shine: inset 0 1px 0 rgb(244 247 255 / .07);
  --card: linear-gradient(160deg, rgb(24 38 60 / .86), rgb(17 24 39 / .9) 55%, rgb(13 19 32 / .92));
  --action: linear-gradient(135deg, #f4f7ff, #d6e6ff 55%, #bdeefa);
  --spring: cubic-bezier(.2, .9, .25, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { font: 400 1rem/1.5 Ui, system-ui, sans-serif; color: var(--white); min-height: 100dvh; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
/* luz ambiente */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 85% 42% at 50% 14%, rgb(88 101 242 / .2), transparent 70%), radial-gradient(ellipse 70% 38% at 108% 68%, rgb(56 217 245 / .09), transparent 70%), radial-gradient(ellipse 80% 40% at -10% 100%, rgb(88 101 242 / .13), transparent 70%), linear-gradient(180deg, #0a101c, var(--bg) 45%); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
h1, h2, h3 { font-family: Title, system-ui, sans-serif; font-weight: 500; line-height: 1.15; letter-spacing: -.03em; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
input, textarea, select { background: rgb(7 11 19 / .6); border: 1px solid var(--edge); border-radius: 16px; padding: .8rem 1rem; min-width: 0; font-size: 1rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px rgb(56 217 245 / .16); }
::placeholder { color: #6c7d94; }

/* botões */
.primary, .secondary, .fab, .grid button, .custom button, .chips button, .icon-btn, .tabs button { transition: scale .18s var(--spring), background-color .2s, border-color .2s, color .2s, filter .2s; }
.primary:active, .secondary:active, .fab:active, .grid button:active, .custom button:active, .chips button:active, .icon-btn:active, .tabs button:active { scale: .95; }
@media (hover: hover) { .primary:hover:enabled, .fab:hover { filter: brightness(1.06) drop-shadow(0 0 10px rgb(56 217 245 / .28)); } .secondary:hover:enabled, .grid button:hover, .custom button:hover, .icon-btn:hover { border-color: rgb(56 217 245 / .45); } }
.primary { background: var(--action); color: #0a1426; font-weight: 700; border-radius: 99px; padding: .8rem 1.5rem; box-shadow: 0 10px 26px -14px rgb(56 217 245 / .75); }
.primary.small { padding: .6rem 1.15rem; }
.primary.wide { width: 100%; padding: .95rem; }
.secondary { background: rgb(36 55 85 / .5); border: 1px solid var(--edge); box-shadow: var(--shine); border-radius: 99px; padding: .6rem 1.15rem; font-weight: 600; }
.link { color: var(--cyan); font-weight: 600; padding: .5rem 0; }
.danger { color: var(--amber); font-weight: 600; padding: .5rem 0; }
.muted { color: var(--dim); font-size: .94rem; }

/* entrada */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 28px; }
.login form { width: min(100%, 360px); display: grid; gap: .8rem; text-align: center; }
.login h1 { font-size: 4.6rem; font-weight: 300; letter-spacing: -.07em; background: linear-gradient(120deg, var(--white) 30%, #9fb4ff 65%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .1em; }
.login p { color: var(--dim); }
.login label { font-weight: 600; margin-top: 1.4rem; text-align: left; }
.login p.error { color: var(--amber); min-height: 1.5em; }

/* topo e núcleo */
.sky { padding: calc(env(safe-area-inset-top) + 10px) 20px 6px; text-align: center; }
.sky-top { display: flex; align-items: center; justify-content: space-between; text-align: left; position: relative; z-index: 2; }
.date { color: var(--dim); font-size: .92rem; font-weight: 500; }
.date::first-letter { text-transform: uppercase; }
.icon-btn { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--edge); box-shadow: var(--shine); }
.icon-btn svg { width: 21px; height: 21px; }
.orb { --energy: 0; --beat: 0; position: relative; width: min(94%, 390px, 36svh); aspect-ratio: 1; margin: -26px auto -30px; }
.orb::before { content: ''; position: absolute; inset: 6%; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgb(56 217 245 / .34), rgb(88 101 242 / .22) 38%, transparent 70%); opacity: calc(.35 + .5 * var(--energy) + .35 * var(--beat)); scale: calc(1 + .09 * var(--beat)); }
.orb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb.complete::before { background: radial-gradient(circle, rgb(244 247 255 / .34), rgb(56 217 245 / .3) 34%, transparent 70%); }
/* sem WebGL: anel de progresso e núcleo desenhados em CSS */
.orb.fallback canvas { display: none; }
.orb.fallback::after { content: ''; position: absolute; inset: 14%; border-radius: 50%; padding: 3px; background: conic-gradient(var(--blue), var(--cyan) calc(var(--energy) * 100%), rgb(146 164 186 / .18) 0); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.orb.fallback .core-still { display: block; }
.core-still { display: none; position: absolute; inset: 27%; border-radius: 42% 58% 55% 45% / 52% 44% 56% 48%; background: radial-gradient(circle at 30% 26%, #fff, #8fd9f5 14%, #3b4bc4 40%, #0e1a3a 66%, #38d9f5 94%); }
.percent { position: relative; z-index: 1; width: fit-content; margin: 0 auto; font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--dim); background: rgb(17 24 39 / .8); border: 1px solid var(--edge); border-radius: 99px; padding: .15rem .8rem; white-space: nowrap; }
#headline { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; text-align: left; }
#count { font-family: Title, system-ui, sans-serif; font-size: 5.1rem; font-weight: 200; letter-spacing: -.07em; line-height: .86; font-variant-numeric: tabular-nums; background: linear-gradient(170deg, #fff 35%, #a9c8ff 70%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .06em .04em 0; }
#count:empty { display: none; }
#count-label { font-size: 1.36rem; font-weight: 400; line-height: 1.22; white-space: pre-line; }
#count:empty + #count-label { font-size: 1.75rem; text-align: center; }
.subline { color: var(--dim); margin-top: 4px; font-size: .86rem; }

/* linha do dia */
.day { margin: 12px auto 0; max-width: 460px; }
.day-track { position: relative; height: 2px; margin: 0 7px; border-radius: 2px; background: rgb(146 164 186 / .2); }
.day-track i { position: absolute; inset: 0 auto 0 0; width: var(--now, 0%); border-radius: 2px; background: linear-gradient(90deg, transparent, var(--blue) 40%, var(--cyan)); }
.day-track i::after { content: ''; position: absolute; right: -1px; top: -5px; width: 2px; height: 12px; border-radius: 2px; background: var(--white); box-shadow: 0 0 8px 1px rgb(56 217 245 / .8); }
.dot { position: absolute; top: 50%; width: 30px; height: 30px; translate: -50% -50%; display: grid; place-items: center; }
.dot::after { content: ''; width: 10px; height: 10px; rotate: 45deg; border-radius: 2px; background: var(--bg); border: 1.5px solid var(--white); }
.dot.done::after { background: var(--cyan); border-color: var(--cyan); }
.dot.late::after { background: var(--amber); border-color: var(--amber); }
.day-hours { display: flex; justify-content: space-between; margin-top: 6px; font-size: .7rem; color: #6c7d94; font-variant-numeric: tabular-nums; }

/* conteúdo */
.content { padding: 14px 16px calc(120px + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }
.status, .banner { background: var(--card); border: 1px solid var(--edge); box-shadow: var(--shine); border-radius: 22px; padding: .8rem 1.1rem; margin-bottom: 14px; font-size: .94rem; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 1.1rem; }
.banner p { flex: 1 1 100%; }

/* destaque */
.focus { position: relative; border-radius: 26px; padding: 16px 18px 18px; background: radial-gradient(ellipse 75% 110% at 100% 0%, rgb(88 101 242 / .34), transparent 68%), radial-gradient(ellipse 60% 80% at 0% 100%, rgb(56 217 245 / .1), transparent 70%), var(--card); box-shadow: 0 26px 44px -30px #000; }
/* borda de titânio, mais clara onde a luz bate */
.focus::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background: linear-gradient(145deg, rgb(244 247 255 / .45), rgb(180 205 255 / .08) 32%, rgb(180 205 255 / .06) 68%, rgb(56 217 245 / .4)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.focus.late { background: radial-gradient(ellipse 75% 110% at 100% 0%, rgb(251 191 36 / .2), transparent 68%), var(--card); }
.focus.late::before { background: linear-gradient(145deg, rgb(251 191 36 / .75), rgb(251 191 36 / .12) 40%, rgb(251 191 36 / .3)); }
.focus-top { display: flex; justify-content: space-between; gap: 12px; font-size: .84rem; font-weight: 600; color: var(--cyan); font-variant-numeric: tabular-nums; }
.focus.late .focus-top { color: var(--amber); }
.focus-title { display: block; width: 100%; text-align: left; font-family: Title, system-ui, sans-serif; font-size: 1.32rem; font-weight: 500; letter-spacing: -.035em; line-height: 1.28; margin: 8px 0 2px; overflow-wrap: anywhere; user-select: text; }
.focus-meta { color: var(--dim); font-size: .9rem; overflow-wrap: anywhere; }
.focus-note { color: var(--dim); font-size: .88rem; margin-top: 4px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.focus-title { max-height: 5.2em; overflow: hidden; }
.focus-actions { position: relative; display: flex; gap: 8px; margin-top: 14px; }
.focus-actions button { padding: .7rem .85rem; white-space: nowrap; min-width: 0; }
.focus-actions .primary { flex: 1; }

/* lista */
.group h2 { font-size: 1.02rem; margin: 28px 4px 12px; }
.group.late h2 { color: var(--amber); }
.group ul { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.item { position: relative; border-radius: 20px; overflow: hidden; }
.reveal { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 24px; font-weight: 700; opacity: 0; }
.item[data-side='done'] .reveal { opacity: 1; justify-content: flex-start; background: var(--raised); }
.item[data-side='later'] .reveal { opacity: 1; justify-content: flex-end; background: var(--raised); }
.item.armed[data-side='done'] .reveal { background: var(--cyan); color: #04202a; }
.item.armed[data-side='later'] .reveal { background: var(--amber); color: #251a00; }
.task { position: relative; display: flex; align-items: center; gap: 4px; padding: 8px 12px 8px 8px; border-radius: 20px; background: linear-gradient(160deg, #17233a, #111827 60%, #0f1625); border: 1px solid var(--edge); box-shadow: var(--shine); touch-action: pan-y; transition: translate .45s var(--spring), border-color .2s; }
@media (hover: hover) { .task:hover { border-color: rgb(56 217 245 / .32); } }
.item.dragging .task { transition: none; }
.task.late { border-color: rgb(251 191 36 / .35); }
.check { flex: none; width: 50px; height: 50px; display: grid; place-items: center; }
.check i { width: 27px; height: 27px; border-radius: 10px; border: 1.5px solid #52698c; display: grid; place-items: center; transition: background .25s, border-color .25s, scale .3s cubic-bezier(.3, 2, .5, 1); }
.check svg { width: 17px; height: 17px; stroke: #04141f; stroke-width: 3; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .05s ease-out; }
.check:hover i { border-color: var(--cyan); }
.check:active i { scale: .82; }
.task.done { background: rgb(17 24 39 / .55); }
.task.done .check i { background: linear-gradient(135deg, #8b9bff, var(--cyan)); border-color: transparent; }
.task.done .check svg { stroke-dashoffset: 0; }
.open { flex: 1; min-width: 0; text-align: left; padding: 9px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.title { font-weight: 600; font-size: 1.03rem; overflow-wrap: anywhere; text-decoration: line-through transparent; transition: text-decoration-color .3s, color .3s; }
.task.done .title { color: var(--dim); text-decoration-color: currentColor; }
.meta { font-size: .84rem; color: var(--dim); display: flex; flex-wrap: wrap; column-gap: .8rem; font-variant-numeric: tabular-nums; }
.task.late .when-label { color: var(--amber); font-weight: 600; }
.note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-width: 0; }
.hint { text-align: center; color: #6c7d94; font-size: .8rem; margin-top: 18px; }
.empty { margin-top: 12px; padding: 36px 24px; text-align: center; color: var(--dim); background: var(--card); border: 1px solid var(--edge); box-shadow: var(--shine); border-radius: 28px; }
.empty strong { display: block; font-family: Title, system-ui, sans-serif; font-size: 1.3rem; font-weight: 500; letter-spacing: -.03em; line-height: 1.28; color: var(--white); margin-bottom: 8px; }

/* troca de lista */
.content.switching { animation: swap .38s var(--spring); }
@keyframes swap { from { opacity: 0; translate: var(--from, 18px) 0; } }

/* menu de vidro */
.dock { position: fixed; z-index: 5; left: 14px; right: 14px; bottom: calc(max(env(safe-area-inset-bottom) - 10px, 14px)); max-width: 460px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.tabs { flex: 1; display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; padding: 6px; border-radius: 24px; background: linear-gradient(160deg, rgb(36 55 85 / .62), rgb(13 20 34 / .7)); border: 1px solid rgb(180 205 255 / .16); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); box-shadow: inset 0 1px 0 rgb(244 247 255 / .12), 0 18px 40px -14px #000; }
.tabs button { padding: .72rem .8rem; border-radius: 18px; font-weight: 600; font-size: .9rem; color: var(--dim); white-space: nowrap; }
.tabs button[aria-pressed='true'] { background: linear-gradient(150deg, rgb(88 101 242 / .62), rgb(69 82 224 / .38)); color: var(--white); box-shadow: inset 0 1px 0 rgb(244 247 255 / .2); }
.tabs span { font-size: .74rem; color: var(--cyan); margin-left: .12rem; font-variant-numeric: tabular-nums; }
.tabs span:empty { display: none; }
.fab { flex: none; width: 62px; height: 62px; border-radius: 22px; display: grid; place-items: center; background: var(--action); color: #0a1426; box-shadow: 0 14px 32px -12px rgb(56 217 245 / .7); }
.fab svg { width: 27px; height: 27px; stroke-width: 2.2; }

/* painéis */
.sheet, .adder { width: min(100%, 520px); max-width: 100%; color: var(--white); padding: 0; background: radial-gradient(ellipse 90% 45% at 100% 0%, rgb(88 101 242 / .22), transparent 70%), linear-gradient(170deg, rgb(24 38 60 / .97), rgb(11 17 29 / .98) 60%); border: 1px solid rgb(180 205 255 / .17); overscroll-behavior: contain; box-shadow: var(--shine), 0 40px 90px -20px #000; }
.sheet { max-height: 92dvh; margin: auto auto 0; border-bottom: 0; border-radius: 32px 32px 0 0; }
.sheet::backdrop, .adder::backdrop { background: rgb(3 6 12 / .68); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sheet[open] { animation: rise .42s var(--spring); }
@keyframes rise { from { translate: 0 60px; opacity: 0; } }
/* No alto da tela para o teclado do iPhone não cobrir. */
.adder { margin: calc(env(safe-area-inset-top) + 10px) auto auto; width: min(calc(100% - 20px), 520px); border-radius: 30px; }
.adder[open] { animation: drop .42s var(--spring); }
@keyframes drop { from { translate: 0 -40px; scale: .96; opacity: 0; } }
.sheet form, .sheet-body, .adder form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; padding: 20px 20px calc(22px + env(safe-area-inset-bottom)); }
.adder form { padding-bottom: 20px; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 1.36rem; }
.sheet label, .sheet legend { font-weight: 600; font-size: .88rem; color: var(--dim); }
.sheet h3 { font-size: 1.03rem; margin-top: 16px; }
.e-title, #new-title { font-size: 1.12rem; }
textarea { resize: vertical; }
fieldset { border: 0; display: grid; gap: 8px; min-width: 0; }
legend { margin-bottom: 8px; }
.grid { display: flex; flex-wrap: wrap; gap: 8px; }
.grid button, .custom button { flex: 1 1 auto; background: rgb(36 55 85 / .45); border: 1px solid var(--edge); box-shadow: var(--shine); border-radius: 15px; padding: .75rem .8rem; font-weight: 600; }
.custom { display: flex; align-items: center; gap: 8px; }
.custom input { width: 5.2rem; text-align: center; }
.when { display: flex; gap: 12px; align-items: center; }
.when input { flex: 1; }
.sheet-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.switch { display: flex; align-items: center; gap: 10px; flex: 1; }
.switch input { width: 22px; height: 22px; accent-color: var(--blue); }
#logout { justify-self: start; margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border-radius: 14px; padding: .5rem .9rem; border: 1px solid var(--edge); background: rgb(36 55 85 / .4); font-size: .88rem; font-weight: 600; }
.chips button[aria-pressed='true'] { background: var(--blue-ink); border-color: #7d89ff; color: #fff; }

.toast { position: fixed; inset: auto 16px calc(100px + env(safe-area-inset-bottom)) 16px; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px); border: 1px solid rgb(180 205 255 / .22); border-radius: 18px; background: rgb(24 38 60 / .97); color: var(--white); padding: .75rem 1.2rem; box-shadow: var(--shine), 0 18px 40px -14px #000; font-size: .92rem; }
.toast:popover-open { display: flex; gap: 18px; align-items: center; animation: swap .3s var(--spring); }
.toast button { font-weight: 700; color: var(--cyan); }

@media (max-width: 360px) { .tabs button { padding: .7rem .5rem; font-size: .84rem; } .tabs span { display: none; } }
@media (min-width: 900px) and (min-height: 600px) {
  .app { display: grid; grid-template-columns: minmax(420px, 50%) minmax(0, 1fr); align-items: start; }
  .sky { position: sticky; top: 0; height: 100dvh; padding: 28px 40px 24px max(40px, env(safe-area-inset-left)); display: flex; flex-direction: column; border-right: 1px solid var(--edge); background: radial-gradient(ellipse 80% 55% at 50% 38%, rgb(88 101 242 / .12), transparent 70%); }
  .stage { flex: 1; min-height: 0; display: grid; align-content: center; justify-items: center; container-type: size; }
  .orb { width: min(100cqw, 100cqh - 26px, 580px); margin: 0; }
  .day { width: 100%; }
  .content { padding: 40px max(36px, env(safe-area-inset-right)) 130px 36px; }
  .dock { left: max(50%, 420px); bottom: 22px; }
  .sheet { margin: auto; border-bottom: 1px solid rgb(180 205 255 / .17); border-radius: 32px; }
  .adder { margin: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (prefers-reduced-transparency: reduce) { .tabs, .percent { background: var(--raised); backdrop-filter: none; -webkit-backdrop-filter: none; } }
