/*-----------------------------------------------------------------------------
 * Project : Ergane - Athena AI Hub
 * File    : public/css/shell.css
 * Stylesheet : header with the four areas, sidebar, complement pane, day banner, loop block, footer
 * Author  : Johann Sievering
 * AI Support : Claude AI
 * Date    : 2026-09-30 Start of the implementation
 * Rev     : patterns of prompt-atelier v2.4.6 app-shell.css (.lang-pill) and of
 *           materielAV v0.19.0 app.css (solid header bar, user badge, page head, footer)
 * Rev     : 2026-10-01 Owner's batch: fixed footer, development-mode pill
 * Rev     : 2026-10-01 The three-zone frame of the owner's mockup v00 (D-31): sidebar, working zone, complement pane
 * Rev     : 2026-10-02 The sidebar's sticky inner column, the team head set apart, bolder handles, the dropdown look (owner's requests)
 * Rev     : 2026-10-03 The team head in white, the loop as a 3 × 3 grid (owner's requests)
 * Rev     : 2026-10-05 The text size chooser (increment 27, D-52)
 * Rev     : 2026-10-05 Increment 28: the team page and its thread, the journal first in the menu, the dashboard reminders, the footer, « tiers » (D-53)
 * Rev     : 2026-10-05 Increment 29: microphones and the ✨ assistant beside every text field, the token tiles, the tabs and the menu, the privacy contact (D-54); 2026-10-05 Phone and iPhone pass (owner's request): tabs wrap, inputs 16 px on phones, hidden table as a block, inline video, no microphone on narrow inputs
 * Rev     : 2026-10-08 .page--wide: a dashboard that takes the whole workspace (owner's request)
 * Rev     : The tinted tab « Fresque des projets » (D-75)
 * Rev     : 2026-10-09 The menu under the tab « Fresque des projets » (v0.64.0)
 * Version : 0.64.0
 *-----------------------------------------------------------------------------
 * The frame of every page (chapter 5 §5.3, chapter 14 §14.6): a solid header
 * in the brand colour with the four areas, the user badge and the FR | EN
 * pills; below it three vertical zones — the sidebar (team, modules, the
 * loop), the working zone with the day banner, the complement pane — the
 * first and the last collapsible with a short transition; on a phone the
 * sidebar is a drawer and the pane stacks under the page; the fixed footer.
 *---------------------------------------------------------------------------*/

:root {
    --nav-width: 15.5rem;
    --aside-width: 20rem;
    --nav-bg: var(--primary-dark);
    --nav-text: #DCE6F0;
    --shell-transition: 220ms ease;
}

/* ── Header bar ── */
.app-header {
    position: sticky; top: 0; z-index: var(--z-header);
    display: flex; align-items: center; gap: var(--space-3);
    min-height: var(--header-height); padding: 0 var(--space-5) 0 var(--space-4);
    background: var(--header-bg); color: var(--header-text);
    box-shadow: var(--shadow-sm);
}
.app-header__brand {
    display: flex; align-items: center; gap: var(--space-2);
    color: var(--header-text); text-decoration: none; font-weight: 700; font-size: 1.15rem; white-space: nowrap;
}
.app-header__brand img { width: 2.25rem; height: 2.25rem; }
.app-header__spacer { flex: 1; }

/* The four areas (D-31): links when allowed, muted labels otherwise. */
.app-tabs { display: flex; align-items: center; gap: var(--space-1); margin-left: var(--space-3); }
.app-tab {
    display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 var(--space-3);
    border-radius: var(--radius); color: var(--header-text); text-decoration: none;
    font-weight: 500; font-size: var(--font-size-sm); opacity: 0.92; white-space: nowrap;
}
a.app-tab:hover { background: rgba(255, 255, 255, 0.15); opacity: 1; }
.app-tab[aria-current="page"] { background: rgba(255, 255, 255, 0.22); opacity: 1; font-weight: 700; }
.app-tab--off { opacity: 0.45; cursor: not-allowed; }
/* « Fresque des projets » (D-75): the collective outcome of the week, set apart by the accent and a clear label. */
.app-tab--fresque { background: var(--accent); color: #fff; font-weight: 700; opacity: 1; }
a.app-tab--fresque:hover, .app-tab--fresque[aria-current="page"] { background: var(--accent-dark); }
/* The tab is a button that opens a two-entry menu: inside Ergane, or the page alone to share. */
.app-tab--menu { position: relative; display: inline-flex; }
.app-tab--menu .app-tab { border: 0; cursor: pointer; font-family: inherit; }
.app-tab--menu .app-tab::after { content: ' ▾'; opacity: 0.85; }
.app-tab--menu .app-tab:hover { background: var(--accent-dark); }
.app-tab--menu .app-header__menu { left: 0; right: auto; min-width: 15rem; }

/* User badge: name, role chip, then the account menu. */
.app-header__user { position: relative; display: flex; align-items: center; gap: var(--space-2); }
.app-header__user-btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 2.5rem; padding: var(--space-1) var(--space-2);
    font: inherit; font-size: var(--font-size-sm); color: var(--header-text);
    background: transparent; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
}
.app-header__user-btn:hover { background: rgba(255, 255, 255, 0.15); }
.app-header__user-btn .chip { font-size: var(--font-size-xs); color: var(--header-text); background: rgba(255, 255, 255, 0.2); }
.app-header__user-btn::after { content: '▾'; opacity: 0.8; }
.app-header__menu {
    position: absolute; right: 0; top: calc(100% + var(--space-1));
    min-width: 12rem; padding: var(--space-1); margin: 0; list-style: none;
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); z-index: var(--z-menu);
}
.app-header__menu[hidden] { display: none; }
.app-header__menu a, .app-header__menu button {
    display: block; width: 100%; text-align: left; padding: var(--space-2) var(--space-3);
    font: inherit; color: var(--text); background: none; border: 0; border-radius: var(--radius-sm);
    text-decoration: none; cursor: pointer;
}
.app-header__menu a:hover, .app-header__menu button:hover { background: var(--gray-50); }
.app-header .btn--sm { color: var(--header-text); border-color: rgba(255, 255, 255, 0.5); background: transparent; }
.app-header .btn--sm:hover { background: rgba(255, 255, 255, 0.15); }

/* The text size chooser (D-52): one « A » at the chosen size, a column of five below it, the current one framed. */
.text-size { position: relative; display: inline-flex; align-items: center; }
.text-size__toggle {
    display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; min-height: 2rem; padding: 0 var(--space-1);
    font-family: inherit; font-weight: 700; line-height: 1; color: var(--header-text);
    background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius-sm); cursor: pointer;
}
.text-size__toggle:hover { background: rgba(255, 255, 255, 0.3); }
.text-size__toggle[data-level="0"] { font-size: 0.7rem; }
.text-size__toggle[data-level="1"] { font-size: 0.85rem; }
.text-size__toggle[data-level="2"] { font-size: 1rem; }
.text-size__toggle[data-level="3"] { font-size: 1.15rem; }
.text-size__toggle[data-level="4"] { font-size: 1.3rem; }
.text-size__menu[hidden] { display: none; }
.text-size__menu {
    position: absolute; right: 0; top: calc(100% + var(--space-1)); z-index: var(--z-menu);
    display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; padding: var(--space-1);
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.text-size__option {
    min-width: 3.5rem; padding: 0.2rem var(--space-2); text-align: center; font-family: inherit; font-weight: 700; line-height: 1.1;
    color: var(--text); background: transparent; border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
}
.text-size__option:hover { background: var(--gray-50); }
.text-size__option:nth-child(1) { font-size: 0.7rem; }
.text-size__option:nth-child(2) { font-size: 0.9rem; }
.text-size__option:nth-child(3) { font-size: 1.15rem; }
.text-size__option:nth-child(4) { font-size: 1.4rem; }
.text-size__option:nth-child(5) { font-size: 1.7rem; }
.text-size__option.is-active { border-color: var(--primary); }

/* Language pills (top-right, on every page including login). */
.app-header__langs { display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.lang-pill {
    min-width: 2.5rem; min-height: 2rem; padding: 0 var(--space-2);
    font: inherit; font-weight: 600; font-size: var(--font-size-xs);
    color: var(--header-text); background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius-pill); cursor: pointer;
}
.lang-pill:hover { background: rgba(255, 255, 255, 0.15); }
.lang-pill[aria-pressed="true"] { color: var(--primary-dark); background: var(--header-text); border-color: var(--header-text); }
.app-header :focus-visible { outline-color: #FFFFFF; }
.shell__drawer-btn { display: none; }

/* ── The three zones ── */
.shell {
    display: grid; grid-template-columns: var(--nav-width) auto minmax(0, 1fr) auto var(--aside-width);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    transition: grid-template-columns var(--shell-transition);
}
.shell--nav-collapsed { grid-template-columns: 0 auto minmax(0, 1fr) auto var(--aside-width); }
.shell--aside-collapsed, .shell--aside-empty { grid-template-columns: var(--nav-width) auto minmax(0, 1fr) auto 0; }
.shell--nav-collapsed.shell--aside-collapsed, .shell--nav-collapsed.shell--aside-empty { grid-template-columns: 0 auto minmax(0, 1fr) auto 0; }
.shell--anonymous { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; }
/* Each zone keeps its column even when a handle is hidden (a hidden element leaves the grid flow). */
@media (min-width: 64.01rem) {
    .shell__nav { grid-column: 1; }
    .shell__toggle--nav { grid-column: 2; }
    .shell__main { grid-column: 3; }
    .shell__toggle--aside { grid-column: 4; }
    .shell__aside { grid-column: 5; }
}

/* The sidebar: team head, modules, the loop. */
.shell__nav {
    /* clip, not hidden: a hidden overflow would make the column a scroll container and break the sticky inner column */
    overflow: hidden; overflow: clip;
    background: var(--nav-bg); color: var(--nav-text);
    transition: opacity var(--shell-transition);
}
/* The inner column sticks under the header (owner's request of 2 October): the team and the modules stay in view
   while the page scrolls, the loop sits at the foot; on a short window the column scrolls and the loop follows. */
.shell__nav-inner {
    position: sticky; top: var(--header-height);
    display: flex; flex-direction: column; gap: var(--space-4);
    height: calc(100vh - var(--header-height) - var(--footer-height)); padding: var(--space-4) var(--space-3);
    overflow-y: auto; overscroll-behavior: contain;
}
.shell--nav-collapsed .shell__nav, .shell--anonymous .shell__nav { opacity: 0; pointer-events: none; }
.shell__label { margin: 0 0 var(--space-1); font-size: var(--font-size-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(232, 240, 248, 0.92); }
/* The team head sits apart from the modules: a lighter block and a rule under it. */
.shell__head { margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-3)) 0; padding: var(--space-4) var(--space-3); background: rgba(255, 255, 255, 0.07); border-bottom: 1px solid rgba(255, 255, 255, 0.22); }
.shell__head:empty { display: none; }
.shell__team { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-2) var(--space-2); color: #fff; background: rgba(255, 255, 255, 0.08); border-radius: var(--radius); }
.shell__team .swatch { width: 1em; height: 1em; }
/* The project name in plain white: the lighter tint was hard to read (owner's remark of 3 October). */
.shell__team-name { flex-basis: 100%; font-size: var(--font-size-sm); color: #fff; font-weight: 500; }
/* The team selector in the look of every dropdown list: white, a blue rule, bold text, a chevron. */
.shell__nav .combobox::after { content: '▾'; position: absolute; right: var(--space-3); top: 1.2rem; pointer-events: none; color: var(--primary); font-weight: 700; }
.shell__nav .combobox input { padding-right: 2rem; font-weight: 600; color: var(--text); background: var(--bg-card); border: 1.5px solid var(--primary); border-radius: var(--radius-sm); }
.shell__modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.shell__modules a {
    display: flex; align-items: center; min-height: 2.5rem; padding: 0 var(--space-3);
    border-radius: var(--radius); color: var(--nav-text); text-decoration: none; font-weight: 500;
}
.shell__modules a:hover { background: rgba(255, 255, 255, 0.1); }
.shell__modules a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 700; }
/* The journal, the central activity of the week (owner's request of 5 October): it stands out among the modules. */
.shell__modules a.is-key { font-weight: 700; color: #fff; background: rgba(255, 255, 255, 0.12); }
.shell__modules a.is-key[aria-current="page"] { background: var(--accent); }
.loop-block { margin-top: auto; padding: var(--space-3); background: rgba(255, 255, 255, 0.06); border-radius: var(--radius); }
/* The loop as a 3 × 3 grid of numbered tiles: each row is one phase of the compass (penser · créer et tester · juger et apprendre), the current step is lit (owner's request of 3 October). */
.loop-block__steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin: 0; padding: 0; list-style: none; counter-reset: loop; }
.loop-block__steps li { counter-increment: loop; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.3rem 0.1rem; border-radius: var(--radius-sm); font-size: 0.7rem; line-height: 1.1; text-align: center; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); }
.loop-block__steps li::before { content: counter(loop); display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; font-size: 0.65rem; font-weight: 700; background: rgba(255, 255, 255, 0.16); }
.loop-block__steps li[aria-current="step"] { color: var(--primary-dark); background: #F3C34C; border-color: #F3C34C; font-weight: 700; }
.loop-block__steps li[aria-current="step"]::before { color: #fff; background: var(--primary-dark); }
.loop-block__motto { margin: var(--space-3) 0 0; font-size: var(--font-size-xs); font-weight: 600; }

/* The collapse handles between the zones. */
.shell__toggle {
    align-self: start; position: sticky; top: calc(var(--header-height) + var(--space-3));
    width: 1.5rem; height: 2.5rem; margin: var(--space-3) 0 0; padding: 0;
    font: inherit; font-size: 1.1rem; font-weight: 700; color: var(--primary); background: var(--primary-soft);
    border: 1px solid var(--primary); cursor: pointer;
}
.shell__toggle--nav { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.shell__toggle--aside { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.shell__toggle:hover { color: #fff; background: var(--primary); }
.shell--nav-collapsed .shell__toggle--nav::before, .shell--aside-collapsed .shell__toggle--aside::before { content: ''; }
.shell--nav-collapsed .shell__toggle--nav { transform: scaleX(-1); }
.shell--aside-collapsed .shell__toggle--aside { transform: scaleX(-1); }
.shell--aside-empty .shell__toggle--aside, .shell--anonymous .shell__toggle { display: none; }

/* The working zone and the complement pane. */
.shell__main { min-width: 0; }
.shell__aside {
    padding: var(--space-5) var(--space-4) var(--space-5) var(--space-2); overflow: hidden;
    transition: opacity var(--shell-transition);
}
.shell__aside .panel { margin-bottom: var(--space-4); padding: var(--space-4); }
.shell__aside h2 { font-size: var(--font-size-md); }
.shell--aside-collapsed .shell__aside, .shell--aside-empty .shell__aside { opacity: 0; pointer-events: none; padding: 0; }
.shell--nav-collapsed .shell__nav-inner, .shell--anonymous .shell__nav-inner { padding: 0; }
/* clip, not hidden: a hidden overflow would make the shell a scroll container and break every sticky element inside it */
.shell { overflow-x: hidden; overflow-x: clip; }

/* The day banner: the day's verb and question (chapter 5 §5.4). */
.day-banner {
    margin: var(--space-4) var(--space-5) 0; padding: var(--space-2) var(--space-4);
    border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius);
    font-size: var(--font-size-sm);
}
.day-banner strong { color: var(--accent-dark); }
.day-banner--quiet { border-left-color: var(--border); background: var(--gray-50); color: var(--text-light); }

/* ── Page frame ── */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-8); }
.page--narrow { max-width: 34rem; }
/* A dashboard with cards takes the whole workspace (the synthesis overview, owner's request of 8 October). */
.page--wide { max-width: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--space-1) 0 0; color: var(--text-light); }
.page-head__text { flex: 1 1 20rem; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.back-link { display: inline-block; margin-bottom: var(--space-3); font-size: var(--font-size-sm); }

/* The footer stays fixed at the bottom of the window (owner's rule of 1 October); the body keeps room for it. */
body { padding-bottom: var(--footer-height); }
.page-foot {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-header) - 1);
    min-height: var(--footer-height); padding: var(--space-2) var(--space-5);
    font-size: var(--font-size-sm); color: var(--text-light); text-align: center;
    background: var(--bg-card); border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2);
}
.page-foot strong { color: var(--text); font-weight: 600; }

/* ── History lists (D-31 C) and dictation (G.2) ── */
.history__title { margin: 0 0 var(--space-2); font-size: var(--font-size-md); }
.history__list { list-style: none; margin: 0; padding: 0; }
.history__list > li { border-top: 1px solid var(--border); }
.history__list > li:first-child { border-top: 0; }
.history__item {
    display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-2); width: 100%; padding: var(--space-2) 0;
    font: inherit; font-size: var(--font-size-sm); text-align: left; color: var(--text); background: none; border: 0; cursor: pointer;
}
.history__item:hover .history__item-title { text-decoration: underline; }
.history__item-title { font-weight: 600; }
.history__meta { grid-column: 1 / -1; font-size: var(--font-size-xs); color: var(--text-light); }
.history__detail { padding: var(--space-3); margin-bottom: var(--space-2); background: var(--gray-50); border-radius: var(--radius); }
.history__detail[hidden] { display: none; }
.history__pill { margin: 0 0 var(--space-2); }
.history__fields { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-3); font-size: var(--font-size-sm); }
.history__fields dt { font-weight: 600; color: var(--text-light); }
.history__fields dd { margin: 0; white-space: pre-wrap; }
.history__body { white-space: pre-wrap; margin: 0 0 var(--space-3); }
.dictation-btn { margin: var(--space-1) 0 0; }
.dictation-btn.is-listening { color: #fff; background: var(--error); border-color: var(--error); }

/* ── Login layout ── */
.login-card {
    max-width: 26rem; margin: var(--space-8) auto; padding: var(--space-6);
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.login-card__logo { display: block; width: 4.5rem; height: 4.5rem; margin: 0 auto var(--space-3); }
.login-card h1 { text-align: center; }
.login-card .motto { text-align: center; color: var(--text-light); font-style: italic; }

/* ── Tablets and phones (chapter 14 §14.6): the sidebar becomes a drawer, the pane stacks under the page ── */
@media (max-width: 64rem) {
    .shell, .shell--nav-collapsed, .shell--aside-collapsed, .shell--aside-empty, .shell--nav-collapsed.shell--aside-collapsed, .shell--nav-collapsed.shell--aside-empty {
        grid-template-columns: minmax(0, 1fr); transition: none;
    }
    .shell__toggle { display: none; }
    .shell__drawer-btn {
        display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
        font: inherit; font-size: 1.3rem; color: var(--header-text); background: transparent; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius); cursor: pointer;
    }
    .shell__nav {
        position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: var(--z-menu); width: min(85vw, var(--nav-width));
        transform: translateX(-100%); transition: transform var(--shell-transition); opacity: 1; pointer-events: auto; overflow-y: auto;
        box-shadow: var(--shadow);
    }
    .shell__nav-inner { position: static; height: auto; min-height: 100%; overflow: visible; }
    .shell--drawer-open .shell__nav { transform: translateX(0); }
    .shell__backdrop { position: fixed; inset: var(--header-height) 0 0 0; z-index: calc(var(--z-menu) - 1); background: rgba(0, 0, 0, 0.35); }
    .shell__backdrop[hidden] { display: none; }
    .shell__aside { opacity: 1; pointer-events: auto; padding: 0 var(--space-3) var(--space-5); }
    .shell--aside-empty .shell__aside { display: none; }
    /* The tabs wrap on a phone: a fifth tab must stay in sight, never off the edge (owner's phone pass of 5 October). */
    .app-tabs { order: 5; flex-basis: 100%; flex-wrap: wrap; row-gap: var(--space-1); padding-bottom: var(--space-1); margin-left: 0; }
    .app-header { flex-wrap: wrap; gap: var(--space-2); padding: var(--space-1) var(--space-3); min-height: 0; }
    .app-header__user-btn > span:first-child { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .day-banner { margin: var(--space-3) var(--space-3) 0; }
    .page { padding: var(--space-4) var(--space-3) var(--space-6); }
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1 1 auto; }
}
