:root { color-scheme: dark; --nav-h: 64px; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  font-variant-numeric: tabular-nums;
  background: radial-gradient(90% 320px at 50% -60px, rgba(154, 108, 255, .16), transparent 100%) no-repeat;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button, a { cursor: pointer; touch-action: manipulation; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* En-tête et menu : en bas sur téléphone, à portée de pouce */
.top { display: flex; align-items: center; gap: 10px; max-width: 720px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 6px; }
.top img { flex: none; border-radius: 7px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
#nav { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: flex; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); background: rgba(13, 11, 28, .94); border-top: 1px solid var(--border); backdrop-filter: blur(14px); }
#nav button { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 0 4px; background: none; border: 0; border-radius: var(--radius-sm); font-size: 11px; font-weight: 800; color: var(--dim); }
#nav .i { width: 21px; height: 21px; }
#nav button[aria-current] { color: var(--text); background: var(--accent-soft); }
#nav button[aria-current] .i { color: var(--accent-2); }
body:has(input:focus, select:focus, [contenteditable]:focus) #nav { display: none; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 40px); }
@media (min-width: 760px) {
  .top { padding-top: 22px; padding-bottom: 14px; }
  #nav { position: static; margin-left: auto; padding: 0; gap: 2px; background: none; border: 0; backdrop-filter: none; }
  #nav button { flex: none; display: flex; align-items: center; gap: 7px; padding: 8px 12px; font-size: 14px; color: var(--muted); }
  #nav .i { width: 16px; height: 16px; }
  #nav button:hover { color: var(--text); }
  main { padding-bottom: 56px; }
}

/* Résumé de la journée */
.today { padding: 18px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); }
.today-k { margin: 0; font-size: 14px; color: var(--muted); }
.today-v { margin: 2px 0 12px; font-size: 34px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.today-v small { font-size: 16px; color: var(--muted); letter-spacing: 0; }
.today-v.ok { color: var(--green); }
.today-f { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.today-pace { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.today-pace p { margin: 0; }
.today-pace p:first-child { font-size: 16px; font-weight: 800; color: var(--text); }
.today-pace .today-eta { margin-top: 4px; font-weight: 800; }
.today-eta.late { color: var(--orange); }
.today-pace .link { display: block; min-height: 40px; margin-top: 2px; }
.end-form { grid-template-columns: 1fr auto; align-items: end; margin-top: 12px; }
.track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; min-width: 4px; background: var(--grad); border-radius: inherit; transition: width .3s ease; }
.track i.zero { min-width: 0; }

/* Listes */
.group { margin: 26px 0 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.group.done { color: var(--green); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.item.idle { background: none; border-color: transparent; border-bottom-color: var(--border); border-radius: 0; }
.item.idle .code { font-size: 16px; color: var(--muted); }
.item.idle .name { color: var(--dim); }
.item.idle.open { background: var(--surface); border-color: var(--border); border-radius: var(--radius-sm); }
.item.finished { background: none; }
.item.finished .code { color: var(--muted); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; min-height: 60px; padding: 10px 14px; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; }
button.row:hover, a.row:hover { background: var(--accent-soft); }
.code { display: block; font-size: 18px; font-weight: 800; line-height: 1.3; }
.name { display: block; font-size: 14px; line-height: 1.35; color: var(--muted); }
.left { flex: none; text-align: right; }
.left b { display: block; font-size: 18px; font-weight: 800; line-height: 1.3; }
.left small { display: block; font-size: 14px; line-height: 1.3; color: var(--muted); }
.add-goal { font-size: 13px; font-weight: 800; color: var(--dim); }
.ok, .ok b { color: var(--green); }
.ok b { display: inline-flex; align-items: center; gap: 5px; }
.ok .i { width: 15px; height: 15px; stroke-width: 2.6; }
.over b { color: var(--orange); }
.item > .track { height: 3px; border-radius: 0; background: transparent; }
.item > .track i { border-radius: 0; min-width: 0; }

.panel { padding: 4px 14px 14px; border-top: 1px solid var(--border); }
.info { margin: 10px 0 12px; font-size: 14px; color: var(--muted); }
.extras { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; color: var(--accent-2); }
.extras li { padding: 2px 0; overflow-wrap: anywhere; }
.item > .extras { margin: 0; padding: 0 14px 10px; }

/* Formulaires */
form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel form { margin-top: 12px; }
.panel .info + form, .panel .extras + form { margin-top: 0; }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 5px; font-size: 14px; color: var(--muted); }
input, select { width: 100%; min-height: 50px; padding: 8px 12px; font-size: 18px; font-weight: 800; background: var(--deep); border: 1px solid var(--border-2); border-radius: var(--radius-sm); }
input:focus, select:focus { border-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
label.check input { width: 22px; min-height: 22px; accent-color: var(--accent); }

.go { min-height: 50px; padding: 0 18px; background: var(--grad); color: var(--accent-ink); border: 0; border-radius: var(--radius-sm); font-weight: 800; transition: transform .08s ease, filter .15s ease; }
.go:hover { filter: brightness(1.08); }
.go:active { transform: scale(.98); }
.go:disabled { opacity: .6; }
.links { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 6px; }
.link { min-height: 44px; padding: 0; text-align: left; background: none; border: 0; font-size: 14px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.link.bad { color: var(--red); }
.action { display: block; width: 100%; min-height: 50px; margin-top: 12px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm); font-weight: 800; }
.action:hover { border-color: var(--accent); }
.action.end { margin-top: 28px; background: none; color: var(--muted); }
.sub-form { margin-top: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tag { color: var(--accent-2); }

/* Connexion */
.login { max-width: 380px; margin: 9vh auto 0; padding: 26px 22px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); }
.login img { display: block; margin-bottom: 14px; border-radius: 12px; }
.login h2 { margin: 0 0 18px; font-size: 24px; font-weight: 800; }
.login form { grid-template-columns: 1fr; gap: 12px; }
.login .go { margin-top: 4px; }

/* Bilans */
.report-title { margin: 8px 0 2px; font-size: 22px; font-weight: 800; line-height: 1.25; }
.report-title::first-letter { text-transform: uppercase; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.stats div { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stats div:first-child { grid-column: 1 / -1; border-color: var(--border-2); }
.stats div:first-child dd { font-size: 34px; }
.stats dt { font-size: 14px; line-height: 1.3; color: var(--muted); }
.stats dd { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.3; }
.stats small { font-size: 14px; color: var(--muted); }
.account-name { margin: 8px 0 16px; font-size: 18px; font-weight: 800; }
.empty { margin-top: 16px; text-align: center; color: var(--dim); }

.toast { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--radius-sm); font-weight: 800; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: rise .18s ease; }
.toast.err { border-color: var(--red); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 760px) { .toast { bottom: 20px; } }
body:has(input:focus, select:focus, [contenteditable]:focus) .toast { bottom: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
