/* The app's spaces (17 October 2026): Aujourd'hui, Mon plan, Coach, Évolution. Same design system as style.css and
   espace.css: white cards, hairlines, Dodo's blue, amber only for what waits for the parent. Large touch targets
   (48px), one hand on a phone, dark at night when the phone is dark (body.night, style.css). */

/* Bottom bar on phones, tabs under the header on computers. */
.app-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 94%, transparent); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.app-nav a { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 6px 2px 4px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 600; line-height: 1.2; text-align: center; }
.app-nav svg { width: 24px; height: 24px; }
.app-nav a[aria-current="page"] { color: var(--accent); }
.app-nav a[aria-current="page"] svg { stroke-width: 2.1; }
.app-nav a:active { background: var(--soft); }
body.has-app-nav { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body.has-app-nav.chat-mode { padding-bottom: 0; }
@media (min-width: 900px) {
  .app-nav { position: sticky; top: 0; bottom: auto; max-width: 720px; margin: 0 auto 8px; grid-template-columns: repeat(4, auto);
    justify-content: start; gap: 4px; border: 0; border-bottom: 1px solid var(--line); padding: 4px 16px; order: -1; }
  .app-nav a { grid-auto-flow: column; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; font-size: .92rem; }
  .app-nav svg { width: 20px; height: 20px; }
  body.has-app-nav { padding-bottom: 0; display: flex; flex-direction: column; }
  body.has-app-nav > header.site { order: -2; }
}
@media print { .app-nav { display: none; } }

/* Page frame of the app spaces. */
.space { display: grid; gap: 14px; padding: 4px 0 24px; }
.space-head h1 { margin: 8px 0 2px; }
.space-head p { margin: 0; color: var(--muted); }
.space h2 { margin: 0; font-size: 1.1rem; }
.space .home-card { gap: 10px; }
.space .note { color: var(--muted); font-size: .9rem; margin: 0; }
.space .btn { min-height: 48px; padding: 12px 20px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.offline { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }

/* The night panel (espace.css .home-night) as a live status: what is happening and what comes next. */
.home-night .night-lines { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 6px; color: rgba(238, 242, 250, .9); font-size: .95rem; }
.home-night .night-lines strong { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; color: #fff; }
.home-night .night-why { margin: 0 0 14px; font-size: .86rem; color: rgba(238, 242, 250, .76); max-width: 42ch; }
.home-night .general { display: inline-block; margin: 0 0 8px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .26); }
.home-night .btn-row .home-night-link { background: rgba(255, 255, 255, .14); }
.home-night button.home-night-link { font: inherit; cursor: pointer; }
.home-night .night-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.home-night .night-chips button { min-height: 40px; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer;
  color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); }

/* Quick entry: the likely next moment first, then the others. */
.quick-main { width: 100%; font-size: 1.05rem; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-grid button { min-height: 64px; display: grid; place-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; font-weight: 600; line-height: 1.2; }
.quick-grid button:active { transform: scale(.97); }
@media (max-width: 359px) { .quick-grid { grid-template-columns: 1fr 1fr; } }

/* Answer chips (morning summary, plan, preferences): one tap, a clear selected state. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.chips legend { width: 100%; padding: 0; margin: 0 0 6px; font-weight: 600; font-size: .95rem; }
.chips button { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg);
  color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.morning textarea { width: 100%; min-height: 64px; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }
.morning .saved { color: var(--muted); font-size: .88rem; margin: 0; }

/* Help: seven large entries. */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help-grid a, .help-grid button { display: flex; align-items: center; min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); text-decoration: none; font: inherit; font-weight: 600; font-size: .95rem; text-align: left; cursor: pointer; }
.help-grid a:hover, .help-grid button:hover { border-color: var(--line-strong); }
.help-card { border-color: var(--warn-line); background: var(--warn-bg); }

/* Sheets (dialogs) of the app spaces. */
dialog.sheet { border: 0; border-radius: 20px; padding: 20px; width: min(520px, calc(100vw - 24px)); background: var(--bg); color: var(--text); }
dialog.sheet::backdrop { background: rgba(13, 18, 27, .45); }
dialog.sheet h2 { margin: 0 0 8px; font-size: 1.15rem; }
dialog.sheet form, dialog.sheet .sheet-body { display: grid; gap: 12px; }
dialog.sheet label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
dialog.sheet input, dialog.sheet select { min-height: 44px; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }

/* Plan: the day's action and the answers of the evening. */
.plan-step { margin: 0; font-size: 1.05rem; }
.plan-observe { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; font-size: .93rem; }
.plan-history { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.plan-history li { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.plan-history time { color: var(--muted); font-size: .82rem; }
.plan-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.plan-counts div { display: flex; flex-direction: column-reverse; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--surface); }
.plan-counts dt { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.plan-counts dd { margin: 0; font-family: var(--font-mono); font-weight: 500; font-size: 1.3rem; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--soft); color: var(--accent); }
.status-pill.paused { background: var(--warn-bg); color: var(--text); border: 1px solid var(--warn-line); }

/* Évolution */
.period-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.period-tabs button { min-height: 40px; min-width: 64px; padding: 6px 14px; border-radius: 999px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.period-tabs button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.facts div { display: grid; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface); }
.facts dt { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.facts dd { margin: 0; font-family: var(--font-mono); font-weight: 500; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.facts dd small { display: block; font-family: var(--font-sans); font-size: .76rem; color: var(--muted); font-weight: 400; }
.facts .estimated dd { color: var(--muted); }
.coverage { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); gap: 3px; margin: 4px 0 0; padding: 0; list-style: none; }
.coverage li { height: 18px; border-radius: 4px; background: var(--line); }
.coverage li.documented { background: var(--accent); }
.coverage li.summary { background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); margin: 6px 0 0; padding: 0; list-style: none; }
.legend span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.review { display: grid; gap: 12px; }
.review h3 { margin: 0 0 4px; font-size: .98rem; }
.review ul { margin: 0; padding-left: 18px; }

@media (min-width: 680px) {
  .space { grid-template-columns: 1fr 1fr; gap: 16px; }
  .space > .space-head, .space > .home-night, .space > .wide { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .quick-grid button:active { transform: none; } }
.home-more button { display: grid; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: none;
  font: inherit; text-align: left; cursor: pointer; }
.home-more button span { color: var(--muted); font-size: .86rem; }
body.has-app-nav .toast { bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25; }
@media (min-width: 900px) { body.has-app-nav .toast { bottom: calc(12px + env(safe-area-inset-bottom)); } }

/* The day as a ring (day-dial.js): wake to bedtime over the top, windows as arcs, the countdown at the centre. */
.dial { position: relative; width: min(100%, 340px); margin: 4px auto 10px; aspect-ratio: 1; }
.dial-svg { width: 100%; height: 100%; overflow: visible; }
.dial-track { fill: none; stroke: rgba(255, 255, 255, .09); stroke-width: 20; stroke-linecap: round; }
.dial-arc { fill: none; stroke-width: 20; stroke-linecap: round; }
.dial-arc.estimate { stroke: rgba(147, 171, 232, .45); stroke-dasharray: 1 5; }
.dial-arc.chosen { stroke: rgba(147, 171, 232, .8); }
.dial-arc.done { stroke: #C9D6FF; }
.dial-label { font: 500 9.5px var(--font-mono); fill: rgba(238, 242, 250, .82); }
.dial-end { font: 500 11px var(--font-mono); fill: rgba(238, 242, 250, .9); }
.dial-now { fill: #fff; stroke: rgba(13, 18, 27, .5); stroke-width: 2; }
.dial-wake { fill: #F2CF92; }
.dial-moon { fill: #C9D6FF; }
.dial-centre { position: absolute; inset: 0 0 8% 0; display: grid; place-content: center; text-align: center; gap: 2px; padding: 0 26%; pointer-events: none; }
.dial-centre span { color: rgba(238, 242, 250, .82); font-size: .95rem; }
.dial-centre strong { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; font-size: clamp(1.35rem, 7vw, 2rem); white-space: nowrap; line-height: 1.1; color: #fff; }

/* Dial on the sales page: a night panel with the ring, centred. */
.dial-demo { max-width: 420px; margin: 16px auto; }
.dial-demo .night-why { text-align: center; margin: 0 auto; }

.dial-scale { font: 500 10px var(--font-mono); fill: rgba(238, 242, 250, .5); }

/* The ring inside the shared calendar (Journal and Rythme). */
.sc-dial-panel { margin: 12px 0; padding: 16px 16px 8px; }
.sc-dial-panel::after { display: none; }
.sc-dial-caption { margin: 0 0 4px; font-size: .9rem; font-weight: 600; color: rgba(238, 242, 250, .8); max-width: 30ch; }

/* Chat: the four spaces stay one tap away (17-28 October 2026): the tab bar sits under the composer. */
body.chat-mode .app-nav { display: grid; z-index: 19; }
body.chat-mode .chat-app { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); height: auto; }
body.chat-mode .chat-compose { padding-bottom: 8px; }
@media (min-width: 900px) {
  body.chat-mode .app-nav { position: fixed; top: 0; left: 0; right: 0; bottom: auto; max-width: none; margin: 0; justify-content: center; background: var(--bg); }
  body.chat-mode .chat-app { top: 53px; bottom: 0; padding-top: 0; }
}
.report-preview { margin: 0; padding: 10px 12px; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: .8rem/1.4 var(--font-mono); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
#report textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }
/* Sheets: nothing wider than the sheet, and they scroll on a small screen. */
dialog.sheet { max-height: 90dvh; overflow-y: auto; box-sizing: border-box; }
dialog.sheet form, dialog.sheet .sheet-body { grid-template-columns: minmax(0, 1fr); }
dialog.sheet select, dialog.sheet textarea, dialog.sheet input:not([type="checkbox"]) { width: 100%; max-width: 100%; box-sizing: border-box; }
dialog.sheet label.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
/* With the keyboard really up (visualViewport, js/app-nav.js), the tab bar steps aside so the composer keeps its room.
   Not on focus alone: the coach focuses the field by itself on opening, and the bar must stay. */
body.chat-mode.kb-open .app-nav { display: none; }
body.chat-mode.kb-open .chat-app { bottom: 0; }
