/* Tenda — styles. Clair le jour, sombre pour la concentration et les bilans. */
/* Polices hébergées avec l'app : aucune requête vers un service tiers. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/polices/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/polices/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/polices/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/polices/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('/polices/space-grotesk-500.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('/polices/space-grotesk-600.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('/polices/space-grotesk-700.woff2') format('woff2'); }

:root {
  --vert: #0E7C66; --vert-fonce: #0B6B58; --vert-clair: #3CCB9F;
  --orange: #E07A1F; --orange-clair: #F29A4A; --orange-fond: #FFF1E3; --orange-texte: #8A4A0B;
  --nuit: #0F2621; --nuit-2: #23413A; --nuit-bord: #2C4A43; --nuit-texte: #EAF3F0; --nuit-doux: #A9C2BB;
  --encre: #14201C; --doux: #55625D; --fond: #F3F5F4; --carte: #FFFFFF; --bord: #E3E8E6; --bord-2: #D5DDDA;
  --nia: #E6F2EE; --danger: #B3261E;
  --ombre: 0 1px 2px rgba(20,32,28,.06);
  --titres: 'Space Grotesk', Inter, system-ui, sans-serif;
  --texte: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --encre: #E8F0ED; --doux: #9DB1AA; --fond: #0B1A17; --carte: #132824; --bord: #1F3833; --bord-2: #2C4A43;
    --nia: #16332C; --orange-fond: #3A2A12; --orange-texte: #FFC58A; --ombre: none; color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --encre: #E8F0ED; --doux: #9DB1AA; --fond: #0B1A17; --carte: #132824; --bord: #1F3833; --bord-2: #2C4A43;
  --nia: #16332C; --orange-fond: #3A2A12; --orange-texte: #FFC58A; --ombre: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.45 var(--texte); min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.cache-visuel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--vert-clair); outline-offset: 2px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ecran { flex: 1; padding: calc(22px + env(safe-area-inset-top)) 18px 110px; display: flex; flex-direction: column; gap: 14px; }

/* En-tête */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.entete .sur { font-size: 13px; color: var(--doux); }
h1 { margin: 0; font-family: var(--titres); font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
h2 { margin: 0; font-family: var(--titres); font-size: 20px; font-weight: 600; }
h3, h2.h3 { margin: 0; font-family: var(--texte); font-size: 15px; font-weight: 600; letter-spacing: 0; }
h1, h2 { overflow-wrap: anywhere; }
.pile { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ligne { display: flex; align-items: center; gap: 10px; }
.entre { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.doux { color: var(--doux); }
.petit { font-size: 13px; }
.serie { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; background: var(--orange-fond); color: var(--orange-texte); border-radius: 999px; padding: 8px 12px; font-weight: 600; font-size: 14px; white-space: nowrap; border: 0; }
a.serie, a.icone-btn, a.carte { text-decoration: none; color: inherit; }
a.serie { color: var(--orange-texte); }
.icone-btn { color: var(--encre); width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--bord-2); background: var(--carte); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Cartes */
.carte { background: var(--carte); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--ombre); }
.carte.nuit { background: var(--nuit); color: var(--nuit-texte); }
.carte.nuit .doux { color: var(--nuit-doux); }
.barre { flex: 1; height: 6px; border-radius: 3px; background: var(--bord); overflow: hidden; min-width: 60px; }
.barre > i { display: block; height: 100%; border-radius: 3px; background: var(--vert); }
.barre.retard > i { background: var(--orange); }
.obj { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.obj .nom { flex: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj .val { width: 44px; text-align: right; font-size: 12px; color: var(--doux); }
.obj .val.retard { color: #9A4F0A; }
:root[data-theme="sombre"] .obj .val.retard { color: var(--orange-clair); }

/* Tâches */
.tache { background: var(--carte); border-radius: 16px; padding: 12px 12px 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--ombre); border: 1px solid transparent; }
.tache.prochaine { border-color: var(--vert); flex-wrap: wrap; }
.tache.faite .titre { text-decoration: line-through; color: var(--doux); }
.coche { width: 44px; height: 44px; margin: -7px -7px -7px -9px; border: 0; background: transparent; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; }
.coche .rond { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bord-2); display: inline-flex; align-items: center; justify-content: center; }
.tache.faite .coche .rond { background: var(--vert); border-color: var(--vert); }
.tache .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; padding: 0; }
.tache .titre { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.tache .info { font-size: 12.5px; color: var(--doux); }
.btn-go { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--vert); color: #fff; font-weight: 600; white-space: nowrap; }
.tache.prochaine .btn-go { width: 100%; }
.btn-go.rond { width: 44px; padding: 0; background: var(--nia); color: var(--vert); }

/* Nia */
.nia { background: var(--nia); border-radius: 16px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.nia-n { width: 34px; height: 34px; border-radius: 10px; background: var(--vert); color: #fff; font: 700 15px var(--titres); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nia p { margin: 0; font-size: 14px; line-height: 1.5; }
.nia .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.nia .contenu { flex: 1; min-width: 0; }

/* Boutons */
.btn { height: 50px; border-radius: 14px; border: 0; background: var(--vert); color: #fff; font-weight: 700; font-size: 16px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.second { background: var(--carte); color: var(--encre); border: 1px solid var(--bord-2); font-weight: 600; font-size: 15px; }
.btn.petit { height: 44px; border-radius: 10px; font-size: 14px; padding: 0 14px; font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn.plein { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.lien { background: none; border: 0; color: var(--vert); font-weight: 600; padding: 6px 0; min-height: 44px; text-align: left; }
:root[data-theme="sombre"] .lien { color: var(--vert-clair); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .lien { color: var(--vert-clair); } }

/* Saisie rapide */
.saisie { display: flex; gap: 8px; }
.saisie input { flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 1px solid var(--bord-2); background: var(--carte); padding: 0 14px; font-size: 16px; }
.saisie button { width: 50px; height: 50px; border-radius: 14px; border: 0; background: var(--vert); color: #fff; font-size: 26px; line-height: 1; flex-shrink: 0; }
.pour { font-size: 13px; font-weight: 600; color: var(--doux); align-self: center; }
.apercu { font-size: 13px; color: var(--doux); padding: 0 4px; min-height: 18px; }

/* Formulaires */
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > span { font-size: 13px; font-weight: 600; color: var(--doux); }
.champ input, .champ select { height: 48px; border-radius: 12px; border: 1px solid var(--bord-2); background: var(--carte); padding: 0 12px; font-size: 16px; width: 100%; }
.deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.champ input, .champ select { min-width: 0; }
.bascule { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.bascule input { width: 22px; height: 22px; accent-color: var(--vert); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--bord-2); background: var(--carte); font-size: 14px; font-weight: 500; }
.puce[aria-pressed="true"] { background: var(--vert); border-color: var(--vert); color: #fff; }
.puce.pas[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--fond); }
.puce.rep[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }
.erreur { color: var(--danger); font-size: 14px; margin: 0; }

/* Navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--carte); border-top: 1px solid var(--bord); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
.nav ul { list-style: none; margin: 0 auto; padding: 0; max-width: 520px; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--doux); text-decoration: none; padding: 4px 0; border-radius: 10px; }
.nav a[aria-current="page"] { color: var(--vert); }
:root[data-theme="sombre"] .nav a[aria-current="page"] { color: var(--vert-clair); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .nav a[aria-current="page"] { color: var(--vert-clair); } }

/* Semaine */
.jour { display: flex; flex-direction: column; gap: 8px; }
.jour .tete { display: flex; align-items: center; justify-content: space-between; }
.jour.aujourdhui .tete h3 { color: var(--vert); }
.vide { font-size: 14px; color: var(--doux); padding: 4px 2px; }
.barres { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; height: 110px; }
.barres > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.barres i { display: block; width: 100%; border-radius: 6px; background: var(--vert-clair); min-height: 3px; }
.barres i.pic { background: var(--orange-clair); }
.barres i.zero { background: var(--nuit-2); }
.barres span { font-size: 11px; color: var(--nuit-doux); }
.grand-chiffre { font-family: var(--titres); font-size: 44px; font-weight: 700; line-height: 1; }
.grand-chiffre small { font-size: 22px; color: var(--nuit-doux); }
.remarques { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.remarques li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.remarques li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--vert); margin-top: 6px; flex-shrink: 0; }
.remarques li.orange::before { background: var(--orange); }

/* Concentration (plein écran sombre) */
.focus { position: fixed; inset: 0; background: var(--nuit); color: var(--nuit-texte); z-index: 20; display: flex; flex-direction: column; align-items: center; padding: calc(24px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); gap: 18px; overflow-y: auto; }
.focus .haut { align-self: stretch; display: flex; align-items: center; justify-content: space-between; max-width: 480px; width: 100%; margin: 0 auto; }
.focus .icone-btn { background: transparent; border-color: var(--nuit-bord); color: var(--nuit-texte); }
.focus .doux { color: var(--nuit-doux); }
.focus h1 { font-size: 24px; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.cadran { width: min(270px, 70vw); aspect-ratio: 1; position: relative; display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.cadran svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.cadran .temps { font-family: var(--titres); font-size: 60px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.sorties { display: inline-flex; align-items: center; gap: 8px; background: var(--nuit-2); border-radius: 999px; padding: 8px 14px; font-size: 13.5px; }
.sorties.alerte { background: #3A2A12; color: #FFC58A; }
.focus p.msg { margin: 0; text-align: center; color: var(--nuit-doux); font-size: 15px; max-width: 320px; }
.focus .bas { margin-top: auto; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px; }
.focus .bas .deux button { height: 48px; border-radius: 14px; border: 1px solid var(--nuit-bord); background: transparent; color: var(--nuit-texte); font-weight: 600; }

/* Feuille (édition) */
.voile { position: fixed; inset: 0; background: rgba(8,20,17,.5); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.feuille { background: var(--fond); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.feuille .poignee { width: 40px; height: 4px; border-radius: 2px; background: var(--bord-2); align-self: center; }

/* Messages */
.toast { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 488px; bottom: calc(86px + env(safe-area-inset-bottom)); background: var(--encre); color: var(--fond); padding: 12px 16px; border-radius: 14px; font-size: 14px; z-index: 40; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast span { flex: 1; }
.focus ~ .toast, body:has(.focus) .toast { bottom: calc(24px + env(safe-area-inset-bottom)); top: auto; }
.toast button { white-space: nowrap; background: none; border: 0; color: var(--vert-clair); font-weight: 700; padding: 0 6px; min-height: 44px; }
.bandeau { background: var(--orange-fond); color: var(--orange-texte); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }
.bandeau button, .bandeau a.action { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; white-space: nowrap; min-height: 44px; min-width: 44px; padding: 0 4px; font-size: 14px; }
.bandeau { padding: 4px 8px 4px 14px; min-height: 52px; }
.bandeau .fermer { text-decoration: none; font-size: 20px; line-height: 1; }

/* Accueil */
.accueil { flex: 1; padding: calc(40px + env(safe-area-inset-top)) 22px 30px; display: flex; flex-direction: column; gap: 18px; }
.logo { width: 76px; height: 76px; border-radius: 22px; background: var(--vert); display: flex; align-items: center; justify-content: center; }
.accueil .slogan { font-size: 17px; color: var(--doux); margin: 0; }
.points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.points li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.points b { font-family: var(--titres); color: var(--vert); font-size: 18px; width: 22px; flex-shrink: 0; }

@media (prefers-reduced-motion: no-preference) {
  .tache, .carte, .nia { transition: transform .15s ease; }
  .coche:active, .btn:active, .btn-go:active { transform: scale(.96); }
}
@media (min-width: 560px) { .ecran { padding-left: 24px; padding-right: 24px; } }

/* Petits écrans en hauteur : la concentration tient sans défiler */
@media (max-height: 720px) {
  .focus { gap: 10px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .focus h1 { font-size: 20px; }
  .cadran { width: min(200px, 56vw); margin-top: 0; }
  .cadran .temps { font-size: 46px; }
  .focus .bas { gap: 8px; }
  .focus .bas .btn { height: 46px; }
  .focus .bas .deux button { height: 44px; }
}
/* Pages de texte (confidentialité) */
.texte { display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.55; }
.texte p, .texte ul { margin: 0; }
.texte ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 330px) { .deux { grid-template-columns: minmax(0, 1fr); } .ecran { padding-left: 12px; padding-right: 12px; } }

/* Pages légales et admin */
.legal { max-width: 720px; margin: 0 auto; padding-bottom: 40px; }
.centre { text-align: center; }
.legal a, .admin a { color: var(--vert); }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.chiffres div { background: var(--carte); border-radius: 14px; padding: 12px; box-shadow: var(--ombre); }
.chiffres strong { display: block; font-size: 28px; }
.barre-admin { height: 8px; border-radius: 4px; background: var(--vert); margin: 4px 0 8px; }
.ecran p a, .accueil p a { color: var(--vert); }
:root[data-theme="sombre"] .ecran p a, :root[data-theme="sombre"] .accueil p a, :root[data-theme="sombre"] .legal a { color: var(--vert-clair); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .ecran p a, :root:not([data-theme="clair"]) .accueil p a, :root:not([data-theme="clair"]) .legal a { color: var(--vert-clair); } }
a.lien { text-decoration: none; display: inline-flex; align-items: center; }
