/* ============================================================
   MimiAppstore — CSS global
   ============================================================ */

:root {
    --topbar-h:          44px; /* P1-02 — DESIGN.md {component.global-nav} = 44px */
    --topbar-bg:         rgba(245,245,247,0.80);
    --topbar-border:     rgba(0,0,0,0.10);
    --topbar-shadow:     none;

    --color-bg:          #f5f5f7; /* P1-02 portal — DESIGN.md {colors.canvas-parchment} */
    --color-surface:     #ffffff;
    --color-border:      #e0e0e0; /* Batch C — DESIGN.md {colors.hairline} */
    --color-border-dark: #d1d1d6;
    --color-text:        #1d1d1f;
    --color-text-muted:  #6e6e73;

    --radius-card:       18px; /* Batch C — DESIGN.md {rounded.lg} store-utility-card */
    --radius-pill:       999px;

    /* ── Couleur primaire — DESIGN.md {colors.primary} ── */
    --color-primary:        #0066cc;
    --color-primary-focus:  #0071e3;
    --color-primary-dark:   #0055aa;   /* active/press state */
    --color-primary-rgb:    0, 102, 204;

    /* ── Couleurs système Apple — DESIGN.md {colors.system-*} ── */
    --color-danger:         #ff3b30; /* iOS system red */
    --color-danger-rgb:     255, 59, 48;
    --color-success:        #34c759; /* iOS system green */
    --color-success-rgb:    52, 199, 89;
    --color-warning:        #ff9f0a; /* iOS system amber */

    --mobile-filters-h: 48px; /* P7 — hauteur barre filtres mobile sticky sous topbar */

    /* Surcharge Bootstrap : aligne btn-primary sur le token */
    --bs-primary:           #0066cc;
    --bs-primary-rgb:       0, 102, 204;
    --bs-btn-bg:            #0066cc;
    --bs-btn-border-color:  #0066cc;
    --bs-btn-hover-bg:      #0055aa;
    --bs-btn-hover-border-color: #0055aa;
    --bs-btn-active-bg:     #004d99;
    --bs-btn-active-border-color: #004d99;
    --bs-link-color:        #0066cc;
    --bs-link-hover-color:  #0055aa;
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--color-bg);
    font-family: "SF Pro Display", "SF Pro Text", system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif; /* P3-09 — DESIGN.md : SF Pro Display en premier */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--color-text);
    /* P3 — DESIGN.md {typography.body} : 17px / 1.47 / -0.374px */
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.374px;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--topbar-shadow);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 100;
}

.topbar__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
    padding: 0 1.75rem;
}

/* Bouton hamburger */
.topbar__hamburger {
    width: 44px;  /* P7 — DESIGN.md touch target min 44×44px */
    height: 44px; /* P7 — DESIGN.md touch target min 44×44px */
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.topbar__hamburger:hover { background: rgba(0,0,0,0.05); }

/* Zone centrale : contient title-block + toolbar optionnelle */
.topbar__center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    min-width: 0;
    overflow: hidden;
}

/* Barre de recherche portail */
.topbar__search {
    flex: 1;
    max-width: 560px;
    position: relative;
    display: flex;
    align-items: center;
}

.topbar__search-icon {
    position: absolute;
    left: .9rem;
    color: var(--color-text-muted);
    font-size: .85rem;
    pointer-events: none;
}

.topbar__search-input {
    width: 100%;
    height: 32px; /* {component.search-input} HIG touch target 32px on purpose to fit topbar height (44px) */
    padding: .55rem .9rem .55rem 2.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 17px; /* P6 — DESIGN.md {component.search-input} : 17px */
    color: var(--color-text); /* P6 — tokénisé #1d1d1f */
    background: var(--color-surface); /* P6 — tokénisé #ffffff */
    outline: none;
    transition: border-color .15s;
}
.topbar__search-input:focus {
    outline: 2px solid var(--color-primary-focus); /* P6 — DESIGN.md : outline seul, pas box-shadow */
    outline-offset: -1px; /* colle au bord pill */
    border-color: var(--color-border);
}
.topbar__search-input::placeholder { color: var(--color-text-muted); }

/* Bloc titre + sous-titre (pattern Apple navigation bar) */
.topbar__title-block {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex-shrink: 0;
}

.topbar__title {
    font-size: 17px; /* DESIGN.md {typography.body-strong} */
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;       /* nav bar title — descender clearance for SF Pro */
    letter-spacing: -0.374px; /* Batch C — {typography.body-strong} */
}

.topbar__subtitle {
    font-size: 12px; /* DESIGN.md {typography.fine-print} */
    font-weight: 400;
    color: #6e6e73;
    white-space: nowrap;
    line-height: 1.0; /* Batch C — {typography.fine-print} 1.2→1.0 */
}

/* Toolbar inline dans la topbar (search, dates, actions) */
.topbar__toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* Formulaire de filtres dans la toolbar */
.topbar__toolbar-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Boutons d'action (Ajouter…) — calés à droite dans la toolbar */
.topbar__toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

/* Contrôles compacts dans topbar — hauteur réduite pour laisser respirer dans 44px */
.topbar__toolbar .app-filter-input {
    height: 32px;
    font-size: 13px;
}

.topbar__toolbar .app-btn-toolbar-primary {
    height: 32px;
    font-size: 13px;
}

/* Barre de filtres mobile — sticky sous topbar, injectée par JS */
.topbar__mobile-filters {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    height: var(--mobile-filters-h);
    background: var(--color-surface);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--topbar-shadow);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 99; /* sous la topbar (z-index 100) */
    display: none; /* masqué par défaut — JS + media query l'activent sur mobile */
    align-items: center;
    padding: 0 1rem;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Masque le scrollbar horizontal sur la barre mobile */
.topbar__mobile-filters::-webkit-scrollbar { display: none; }
.topbar__mobile-filters { scrollbar-width: none; }

/* ── Sidebar ────────────────────────────────────────────────── */

/* Overlay */
#hop-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1);
}
#hop-sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Drawer */
#hop-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    background: rgba(242,242,247,0.92);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid rgba(0,0,0,0.06);
    z-index: 201;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: "SF Pro Display", "SF Pro Text", system-ui, -apple-system, "Helvetica Neue", sans-serif; /* P3-09 */
}
#hop-sidebar.is-open {
    transform: translateX(0);
}

/* Header / logo */
.hop-sb__header {
    padding: 24px 20px 20px;
    /* Emphasis through surface alternation, not chrome (DESIGN.md, Iteration Guide #7).
       Semi-opaque white so the sidebar backdrop-filter keeps working underneath. */
    background: rgba(255,255,255,0.75);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.hop-sb__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.hop-sb__app-mark {
    width: 44px; height: 44px;
    flex-shrink: 0;
    object-fit: contain;
    /* The system's single shadow, reserved for product renders (DESIGN.md:123).
       drop-shadow() rather than box-shadow: the mark silhouette is irregular. */
    filter: drop-shadow(0 3px 12px rgba(0,0,0,0.22));
}
.hop-sb__app-name {
    font-size: 21px; font-weight: 600; /* {typography.tagline} 17→21px */
    color: var(--color-text); letter-spacing: 0.231px; /* {typography.tagline} tracking */
    line-height: 1.19;
}
.hop-sb__app-sub {
    font-size: 12px; color: rgba(0,0,0,0.45);
    margin-top: 2px; line-height: 1.3;
}

/* User card */
.hop-sb__user {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.hop-sb__user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px; width: 100%;
    background: rgba(255,255,255,0.8);
    border: none; cursor: pointer;
    transition: background 0.15s;
    font-family: inherit; text-align: left;
}
.hop-sb__user-card:hover { background: rgba(0,0,0,0.04); }
.hop-sb__avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(0,0,0,0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600;
    color: var(--color-primary); /* P5 — DESIGN.md : single accent */
    flex-shrink: 0;
}
.hop-sb__username {
    font-size: 15px; font-weight: 400;
    color: #1c1c1e; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hop-sb__chevron {
    opacity: 0.4;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.hop-sb__user-card[aria-expanded="true"] .hop-sb__chevron {
    transform: rotate(180deg);
}
.hop-sb__user-menu {
    padding: 8px 0 0;
    display: flex; flex-direction: column; gap: 2px;
}
.hop-sb__user-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; border-radius: 8px;
    color: rgba(0,0,0,0.55); font-size: 13px;
    text-decoration: none;
    transition: background 0.15s;
}
.hop-sb__user-link:hover {
    background: rgba(0,0,0,0.03);
    color: rgba(0,0,0,0.55);
}

/* Navigation */
.hop-sb__nav {
    flex: 1; padding: 12px;
    overflow-y: auto;
}
.hop-sb__nav-label {
    display: block;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: rgba(0,0,0,0.35); letter-spacing: 0.8px;
    padding: 8px 10px 6px;
}
.hop-sb__nav-item {
    display: flex; align-items: center; gap: 10px;
    min-height: 44px; /* P7 — DESIGN.md touch target min 44×44px */
    padding: 0 10px; border-radius: 8px; margin-bottom: 2px;
    color: #1c1c1e; font-size: 12px; /* P3-06 — {typography.nav-link} 14→12px */
    text-decoration: none; letter-spacing: -0.12px; /* P3-06 — {typography.nav-link} -0.1→-0.12px */
    transition: background 0.15s;
}
.hop-sb__nav-item:hover {
    background: rgba(0,0,0,0.03);
    color: #1c1c1e;
}
.hop-sb__nav-item--active {
    background: rgba(0,0,0,0.05);
    color: var(--color-primary); /* P5 — DESIGN.md : signal interactif = single accent */
    font-weight: 600;
}
.hop-sb__nav-item--active:hover { color: var(--color-primary); }
.hop-sb__nav-icon {
    width: 20px; text-align: center;
    opacity: 0.9; flex-shrink: 0;
}

/* Footer déconnexion */
.hop-sb__footer {
    padding: 12px 12px 24px;
    border-top: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.hop-sb__logout {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 8px; width: 100%;
    background: none; border: none; cursor: pointer;
    color: var(--color-danger); font-size: 14px; font-weight: 400;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.hop-sb__logout:hover { background: rgba(var(--color-danger-rgb), 0.06); color: var(--color-danger); }

/* ── Contenu principal ──────────────────────────────────────── */
.main-content {
    padding: calc(var(--topbar-h) + 2rem) 2rem 2rem;
}

/* ── Layout plein écran (apps avec tableau full-height) ─────── */
html, body { height: 100%; }

.layout-full {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.layout-full .main-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: calc(var(--topbar-h) + 1rem) 1.5rem 1rem;
    max-width: none;
    margin: 0;
}

/* ── Pages d'authentification (sans topbar) ─────────────────── */
.auth-body {
    min-height: 100vh;
    background: var(--color-bg); /* P3-08 — token var au lieu de valeur hardcodée */
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 16px;
}

.auth-card {
    background: var(--color-surface);
    border-radius: 18px; /* Batch C — {rounded.lg} 16→18px */
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 48px 32px 32px; /* P3-06 — {spacing.xxl}/{spacing.xl} ; 40px hors-token */
}

.auth-logo {
    display: block;
    margin: 0 auto 24px;
    width: 96px;
    height: 96px;
    object-fit: contain;
    /* Same product-shadow as .hop-sb__app-mark (DESIGN.md:123) */
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.22));
}

.auth-title {
    font-size: 21px; /* Batch C — {typography.tagline} 22→21px */
    font-weight: 600;
    letter-spacing: 0.231px; /* Batch C — {typography.tagline} tracking */
    color: var(--color-text);
    text-align: center;
    margin: 0 0 4px;
    line-height: 1.2;
}

.auth-subtitle {
    font-size: 14px; /* Batch C — {typography.caption} 15→14px */
    letter-spacing: -0.224px; /* P3-01 — {typography.caption} tracking */
    color: var(--color-text-muted);
    text-align: center;
    margin: 0 0 32px;
}

.auth-label {
    display: block;
    font-size: 14px; /* Batch C — {typography.caption} 13→14px */
    font-weight: 600;
    letter-spacing: -0.224px; /* Batch C — {typography.caption} tracking */
    color: var(--color-text);
    margin-bottom: 6px;
}

.auth-input {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 20px;
    font-size: 17px; /* P6 — DESIGN.md {component.search-input} : 17px */
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    transition: border-color 0.14s ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: 2px solid var(--color-primary-focus); /* P6 — DESIGN.md : outline seul, pas box-shadow */
    border-color: var(--color-primary);
}

.auth-field {
    margin-bottom: 17px; /* P3-08 — {spacing.md} 16→17px */
}

.auth-hint {
    font-size: 14px;
    letter-spacing: -0.224px;
    color: var(--color-text-muted);
    margin: 6px 0 0 12px;
    line-height: 1.43;
}

/* Notice de connexion (démo, maintenance) — surface parchemin sur la carte blanche :
   le changement de surface fait office de séparateur, donc ni bordure ni ombre. */
.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--color-bg);
    border-radius: 11px; /* {rounded.md} */
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 14px; /* {typography.caption} */
    font-weight: 400;
    letter-spacing: -0.224px;
    line-height: 1.43;
    color: var(--color-text);
    white-space: pre-line; /* respecte les retours à la ligne saisis en base */
}

.auth-notice i {
    margin-top: 2px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px; /* P3-05 — {typography.fine-print} 13→12px */
    color: var(--color-danger);
    margin-bottom: 20px;
    line-height: 1.4;
}

.auth-error i {
    margin-top: 1px;
    flex-shrink: 0;
}

.auth-btn {
    display: block;
    width: 100%;
    padding: 11px 22px; /* {component.button-primary} spec */
    min-height: 44px;  /* HIG touch target */
    font-size: 17px;
    font-weight: 400; /* P2-11 — {component.button-primary} = body 17px/400 */
    font-family: inherit;
    color: #ffffff;
    background: var(--color-primary);
    border: none;
    border-radius: 9999px; /* P4 — DESIGN.md {rounded.pill} */
    cursor: pointer;
    transition: opacity 0.14s ease, transform 0.1s ease;
    margin-top: 8px;
}

.auth-btn:hover         { opacity: 0.88; } /* P2-12 — Apple HIG : pas de hover background, opacity seule */
.auth-btn:active        { transform: scale(0.95); } /* P4 — DESIGN.md micro-interaction */
.auth-btn:focus-visible { outline: 2px solid var(--color-primary-focus); outline-offset: 2px; }

/* ── Pills de filtre (portail) ──────────────────────────────── */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 24px; /* P2-11 — {spacing.lg} ; unifier spacing filter→section-title */
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 14px; /* Batch C — {typography.caption} .85rem→14px */
    font-weight: 400;
    text-decoration: none;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.filter-pill:hover {
    border-color: var(--color-border-dark);
    color: var(--color-text);
    background: var(--color-bg);
}
.filter-pill--active {
    background: var(--color-primary); /* P4 — DESIGN.md : seul accent autorisé */
    color: #ffffff;
    border-color: var(--color-primary);
}
.filter-pill--active:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #ffffff;
}

/* ── Titre de section ───────────────────────────────────────── */
.section-title {
    font-size: 34px; /* Batch C — {typography.display-md} 2rem→34px */
    font-weight: 600;
    letter-spacing: -0.374px; /* Batch C — {typography.display-md} tracking */
    color: var(--color-text);
    margin-bottom: 24px; /* P2-11 — {spacing.lg} ; unifier avec filter-pills */
    line-height: 1.47; /* Batch C — {typography.display-md} line-height */
}

/* ── Cartes d'applications ──────────────────────────────────── */

/* Wrapper positionné : sert de référence pour le bouton favori absolu */
.app-card-wrapper {
    position: relative;
    height: 100%;
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 24px; /* Batch C — {spacing.lg} 1.25rem→24px */
    text-decoration: none;
    color: var(--color-text);
    transition: border-color .15s;
    height: 100%;
}
.app-card:hover {
    border-color: var(--color-border-dark); /* P5 — shadow supprimée (DESIGN.md) ; affordance hover via border seule */
    color: var(--color-text);
}

.app-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 18px; /* P5 — DESIGN.md {rounded.lg} ; 50% → 18px */
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.app-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-card__name {
    font-size: 17px; /* Batch C — {typography.body-strong} .95rem→17px */
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: .4rem;
    color: var(--color-text);
}

.app-card__desc {
    font-size: 14px; /* Batch C — {typography.caption} .8rem→14px */
    color: var(--color-text-muted);
    line-height: 1.5;
    flex: 1;
}

/* Formulaire favori : positionné en absolu sur le wrapper */
.app-card__fav-form {
    position: absolute;
    top: .85rem;
    right: .85rem;
    z-index: 2;
    margin: 0;
    padding: 0;
}

/* Bouton favori */
.app-card__fav {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    width: 44px; /* P3-10 — HIG touch target 44×44px */
    height: 44px;
    padding: 0;
    cursor: pointer;
    color: var(--color-border-dark);
    font-size: .95rem;
    line-height: 1;
    border-radius: 8px; /* P3-10 — {rounded.sm} 6→8px */
    transition: color .15s, background .15s;
}
.app-card__fav:hover {
    color: var(--color-danger); /* P3-15 — iOS red système → token */
    background: rgba(var(--color-danger-rgb), 0.06);
}
.app-card__fav--active {
    color: var(--color-danger); /* P3-16 — iOS red système → token */
}

/* ── Message vide ───────────────────────────────────────────── */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
}


/* ── Badges ───────────────────────────────────────────── */
.badge.bg-success-subtle {
    background-color: rgba(52, 199, 89, 0.12) !important;
    color: #1a7f37 !important;
    border: 1px solid rgba(52, 199, 89, 0.28);
    border-radius: 6px !important;
    font-size: 11px;
    font-weight: 600;
}
.badge-patient-available {
    background-color: #ddf1ff !important;
    color: #00459f !important;
    border-radius: 8px !important; /* P3-08 — {rounded.sm} token px, pas em */
    font-weight: 600;
}

.badge-patient-optimal {
    background-color: #d1f2df !important;
    color: #198754 !important;
    border-radius: 8px !important; /* P3-08 */
    font-weight: 600;
}

.badge-patient-overflow {
    background-color: #D70015 !important; /* Apple system red — {colors.system-red} */
    color: #fff;
    border-radius: 8px !important; /* P3-08 */
    font-weight: 600;
}

/* ── Tableau et Filtres ───────────────────────────────────── */
.app-hidden { display: none !important; }

/* ── Responsive — DESIGN.md breakpoints ─────────────────────────────────────
   Ordre : du plus large vers le plus petit (mobile-last).
   Référence : DESIGN.md § Responsive Behavior.
   ─────────────────────────────────────────────────────────────────────────── */

/* 1440px — content lock : main-content ne dépasse pas 1440px */
@media (max-width: 1440px) {
    .main-content {
        max-width: 1440px;
        margin-inline: auto;
    }
}

/* 1068px — small desktop : padding latéral réduit */
@media (max-width: 1068px) {
    .main-content {
        padding-inline: 1.25rem;
    }
    .layout-full .main-content {
        padding-inline: 1rem;
    }
}

/* 833px — tablet landscape : topbar compacte, subtitle masquée */
@media (max-width: 833px) {
    .topbar__inner {
        gap: 1rem;
        padding-inline: 1rem;
    }
    .topbar__subtitle {
        display: none;
    }
    .topbar__toolbar {
        gap: 4px;
    }
    .main-content {
        padding: calc(var(--topbar-h) + 1.5rem) 1rem 1rem;
    }
    .layout-full .main-content {
        padding: calc(var(--topbar-h) + 0.75rem) 1rem 0.75rem;
    }
}

/* 734px — tablet portrait : toolbar form peut wrapper */
@media (max-width: 734px) {
    .topbar__toolbar-form {
        flex-wrap: wrap;
    }
    .main-content {
        padding-inline: 0.75rem;
    }
}

/* 640px — phone : toolbar masquée, barre mobile activée, titre réduit */
@media (max-width: 640px) {
    .topbar__search {
        max-width: 100%;
    }
    .topbar__title {
        font-size: 15px;
    }
    .topbar__toolbar {
        display: none; /* P7 — Q6(a) : toolbar masquée → barre mobile (JS) */
    }
    .topbar__mobile-filters {
        display: flex; /* P7 — activée par CSS sur mobile ; JS clone les filtres dedans */
    }
    /* Compensation padding topbar + barre filtres mobile */
    .main-content {
        padding-top: calc(var(--topbar-h) + var(--mobile-filters-h) + 1rem);
        padding-inline: 0.5rem;
    }
    .layout-full .main-content {
        padding-top: calc(var(--topbar-h) + var(--mobile-filters-h) + 0.5rem);
        padding-inline: 0.5rem;
    }
}

/* 480px — small phone : gaps réduits */
@media (max-width: 480px) {
    .topbar__inner {
        gap: 0.5rem;
    }
    .main-content {
        padding-inline: 0.25rem;
    }
}

/* ── Topbar — composants de navigation et d'action ──────────────────────────
   Réutilisables par toutes les apps.
   ─────────────────────────────────────────────────────────────────────────── */

/* Lien retour — pattern iOS "< NomSection" */
.topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    font-weight: 400;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 2px;
    transition: opacity 0.15s;
}
.topbar__back:hover        { opacity: 0.7; color: var(--color-primary); text-decoration: none; }
.topbar__back:active       { opacity: 0.5; }
.topbar__back:focus-visible { outline: 2px solid var(--color-primary-focus); outline-offset: 2px; border-radius: 6px; }

/* Bouton icône seule — Modifier, Planning… */
.app-btn-toolbar-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--color-primary);
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.12s, transform 0.1s;
}
.app-btn-toolbar-icon:hover        { background: rgba(0,102,204,0.08); color: var(--color-primary); text-decoration: none; }
.app-btn-toolbar-icon:active       { transform: scale(0.95); }
.app-btn-toolbar-icon:focus-visible { outline: 2px solid var(--color-primary-focus); outline-offset: 2px; }

/* Variante navigation secondaire — icône en ink, hover neutre */
.app-btn-toolbar-icon--secondary       { color: #6e6e73; }
.app-btn-toolbar-icon--secondary:hover { background: rgba(0,0,0,0.05); color: #3a3a3c; }

/* Bouton texte + icône dans la toolbar */
.app-btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 44px;
    padding: 0 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    color: #3a3a3c;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s, transform 0.1s;
}
.app-btn-toolbar:hover        { background: rgba(0,0,0,0.05); }
.app-btn-toolbar:active       { transform: scale(0.95); }
.app-btn-toolbar:focus-visible { outline: 2px solid var(--color-primary-focus); outline-offset: 2px; }

/* Variante destructive — margin-left pour distancer visuellement du groupe précédent */
.app-btn-toolbar--danger       { color: var(--color-danger); margin-left: 8px; }
.app-btn-toolbar--danger:hover { background: rgba(var(--color-danger-rgb), 0.08); color: var(--color-danger); }