/* ===== Back-office : interface plus fluide (animations douces, toasts, palette, menu groupé) ===== */
.app-shell { scroll-behavior: smooth; }
.app-shell main > * { animation: ui-rise .45s cubic-bezier(.2,.8,.2,1) both; }
.app-shell main > *:nth-child(2) { animation-delay: .04s; }
.app-shell main > *:nth-child(3) { animation-delay: .08s; }
.app-shell main > *:nth-child(4) { animation-delay: .12s; }
.app-shell main > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes ui-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Cartes et tableaux */
.app-shell .card { border-radius: 1.1rem; transition: box-shadow .25s ease, transform .25s ease, outline-color .25s ease; }
.app-shell a.card:hover, .app-shell .card.is-link:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px rgba(16,24,40,.25); }
.app-shell .table tbody tr { transition: background-color .15s ease; }
.app-shell .table tbody tr:hover { background: rgba(227,10,19,.035); }

/* Boutons : retour tactile */
.app-shell [class*="btn-"] { transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease; }
.app-shell [class*="btn-"]:active { transform: scale(.97); }
.app-shell :focus-visible { outline: 2px solid #E30A13; outline-offset: 2px; border-radius: .5rem; }

/* Menu latéral groupé */
.app-shell .app-nav { max-height: calc(100vh - 4rem - 7.5rem); }
.side-group { padding: 1rem .8rem .35rem; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: #9CA3AF; }
.side-group:first-child { padding-top: .25rem; }
.app-shell .side-link { position: relative; transition: background-color .18s ease, color .18s ease, padding-left .18s ease; }
.app-shell .side-link:hover { padding-left: 1rem; }
.app-shell .side-link.is-active::before { content: ''; position: absolute; left: -.75rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: #E30A13; }
.app-shell .side-link svg { transition: transform .2s ease; }
.app-shell .side-link:hover svg { transform: scale(1.12); }

/* Toasts (messages de confirmation) */
.toast-stack { position: fixed; top: 4.75rem; right: 1rem; z-index: 55; display: flex; flex-direction: column; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; animation: none !important; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; border-radius: 1rem; font-size: .875rem; font-weight: 500;
    background: #fff; color: #111827; box-shadow: 0 16px 40px -12px rgba(16,24,40,.35); outline: 1px solid rgba(229,231,235,.8); animation: ui-toast .4s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes ui-toast { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }
.toast-icon { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; flex-shrink: 0; border-radius: 999px; font-weight: 800; color: #fff; }
.toast.is-ok .toast-icon { background: #059669; }
.toast.is-error .toast-icon { background: #E30A13; }
.toast-close { font-size: 1.25rem; line-height: 1; color: #9CA3AF; padding: 0 .25rem; }
.toast-close:hover { color: #111827; }

/* Recherche rapide */
.palette-trigger { display: inline-flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .75rem; border-radius: .75rem; font-size: .85rem; color: #6B7280;
    background: #F3F4F6; transition: background-color .2s ease, color .2s ease; }
.palette-trigger:hover { background: #E5E7EB; color: #111827; }
.app-shell kbd { font-family: inherit; font-size: 11px; font-weight: 600; padding: .1rem .4rem; border-radius: .35rem; background: #fff; color: #6B7280; outline: 1px solid #E5E7EB; }
.palette { width: 100%; max-width: 36rem; overflow: hidden; border-radius: 1.25rem; background: #fff; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.palette-item { display: block; padding: .65rem .9rem; border-radius: .75rem; font-size: .9rem; font-weight: 500; color: #374151; }
.palette-item.is-sel { background: #FFF1F2; color: #C1070F; }

/* Mode sombre */
html.dark .toast, html.dark .palette { background: #1A1F2B; color: #E5E7EB; outline-color: #2A3140; }
html.dark .palette-trigger { background: #232936; color: #9CA3AF; }
html.dark .palette-trigger:hover { background: #2A3140; color: #F3F4F6; }
html.dark .app-shell kbd { background: #1A1F2B; color: #9CA3AF; outline-color: #2A3140; }
html.dark .palette-item { color: #C7CCD6; }
html.dark .palette-item.is-sel { background: rgba(227,10,19,.15); color: #FF9DA1; }
html.dark .palette .border-gray-100 { border-color: #2A3140; }
html.dark .app-shell .table tbody tr:hover { background: rgba(255,255,255,.03); }
html.dark .side-group { color: #6B7280; }

@media (prefers-reduced-motion: reduce) {
    .app-shell main > *, .toast { animation: none !important; }
    .app-shell .side-link:hover { padding-left: .8rem; }
}

/* ===== Mobile : sensations iOS ===== */
.app-shell { -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
.app-shell .app-aside { transition: transform .42s cubic-bezier(.32,.72,0,1); padding-top: env(safe-area-inset-top); will-change: transform; }
.app-shell .app-nav { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.app-shell header.sticky { padding-top: env(safe-area-inset-top); height: calc(4rem + env(safe-area-inset-top)); background: rgba(255,255,255,.72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
html.dark .app-shell header.sticky { background: rgba(17,20,28,.72); }

.tabbar { position: fixed; inset: auto 0 0 0; z-index: 35; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.8); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid rgba(0,0,0,.12); }
html.dark .tabbar { background: rgba(17,20,28,.8); border-top-color: rgba(255,255,255,.08); }
.tab { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .3rem 0; font-size: 10.5px; font-weight: 600; color: #8E8E93; transition: color .2s ease, transform .15s ease; }
.tab svg { width: 1.6rem; height: 1.6rem; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .15rem; }
.tab:active { transform: scale(.88); }
.tab.is-active { color: #E30A13; }
html.dark .tab.is-active { color: #FF6B72; }

@media (max-width: 1023px) {
    .app-shell main { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
    .app-shell .side-link { padding-top: .8rem; padding-bottom: .8rem; font-size: 1rem; }
    .app-shell .side-link:hover { padding-left: .8rem; }
    .app-shell .toast-stack { top: auto; bottom: calc(5.5rem + env(safe-area-inset-bottom)); right: .75rem; left: .75rem; width: auto; }
    .app-shell input, .app-shell select, .app-shell textarea { font-size: 16px; } /* évite le zoom auto d'iOS */
    .app-shell .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .palette-trigger { width: 2.25rem; padding: 0; justify-content: center; }
}
@media (max-width: 639px) { .app-shell .header-new { display: none !important; } }
.palette-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: calc(12vh + env(safe-area-inset-top)) 1rem 1rem;
    background: rgba(0,0,0,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.palette input:focus, .palette input:focus-visible { outline: none !important; box-shadow: none !important; }

/* La barre d onglets est réservée au mobile */
@media (min-width: 1024px) { .tabbar { display: none !important; } }

/* ===== Tableau de bord en tuiles (bento) ===== */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.bento-slot { grid-column: span 12; min-height: 11rem; border-radius: 1.4rem; }
@media (min-width: 640px) { .bento-slot { grid-column: span 6; } }
@media (min-width: 1280px) { .bento-slot.b-3 { grid-column: span 3; } .bento-slot.b-4 { grid-column: span 4; } .bento-slot.b-5 { grid-column: span 5; } }
.bento-slot[data-swapy-highlighted] { background: rgba(227,10,19,.08); outline: 2px dashed rgba(227,10,19,.45); outline-offset: -2px; }
.tile { position: relative; height: 100%; border-radius: 1.4rem; overflow: hidden; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -18px rgba(0,0,0,.45); }
.tile[data-swapy-dragging] { transform: scale(1.03) rotate(-.6deg); box-shadow: 0 30px 60px -20px rgba(0,0,0,.55); z-index: 10; }
.tile-link { display: flex; height: 100%; flex-direction: column; justify-content: flex-end; padding: 1.4rem 1.5rem; color: inherit; }
.tile-handle { position: absolute; top: .7rem; right: .8rem; z-index: 2; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .7rem;
    font-size: 1.1rem; line-height: 1; cursor: grab; opacity: .55; background: rgba(255,255,255,.14); transition: opacity .2s ease, background-color .2s ease; }
.tile:hover .tile-handle { opacity: 1; }
.tile-handle:active { cursor: grabbing; }
.tile-kicker { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.tile-big { margin-top: .35rem; font-size: clamp(1.6rem, 2.4vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.tile-huge { margin-top: .2rem; font-size: clamp(3rem, 5vw, 4.5rem); font-weight: 800; letter-spacing: -.04em; line-height: .95; }
.tile-sub { margin-top: .45rem; font-size: .84rem; opacity: .82; }
.tile-pill { margin-top: .7rem; align-self: flex-start; padding: .3rem .75rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #E30A13; color: #fff; }

.tile-red { color: #fff; background: radial-gradient(120% 120% at 100% 0%, #FF4A50 0%, #E30A13 45%, #8E050B 100%); }
.tile-black { color: #fff; background: linear-gradient(160deg, #1F2430 0%, #0B0D12 100%); }
.tile-black .tile-huge { color: #fff; }
.tile-lime { color: #0B2A06; background: linear-gradient(140deg, #D9FF5A 0%, #9BE63B 45%, #3CB54A 100%); }
.tile-lime .tile-handle, .tile-white .tile-handle, .tile-outline .tile-handle { background: rgba(0,0,0,.07); }
.tile-green { color: #fff; background: linear-gradient(150deg, #57C93A 0%, #1F8F3A 55%, #0E5A2A 100%); }
.tile-white { color: #111827; background: #fff; outline: 1px solid #E5E7EB; }
.tile-white .tile-huge { color: #E30A13; }
.tile-gray { color: #F3F4F6; background: linear-gradient(160deg, #4B5563 0%, #2B313C 100%); }
.tile-outline { color: #111827; background: repeating-linear-gradient(135deg, #fff 0 14px, #F7F7F8 14px 28px); outline: 2px solid #E30A13; outline-offset: -2px; }
.tile-outline .tile-big { color: #E30A13; }
html.dark .tile-white { background: #1A1F2B; color: #F3F4F6; outline-color: #2A3140; }
html.dark .tile-outline { background: repeating-linear-gradient(135deg, #151922 0 14px, #1A1F2B 14px 28px); color: #F3F4F6; }
html.dark .tile-outline .tile-big, html.dark .tile-white .tile-huge { color: #FF6B72; }
@media (prefers-reduced-motion: reduce) { .tile, .tile:hover { transition: none; transform: none; } }

/* ===== Tuiles : version sobre (aplats, typographie simple) ===== */
.bento { gap: .75rem; }
.bento-slot { min-height: 10rem; border-radius: .9rem; }
.tile { border-radius: .9rem; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tile:hover { transform: none; box-shadow: 0 4px 14px -6px rgba(0,0,0,.25); }
.tile[data-swapy-dragging] { transform: scale(1.02); }
.tile-link { padding: 1.25rem 1.35rem; justify-content: center; }
.tile-kicker { font-size: .875rem; font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .85; }
.tile-big { font-size: clamp(1.5rem, 2vw, 2rem); font-weight: 700; }
.tile-huge { font-size: clamp(2.4rem, 3.6vw, 3.4rem); font-weight: 700; letter-spacing: -.03em; }
.tile-sub { font-size: .8rem; opacity: .75; }
.tile-handle { width: 1.6rem; height: 1.6rem; font-size: .9rem; opacity: 0; background: transparent; }
.tile:hover .tile-handle { opacity: .6; }
.tile-pill { font-weight: 600; }

.tile-red { background: #E30A13; }
.tile-black { background: #111318; }
.tile-gray { background: #4B5563; color: #fff; }
.tile-green { background: #16A34A; }
.tile-lime { color: #14300A; background: linear-gradient(135deg, #D4F772 0%, #A3E635 100%); }
.tile-white { background: #fff; outline: 1px solid #E5E7EB; }
.tile-white .tile-huge { color: #111827; }
.tile-outline { background: #F3F4F6; outline: 0; color: #111827; }
.tile-outline .tile-big { color: #E30A13; }
html.dark .tile-black { background: #000; outline: 1px solid #232936; }
html.dark .tile-white { background: #1A1F2B; outline-color: #2A3140; }
html.dark .tile-white .tile-huge { color: #F3F4F6; }
html.dark .tile-outline { background: #232936; color: #F3F4F6; }
html.dark .tile-outline .tile-big { color: #FF6B72; }

/* ===== Tuiles : cartes neutres, couleur en accent, grille 3 colonnes ===== */
.bento { grid-template-columns: 1fr; grid-auto-rows: minmax(170px, auto); gap: 1rem; }
.bento-slot, .bento-slot.b-1, .bento-slot.b-tall, .bento-slot.b-wide { grid-column: auto; grid-row: auto; min-height: 0; }
@media (min-width: 768px) {
    .bento { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bento-slot.b-tall { grid-row: span 3; }
    .bento-slot.b-wide { grid-column: span 2; }
}
.tile, .tile-red, .tile-black, .tile-gray, .tile-green, .tile-lime, .tile-white, .tile-outline {
    color: #111827; background: #fff; outline: 1px solid #E5E7EB; outline-offset: -1px; border-radius: .75rem; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.tile { animation: tile-in .6s cubic-bezier(.34,1.4,.64,1) both; }
.bento-slot:nth-child(2) .tile { animation-delay: .1s; } .bento-slot:nth-child(3) .tile { animation-delay: .2s; }
.bento-slot:nth-child(4) .tile { animation-delay: .3s; } .bento-slot:nth-child(5) .tile { animation-delay: .4s; }
.bento-slot:nth-child(6) .tile { animation-delay: .5s; } .bento-slot:nth-child(7) .tile { animation-delay: .6s; }
.bento-slot:nth-child(8) .tile { animation-delay: .7s; } .bento-slot:nth-child(9) .tile { animation-delay: .8s; }
@keyframes tile-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.tile:hover { box-shadow: 0 6px 20px -10px rgba(16,24,40,.25); outline-color: #D1D5DB; }
.tile-link { justify-content: space-between; padding: 1.5rem; }
.tile-kicker { order: -1; font-size: 1rem; font-weight: 500; opacity: 1; }
.tile-sub { color: #6B7280; opacity: 1; font-size: .85rem; }
.tile-big, .tile-huge { color: #111827; }
.tile-handle { color: #9CA3AF; }

/* Accents */
.tile-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem; border-radius: 999px; font-size: 1.4rem; font-weight: 800; color: #E30A13; background: #FEE2E2; }
.tile-red .tile-big { color: #E30A13; font-size: clamp(2rem, 3vw, 2.8rem); }
.tile-red .tile-link { justify-content: flex-start; }
.tile-bars { margin-top: auto; display: flex; align-items: flex-end; gap: 4px; height: 45%; min-height: 6rem; padding-top: 1.5rem; }
.tile-bars i { flex: 1; border-radius: 3px 3px 0 0; background: #E30A13; opacity: .85; }
.tile-bars i:last-child { background: linear-gradient(180deg, #D4F772, #84CC16); opacity: 1; }
.tile-black .tile-link { background-image: radial-gradient(#111827 1px, transparent 1px); background-size: 16px 16px; background-color: transparent; }
.tile-black .tile-link { position: relative; }
.tile-black { background-image: none; }
.tile-black .tile-huge { font-size: clamp(3.5rem, 5vw, 5rem); }
.tile-black .tile-link::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.82); z-index: -1; }
.tile-black .tile-link { isolation: isolate; }
.tile-lime .tile-huge { background: linear-gradient(135deg, #84CC16, #16A34A); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile-white .tile-huge { color: #E30A13; }
.tile-green .tile-big { color: #111827; }
.tile-green .tile-kicker::after { content: 'Agenda'; margin-left: .5rem; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: #3F6212; background: #ECFCCB; outline: 1px solid #BEF264; vertical-align: middle; }
.tile-gray .tile-big { color: #111827; }
.tile-outline .tile-big { color: #111827; }
.tile-outline .tile-kicker::before { content: '★ '; color: #E30A13; }
.tile-pill { background: #111827; }

/* Mode sombre */
html.dark .tile, html.dark .tile-red, html.dark .tile-black, html.dark .tile-gray, html.dark .tile-green, html.dark .tile-lime, html.dark .tile-white, html.dark .tile-outline {
    color: #F3F4F6; background: #151922; outline-color: #262C38; }
html.dark .tile-big, html.dark .tile-huge, html.dark .tile-green .tile-big, html.dark .tile-gray .tile-big, html.dark .tile-outline .tile-big { color: #F3F4F6; }
html.dark .tile-red .tile-big, html.dark .tile-white .tile-huge { color: #FF5A60; }
html.dark .tile-sub { color: #9CA3AF; }
html.dark .tile-icon { background: rgba(227,10,19,.15); }
html.dark .tile-black .tile-link { background-image: radial-gradient(#F3F4F6 1px, transparent 1px); }
html.dark .tile-black .tile-link::before { background: rgba(21,25,34,.85); }
html.dark .tile-green .tile-kicker::after { color: #D9F99D; background: rgba(132,204,22,.15); outline-color: rgba(132,204,22,.35); }
html.dark .tile-pill { background: #E30A13; }
@media (prefers-reduced-motion: reduce) { .tile { animation: none; } }

/* ===== Finances en tuiles ===== */
.fin-bento { margin-bottom: .5rem; }
.fin-bento .tile { animation-duration: .7s; }
.fin-split { margin-top: auto; height: .6rem; border-radius: 999px; background: #E5E7EB; overflow: hidden; }
.fin-split i { display: block; height: 100%; border-radius: 999px; background: #E30A13; }
.fin-legend { margin-top: 1rem; display: grid; gap: .6rem; font-size: .85rem; color: #6B7280; }
.fin-legend span { display: flex; align-items: center; gap: .5rem; }
.fin-legend strong { margin-left: auto; color: #111827; }
.dot { width: .6rem; height: .6rem; border-radius: 999px; display: inline-block; }
.dot-red { background: #E30A13; } .dot-gray { background: #D1D5DB; }
.fin-center { align-items: center; justify-content: center; text-align: center; }
.fin-badge { margin-left: .4rem; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; color: #3F6212; background: #ECFCCB; outline: 1px solid #BEF264; vertical-align: middle; }
.fin-bento .tile-lime .tile-huge { font-size: clamp(2rem, 3vw, 2.8rem); }
.fin-bento .tile-white .tile-huge { font-size: clamp(2rem, 3vw, 2.8rem); }
.fin-shortcuts { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.fin-keys { display: flex; flex-wrap: wrap; gap: .5rem; }
.fin-keys a { padding: .45rem .8rem; border-radius: .5rem; font-size: .8rem; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #374151; background: #fff; outline: 1px solid #E5E7EB; transition: outline-color .2s ease, color .2s ease; }
.fin-keys a:hover { color: #E30A13; outline-color: #E30A13; }
html.dark .fin-split { background: #262C38; } html.dark .dot-gray { background: #4B5563; }
html.dark .fin-legend { color: #9CA3AF; } html.dark .fin-legend strong { color: #F3F4F6; }
html.dark .fin-badge { color: #D9F99D; background: rgba(132,204,22,.15); outline-color: rgba(132,204,22,.35); }
html.dark .fin-keys a { color: #D1D5DB; background: #1A1F2B; outline-color: #2A3140; }

/* ===== Animations des graphiques ===== */
@keyframes bar-grow-v { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes bar-grow-h { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.tile-bars i, .bar-v { transform-origin: bottom; animation: bar-grow-v .9s cubic-bezier(.34,1.3,.64,1) both; }
.bar-h, .fin-split i { transform-origin: left; animation: bar-grow-h 1.1s cubic-bezier(.22,1,.36,1) both; animation-delay: .3s; }
.tile-bars i:nth-child(1), .group:nth-child(1) > .bar-v { animation-delay: .35s; }
.tile-bars i:nth-child(2), .group:nth-child(2) > .bar-v { animation-delay: .41s; }
.tile-bars i:nth-child(3), .group:nth-child(3) > .bar-v { animation-delay: .47s; }
.tile-bars i:nth-child(4), .group:nth-child(4) > .bar-v { animation-delay: .53s; }
.tile-bars i:nth-child(5), .group:nth-child(5) > .bar-v { animation-delay: .59s; }
.tile-bars i:nth-child(6), .group:nth-child(6) > .bar-v { animation-delay: .65s; }
.tile-bars i:nth-child(7), .group:nth-child(7) > .bar-v { animation-delay: .71s; }
.tile-bars i:nth-child(8), .group:nth-child(8) > .bar-v { animation-delay: .77s; }
.tile-bars i:nth-child(9), .group:nth-child(9) > .bar-v { animation-delay: .83s; }
.tile-bars i:nth-child(10), .group:nth-child(10) > .bar-v { animation-delay: .89s; }
.tile-bars i:nth-child(11), .group:nth-child(11) > .bar-v { animation-delay: .95s; }
.tile-bars i:nth-child(12), .group:nth-child(12) > .bar-v { animation-delay: 1.01s; }
li:nth-child(2) .bar-h { animation-delay: .4s; } li:nth-child(3) .bar-h { animation-delay: .5s; } li:nth-child(4) .bar-h { animation-delay: .6s; }
li:nth-child(5) .bar-h { animation-delay: .7s; } li:nth-child(6) .bar-h { animation-delay: .8s; } li:nth-child(n+7) .bar-h { animation-delay: .9s; }
tr:nth-child(2) .bar-h { animation-delay: .35s; } tr:nth-child(3) .bar-h { animation-delay: .4s; } tr:nth-child(4) .bar-h { animation-delay: .45s; }
tr:nth-child(5) .bar-h { animation-delay: .5s; } tr:nth-child(6) .bar-h { animation-delay: .55s; } tr:nth-child(n+7) .bar-h { animation-delay: .6s; }
.tile-bars i { transition: opacity .2s ease, filter .2s ease; }
.tile-bars:hover i { opacity: .45; } .tile-bars i:hover { opacity: 1; filter: brightness(1.15); }
.tile-bars i:last-child { animation-name: bar-grow-v, bar-pulse; animation-duration: .9s, 2.4s; animation-delay: 1.07s, 2s; animation-iteration-count: 1, infinite; }
@keyframes bar-pulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.25) drop-shadow(0 0 6px rgba(163,230,53,.7)); } }
@media (prefers-reduced-motion: reduce) { .tile-bars i, .bar-v, .bar-h, .fin-split i { animation: none !important; } }

/* ===== Outil IA flyer ===== */
.ai-spark { color: #E30A13; }
.ai-drop { display: flex; align-items: center; justify-content: center; gap: 1rem; min-height: 8rem; padding: 1.25rem; text-align: center; cursor: pointer;
    border: 2px dashed #D1D5DB; border-radius: .9rem; transition: border-color .2s ease, background-color .2s ease; }
.ai-drop:hover, .ai-drop.is-over { border-color: #E30A13; background: rgba(227,10,19,.04); }
.ai-drop.is-busy { cursor: progress; border-style: solid; border-color: #A3E635; background: rgba(163,230,53,.06); }
.ai-thumb { max-height: 7rem; border-radius: .5rem; box-shadow: 0 4px 14px -6px rgba(0,0,0,.3); }
.ai-spinner { width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 2px solid #A3E635; border-top-color: transparent; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-filled { box-shadow: 0 0 0 3px rgba(132,204,22,.45) !important; border-color: #84CC16 !important; transition: box-shadow .4s ease; }
html.dark .ai-drop { border-color: #2A3140; }

/* ===== Impression / PDF : même rendu qu'à l'écran ===== */
.print-only { display: none; }
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    html, body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .app-shell aside, .app-shell header.sticky, .app-shell .tabbar, .app-shell .toast-stack, .app-shell .no-print,
    .app-shell .palette-overlay, .app-shell .drawer-backdrop, .app-shell form.mb-6, #live-toast, .no-print { display: none !important; }
    .app-shell main { padding: 0 !important; }
    .app-shell main > * { animation: none !important; }
    .app-shell .card { break-inside: avoid; box-shadow: none; }
    .app-shell .bar-h, .app-shell .bar-v { animation: none !important; transform: none !important; }
    .app-shell .table th, .app-shell .table td { padding: .45rem .7rem; }
    .app-shell .mt-6 { margin-top: .9rem !important; }
    .print-only { display: flex !important; }
    .report-print-head { align-items: center; gap: .8rem; margin-bottom: .9rem; font-size: .85rem; }
    .report-print-head img { width: 2.6rem; height: 2.6rem; border-radius: .5rem; }
    html.dark body.app-shell { background: #0B0D12 !important; }
}
@media print {
    @page { size: A4 landscape; margin: 0; }
    body.app-shell { padding: 9mm 10mm; }
    .app-shell .grid.xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: .6rem !important; }
    .app-shell .card.overflow-hidden { break-inside: auto; }
    .app-shell .card.p-5 { padding: .8rem 1rem !important; }
    .app-shell .text-3xl { font-size: 1.6rem !important; }
    .app-shell .table { font-size: .72rem; }
    .app-shell .table th, .app-shell .table td { padding: .28rem .6rem; }
    .app-shell .table tr { break-inside: avoid; }
}
@media print {
    .app-shell .table { display: table !important; width: 100% !important; }
    .app-shell .table .text-sm { font-size: inherit !important; }
    .app-shell main { padding-bottom: 0 !important; }
}

/* Bandeau notifications du chat : lisible en clair et en sombre */
.push-banner { background: #DCF8C6; color: #14532D; font-weight: 500; }
html.dark .push-banner { background: rgba(37,211,102,.12); color: #BBF7D0; outline: 1px solid rgba(37,211,102,.3); }

/* Zone de dépôt du flyer : bouton rouge, champ fichier masqué */
.ai-drop { position: relative; min-height: 9rem; }
.ai-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.ai-drop-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 1.25rem; }
.ai-btn { display: inline-flex; align-items: center; gap: .6rem; padding: .85rem 1.5rem; border-radius: 999px; font-weight: 700; font-size: .95rem; color: #fff;
    background: linear-gradient(135deg, #FF3B42 0%, #E30A13 55%, #B0060D 100%); box-shadow: 0 10px 24px -10px rgba(227,10,19,.75), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease; }
.ai-btn svg { width: 1.15rem; height: 1.15rem; }
.ai-drop:hover .ai-btn { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 14px 30px -10px rgba(227,10,19,.85), inset 0 1px 0 rgba(255,255,255,.25); }
.ai-drop:active .ai-btn { transform: scale(.97); }
.ai-drop.is-over .ai-btn { animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { box-shadow: 0 0 0 8px rgba(227,10,19,.18), 0 10px 24px -10px rgba(227,10,19,.75); } }
.ai-drop-text { display: flex; flex-direction: column; text-align: left; font-size: .875rem; }
.ai-drop-text span { color: #6B7280; }
html.dark .ai-drop-text span { color: #9CA3AF; }
/* Bouton flyer en bleu */
.ai-btn { background: linear-gradient(135deg, #4F8BFF 0%, #2563EB 55%, #1D3FBF 100%); box-shadow: 0 10px 24px -10px rgba(37,99,235,.75), inset 0 1px 0 rgba(255,255,255,.25); }
.ai-drop:hover .ai-btn { box-shadow: 0 14px 30px -10px rgba(37,99,235,.85), inset 0 1px 0 rgba(255,255,255,.25); }
.ai-drop:hover, .ai-drop.is-over { border-color: #2563EB; background: rgba(37,99,235,.05); }
@keyframes ai-pulse { 50% { box-shadow: 0 0 0 8px rgba(37,99,235,.2), 0 10px 24px -10px rgba(37,99,235,.75); } }

/* Connexion agenda Google */
.gcal-logo { display: grid; place-items: center; width: 3rem; height: 3rem; flex-shrink: 0; border-radius: .9rem; background: #F1F5FE; }
.gcal-logo svg { width: 2rem; height: 2rem; }
.gcal-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.2rem; border-radius: 999px; font-size: .875rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #4F8BFF 0%, #2563EB 60%, #1D3FBF 100%); box-shadow: 0 8px 20px -10px rgba(37,99,235,.8); transition: transform .15s ease, filter .2s ease; }
.gcal-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
html.dark .gcal-logo { background: rgba(66,133,244,.12); }

/* Bandeau « Voir en tant que » */
.viewas-bar { position: sticky; top: 0; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem; padding: .55rem 1rem;
    font-size: .85rem; font-weight: 600; color: #fff; background: linear-gradient(90deg, #1D3FBF, #2563EB); }
.viewas-bar button { padding: .3rem .9rem; border-radius: 999px; font-weight: 700; color: #1D3FBF; background: #fff; }
.viewas-bar button:hover { background: #E0E7FF; }
.viewas-ico { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: .7rem; background: rgba(37,99,235,.1); }

/* Flyer : booking déjà saisi ? */
.dup-ok { border-radius: .6rem; padding: .55rem .8rem; font-size: .875rem; color: #166534; background: #F0FDF4; outline: 1px solid #BBF7D0; }
.dup-warn { border-radius: .6rem; padding: .7rem .9rem; font-size: .875rem; color: #7C2D12; background: #FFF7ED; outline: 1px solid #FDBA74; }
.dup-link { display: inline-block; border-radius: .4rem; padding: .1rem .3rem; text-decoration: underline; text-underline-offset: 2px; }
.dup-link:hover { background: rgba(0,0,0,.05); }
html.dark .dup-ok { color: #BBF7D0; background: rgba(34,197,94,.1); outline-color: rgba(34,197,94,.3); }
html.dark .dup-warn { color: #FED7AA; background: rgba(249,115,22,.12); outline-color: rgba(249,115,22,.35); }
html.dark .dup-link:hover { background: rgba(255,255,255,.06); }


/* Espace artiste : photo et nom en haut du menu, avatar dans l'en-tête */
.me-card { display: flex; align-items: center; gap: .8rem; margin: .9rem .75rem 0; padding: .7rem; border-radius: 1rem; background: #F9FAFB; outline: 1px solid #F3F4F6;
    transition: background-color .2s ease; animation: ui-rise .5s cubic-bezier(.2,.8,.2,1) both; }
.me-card:hover { background: #F3F4F6; }
.me-card img { width: 3.25rem; height: 3.25rem; flex-shrink: 0; border-radius: 999px; object-fit: cover; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #E30A13; }
.me-avatar { width: 2.4rem; height: 2.4rem; flex-shrink: 0; border-radius: 999px; object-fit: cover; box-shadow: 0 0 0 2px #E30A13; animation: me-pop .6s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes me-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
html.dark .me-card { background: #151922; outline-color: #232936; }
html.dark .me-card:hover { background: #1A1F2B; }
html.dark .me-card img { box-shadow: 0 0 0 2px #11141C, 0 0 0 4px #E30A13; }
.me-card + .app-nav { max-height: calc(100vh - 4rem - 7.5rem - 5rem) !important; }


/* Espace organisateur : incitation flyer / logo, champs fichiers stylés */
.promo-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-radius: 1rem; color: #fff;
    background: linear-gradient(120deg, #1D3FBF 0%, #2563EB 55%, #E30A13 140%); box-shadow: 0 16px 36px -18px rgba(37,99,235,.8); }
.promo-ask-ico { display: grid; place-items: center; width: 3rem; height: 3rem; flex-shrink: 0; border-radius: 1rem; font-size: 1.5rem; background: rgba(255,255,255,.16); }
.promo-card .promo-ask-ico { background: rgba(37,99,235,.1); }
.promo-ask-btn { padding: .75rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .9rem; color: #1D3FBF; background: #fff; box-shadow: 0 8px 20px -10px rgba(0,0,0,.5); transition: transform .15s ease; }
.promo-ask-btn:hover { transform: translateY(-1px); }
.promo-card { outline: 2px solid rgba(37,99,235,.35) !important; }
.promo-pill { display: inline-block; margin-left: .3rem; padding: .1rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; color: #1D4ED8; background: #DBEAFE; vertical-align: middle; }
.file-pick { position: relative; display: flex; align-items: center; min-height: 2.9rem; padding: .6rem 1rem; border-radius: .8rem; cursor: pointer; font-size: .875rem; font-weight: 600;
    border: 2px dashed #CBD5E1; transition: border-color .2s ease, background-color .2s ease; }
.file-pick:hover { border-color: #2563EB; background: rgba(37,99,235,.05); }
.file-pick > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
html.dark .promo-pill { color: #BFDBFE; background: rgba(37,99,235,.25); }
html.dark .file-pick { border-color: #2A3140; }

/* ===== Écran d accueil animé (après connexion) ===== */
.omf-loader { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
    color: #fff; background: radial-gradient(120% 90% at 50% 40%, #1A0507 0%, #0B0D12 55%, #05060A 100%); transition: opacity .6s ease, visibility .6s ease; }
.omf-loader.is-out { opacity: 0; visibility: hidden; }
.omf-loader.is-out .omf-loader-ring { transform: scale(1.25); }
.omf-loader-ring { position: relative; display: grid; place-items: center; width: 8.5rem; height: 8.5rem; margin-bottom: 1.2rem; transition: transform .6s cubic-bezier(.22,1,.36,1); }
.omf-loader-ring > span { position: absolute; inset: 0; border-radius: 999px; border: 3px solid rgba(255,255,255,.08); border-top-color: #E30A13; border-right-color: #2563EB;
    animation: omf-spin 1s linear infinite; }
.omf-loader-ring::after { content: ""; position: absolute; inset: -14px; border-radius: 999px; background: radial-gradient(circle, rgba(227,10,19,.35), transparent 65%); animation: omf-glow 1.6s ease-in-out infinite; }
.omf-loader-logo { width: 4.5rem; height: 4.5rem; animation: omf-pop .8s cubic-bezier(.34,1.56,.64,1) both; }
.omf-loader-photo { width: 7rem; height: 7rem; border-radius: 999px; object-fit: cover; animation: omf-pop .8s cubic-bezier(.34,1.56,.64,1) both; }
.omf-loader-hi { font-size: .8rem; font-weight: 700; letter-spacing: .35em; text-transform: uppercase; color: rgba(255,255,255,.6); animation: omf-up .6s .25s both; }
.omf-loader-name { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; animation: omf-up .7s .4s both; }
.omf-loader-bar { width: 10rem; height: 3px; margin-top: 1.2rem; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); animation: omf-up .6s .5s both; }
.omf-loader-bar i { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, #E30A13, #2563EB); animation: omf-bar 1.1s ease-in-out infinite; }
@keyframes omf-spin { to { transform: rotate(360deg); } }
@keyframes omf-glow { 50% { opacity: .35; transform: scale(1.08); } }
@keyframes omf-pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes omf-up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes omf-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .omf-loader * { animation: none !important; } }
@media print { .omf-loader { display: none !important; } }

/* Flyer : plusieurs artistes, transcription du texte */
.multi-art { border-radius: .7rem; padding: .75rem .9rem; font-size: .875rem; color: #1E3A8A; background: #EFF6FF; outline: 1px solid #BFDBFE; }
.multi-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px; font-weight: 600; cursor: pointer; background: #fff; outline: 1px solid #93C5FD; }
.ocr-box { border-radius: .7rem; padding: .75rem .9rem; font-size: .875rem; background: #F9FAFB; outline: 1px solid #E5E7EB; }
.ocr-text { margin-top: .6rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.5; user-select: text; }
.ocr-copy { padding: .25rem .8rem; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #fff; background: #2563EB; }
html.dark .multi-art { color: #BFDBFE; background: rgba(37,99,235,.12); outline-color: rgba(37,99,235,.35); }
html.dark .multi-chip { background: #1A1F2B; outline-color: rgba(96,165,250,.5); }
html.dark .ocr-box { background: #151922; outline-color: #262C38; }

/* Suggestions d'organisateurs connus */
.org-sugg { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin-top: .3rem; padding: .35rem; border-radius: .8rem; background: #fff;
    box-shadow: 0 20px 40px -16px rgba(0,0,0,.45); outline: 1px solid #E5E7EB; }
.org-sugg-head { padding: .25rem .6rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9CA3AF; }
.org-sugg-item { display: flex; width: 100%; flex-direction: column; align-items: flex-start; gap: .05rem; padding: .5rem .6rem; border-radius: .55rem; text-align: left; font-size: .85rem; }
.org-sugg-item span { font-size: .75rem; color: #6B7280; }
.org-sugg-item:hover { background: #EFF6FF; }
html.dark .org-sugg { background: #1A1F2B; outline-color: #2A3140; }
html.dark .org-sugg-item:hover { background: rgba(37,99,235,.15); }
html.dark .org-sugg-item span { color: #9CA3AF; }

/* Bouton menu : sur ordinateur, replie / déplie le menu de gauche */
@media (min-width: 1024px) {
    .app-shell .app-aside { transition: margin-left .35s cubic-bezier(.32,.72,0,1), opacity .25s ease; }
    body.nav-hidden .app-aside { margin-left: -16rem; opacity: 0; pointer-events: none; }
}

/* Flyer : tableau des bookings à créer (plusieurs artistes) */
.multi-table { width: 100%; font-size: .85rem; border-collapse: collapse; }
.multi-table th { text-align: left; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .7; padding: .3rem .5rem; }
.multi-table td { padding: .35rem .5rem; border-top: 1px solid rgba(147,197,253,.35); vertical-align: middle; }
.multi-table input[type=text], .multi-table input[type=number] { width: 100%; min-width: 7rem; padding: .4rem .6rem; border-radius: .5rem; font-size: .85rem; background: rgba(255,255,255,.7); border: 1px solid #BFDBFE; }
html.dark .multi-table input[type=text], html.dark .multi-table input[type=number] { background: #11141C; border-color: #2A3140; color: #F3F4F6; }

/* Encadrés Prestation supplémentaires (un par artiste du flyer) */
.presta-who { color: #2563EB; }
.presta-extra { outline: 2px solid rgba(37,99,235,.35) !important; animation: ui-rise .45s cubic-bezier(.2,.8,.2,1) both; }
.presta-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: -.25rem 0 1rem; font-size: .85rem; }
.presta-on { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .8rem; border-radius: 999px; font-weight: 700; color: #1D4ED8; background: #DBEAFE; cursor: pointer; }
.presta-dup { font-weight: 600; color: #D97706; text-decoration: underline; }
.presta-x { margin-left: auto; width: 2rem; height: 2rem; border-radius: 999px; color: #9CA3AF; }
.presta-x:hover { color: #E30A13; background: rgba(227,10,19,.08); }
html.dark .presta-who { color: #60A5FA; }
html.dark .presta-on { color: #BFDBFE; background: rgba(37,99,235,.25); }
