/* Design tokens, reset, navigation bar and shared classes
   (.tile, .card, .ok-badge, .ok-hint, .avatar…). Loaded on every screen. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4CAF7D;
    --primary-dark: #3a9e6d;
    --primary-light: #16293D;
    --accent: #4CAF7D;
    --dark: #ffffff;
    --muted: #B8D0E8;
    --light: #16293D;
    --border: #2A4A6B;
    --white: #0B1B2B;
    --nav-bg: rgba(11,27,43,0.97);
    --shadow: 0 4px 24px rgba(0,0,0,0.25);

    /* Composantes du vert primaire, pour construire des rgba() sans
       réécrire la couleur : rgba(var(--primary-rgb), 0.15). */
    --primary-rgb: 76,175,125;

    /* Surfaces */
    --surface: rgba(255,255,255,0.05);
    --surface-hover: rgba(var(--primary-rgb), 0.1);
    --surface-active: rgba(var(--primary-rgb), 0.15);

    /* Alertes */
    --danger: #E57373;
    --danger-dark: #c62828;

    --radius-lg: 24px;
    --radius-md: 20px;
    --radius-pill: 50px;

    --nav-height: 64px;
}

html { background: var(--white); }

body {
    font-family: 'Inter', sans-serif;
    color: var(--dark);
    background: var(--white);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

.app-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow);
}

/*
  Brand logo, defined here once for every screen: "my" in primary green, "Nestor" in
  light. Only the size and the letter-spacing change from one context to another
  (navigation bar, login page) — never the colours, otherwise the senior sees two
  different logos depending on the screen.
  Expected markup: <… class="brand">my<span>Nestor</span></…>
*/
.brand {
    font-weight: 800;
    color: var(--primary);
}

.brand span { color: var(--dark); }

.app-nav .logo {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.app-nav .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--muted);
}

.app-nav .nav-right .user-email {
    font-weight: 500;
    color: var(--dark);
}

.app-nav .nav-right .device-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}

.app-nav .nav-right .logout-btn {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    transition: background .2s, color .2s;
}
.app-nav .nav-right .logout-btn:hover {
    background: var(--light);
    color: var(--dark);
}

.app-content {
    width: 100%;
    padding: 0;
    background: var(--light);
    min-height: calc(100vh - var(--nav-height));
}

/* ------------------------------------------------------------------
   Éléments partagés par plusieurs écrans. Définis ici une seule fois
   plutôt que recopiés dans chaque template.
   ------------------------------------------------------------------ */

@keyframes spin-pulse {
    0%      { transform: rotate(0deg);   opacity: 0; }
    37.5%   { transform: rotate(0deg);   opacity: 0; }
    38%     { transform: rotate(0deg);   opacity: 1; }
    62%     { transform: rotate(360deg); opacity: 1; }
    62.5%   { transform: rotate(360deg); opacity: 0; }
    100%    { transform: rotate(360deg); opacity: 0; }
}

/* Halo du rond OK. */
@keyframes pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(var(--primary-rgb),0.6); }
    50%  { box-shadow: 0 0 0 14px rgba(var(--primary-rgb),0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb),0.6); }
}

/* Halo d'une tuile sélectionnée : même pulsation, plus une ombre
   portée qui la détache du fond. */
@keyframes tile-glow {
    0%   { box-shadow: 0 0 0 0 rgba(var(--primary-rgb),0.6), 0 12px 40px rgba(var(--primary-rgb),0.2); }
    50%  { box-shadow: 0 0 0 12px rgba(var(--primary-rgb),0), 0 12px 40px rgba(var(--primary-rgb),0.3); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb),0.6), 0 12px 40px rgba(var(--primary-rgb),0.2); }
}

/*
  Tuile sélectionnable à la télécommande : les gros boutons de
  l'accueil et les choix Oui/Non partagent exactement ce comportement.
  La pastille OK n'apparaît que sur la tuile sélectionnée, pour qu'un
  seul « OK » soit visible à l'écran à la fois.
*/
.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--dark);
    transition: background .2s, transform .15s, box-shadow .2s;
    cursor: pointer;
}

.tile:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.tile:focus { outline: none; }

.tile:focus,
.tile:focus-visible,
.tile.default-active {
    background: var(--surface-active);
    border: 3px solid var(--primary);
    transform: translateY(-4px);
    animation: tile-glow 1.8s ease-in-out infinite;
    outline: none;
}

.tile .ok-badge { display: none; }

.tile:focus .ok-badge,
.tile:focus-visible .ok-badge,
.tile.default-active .ok-badge { display: flex; }

/* Pastille « OK » : présente sur presque tous les écrans.
   --ok-size pilote le diamètre (48px sur les listes, 80px sur les
   écrans à action unique). */
.ok-badge {
    --ok-size: 64px;
    position: relative;
    width: var(--ok-size);
    height: var(--ok-size);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ok-badge.ok-sm { --ok-size: 48px; }
.ok-badge.ok-lg { --ok-size: 80px; }

.ok-badge .ok-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin-pulse 8s linear infinite;
    pointer-events: none;
}

.ok-badge .ok-circle {
    width: var(--ok-size);
    height: var(--ok-size);
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
    border: none;
    cursor: pointer;
}

.ok-badge.ok-sm .ok-circle { font-size: 0.85rem; }
.ok-badge.ok-lg .ok-circle { font-size: 1.2rem; }

/* Rappel de navigation, en bas des écrans à plusieurs choix. */
.ok-hint {
    text-align: center;
    padding: 16px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.ok-hint strong { color: var(--primary); }

/* Bloc de contenu standard. */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* Écran sans contenu : pictogramme + phrase. */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--primary);
    opacity: 0.4;
}

.empty-state p {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
}

/* Pastille d'initiale, devant un nom de personne. */
.avatar {
    --avatar-size: 48px;
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background: rgba(var(--primary-rgb),0.2);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.avatar.avatar-sm {
    --avatar-size: 34px;
    font-size: 0.95rem;
}

/* Bouton de retour en pilule. */
