/* Ticket Express — espaces Admin & Partenaire
   Couleurs de marque : vert #04802c, jaune #ffc213, gris foncé #282828 */

:root {
    --brand: #04802c;
    --brand-dark: #035c20;
    --brand-deep: #013813;
    --accent: #ffc213;
    --accent-dark: #e6ae00;
    --ink: #1f1f24;
    --muted: #6b7280;
    --bg: #f3f4f7;
    --surface: #ffffff;
    --surface-alt: #f8f9fb;
    --border: #e6e8ee;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --radius: 12px;
    --sidebar-w: 256px;
    --success: #04802c;
    --warning: #b7791f;
    --danger: #dc3545;
    --info: #0d6efd;
}

:root[data-theme="dark"] {
    --ink: #eceef2;
    --muted: #9aa0ab;
    --bg: #0e0f12;
    --surface: #17181c;
    --surface-alt: #1e1f24;
    --border: #2a2c33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    --warning: #f0b429;
    --info: #4c9aff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Roboto', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: .925rem;
}
a { color: var(--brand); }
:root[data-theme="dark"] a { color: #4cc77a; }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); height: 100vh; height: 100dvh; overflow: hidden;
    background: linear-gradient(180deg, var(--brand-deep), #1d1d1d);
    color: #fff; display: flex; flex-direction: column; z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: clamp(.6rem, 2vh, 1.25rem) 1.25rem clamp(.5rem, 1.6vh, 1rem); border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.sidebar-brand img { height: clamp(26px, 5vh, 38px); width: auto; }
.sidebar-brand span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; line-height: 1.2; }
/* La barre ne défile pas : l'espacement des liens s'adapte à la hauteur de l'écran */
.sidebar-nav { flex: 1; min-height: 0; overflow: hidden; padding: clamp(.3rem, 1.2vh, .75rem) .75rem; display: flex; flex-direction: column; }
.nav-section { font-size: clamp(.6rem, 1.3vh, .68rem); text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); padding: clamp(.3rem, 1.5vh, 1rem) .75rem clamp(.1rem, .5vh, .4rem); }
.nav-item {
    display: flex; align-items: center; gap: .75rem; padding: clamp(.18rem, .95vh, .62rem) .75rem; border-radius: 9px;
    font-size: clamp(.8rem, 1.7vh, .95rem); line-height: 1.35;
    color: rgba(255,255,255,.82) !important; text-decoration: none; font-weight: 500; margin-bottom: 2px;
}
.nav-item i:first-child { width: 18px; text-align: center; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff !important; }
.nav-item.active { background: var(--accent); color: #1f1f24 !important; }
.nav-item.small { font-size: clamp(.74rem, 1.5vh, .82rem); padding: clamp(.15rem, .7vh, .5rem) .75rem; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .45rem; font-weight: 700; }
.nav-item.active .nav-badge { background: #1f1f24; }
.sidebar-footer { padding: clamp(.3rem, 1.2vh, .75rem) .75rem; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 1rem;
    padding: .8rem 1.75rem; background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar-title small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.topbar-title h1 { font-size: 1.2rem; margin: 0; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
    color: var(--ink) !important; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { border-color: var(--brand); }
.dot-badge {
    position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; display: flex; align-items: center;
    justify-content: center; border: 2px solid var(--surface);
}
.user-chip { display: flex; align-items: center; gap: .6rem; background: none; border: 0; color: var(--ink); padding: .25rem .4rem; border-radius: 10px; }
.user-chip:hover { background: var(--surface-alt); }
.user-chip strong { display: block; font-size: .85rem; line-height: 1.1; }
.user-chip small { color: var(--muted); font-size: .72rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.6rem; }

.content { padding: 1.5rem 1.75rem 3rem; flex: 1; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .app.sidebar-open .sidebar { transform: none; }
    .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
    .main { margin-left: 0; }
    .topbar { padding: .7rem 1rem; }
    .content { padding: 1rem 1rem 2.5rem; }
}

/* ---------- Composants ---------- */
.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x + .card-x { margin-top: 1.25rem; }
.card-x-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-x-header h2, .card-x-header h3 { font-size: 1rem; margin: 0; font-weight: 700; }
.card-x-body { padding: 1.25rem; }

.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-actions p { margin: 0; color: var(--muted); }

/* Blocs de statistiques — dégradés animés, sans bordure */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; margin-bottom: 1.4rem; }
@media (min-width: 576px) { .stats-grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.stat-card {
    --g1: #04802c; --g2: #22c55e; --glow: rgba(4,128,44,.35);
    position: relative; isolation: isolate; overflow: hidden; min-width: 0;
    display: flex; flex-direction: column; gap: .4rem; padding: 1.2rem 1.25rem 1.1rem;
    border: 0; border-radius: 18px; color: #fff !important; text-decoration: none;
    background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 100%);
    background-size: 160% 160%;
    box-shadow: 0 10px 24px -10px var(--glow);
    /* "backwards" : l'apparition libère la carte une fois finie (sinon le survol ne pourrait plus la soulever) */
    animation: stat-in .6s cubic-bezier(.2,.7,.2,1) backwards, stat-flow 9s ease-in-out infinite alternate;
    transition: transform .25s ease, box-shadow .25s ease;
}
/* Formes décoratives */
.stat-card::before {
    content: ''; position: absolute; z-index: -1; width: 180px; height: 180px; border-radius: 50%;
    top: -70px; right: -60px; background: radial-gradient(circle, rgba(255,255,255,.28), rgba(255,255,255,0) 70%);
}
/* Reflet qui balaie la carte au survol */
.stat-card::after {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 48%, transparent 66%);
    transform: translateX(-120%);
}
.stat-card:hover::after { animation: stat-shine .9s ease; }
.stat-card.is-link:hover { transform: translateY(-5px); box-shadow: 0 20px 36px -12px var(--glow); }
.stat-bg {
    position: absolute; z-index: -1; right: -14px; bottom: -22px; font-size: 6.5rem; line-height: 1;
    color: rgba(255,255,255,.12); transform: rotate(-12deg); transition: transform .4s ease;
}
.stat-card:hover .stat-bg { transform: rotate(-4deg) scale(1.08); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.stat-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; line-height: 1.3; padding-top: .3rem; color: rgba(255,255,255,.88); }
.stat-icon {
    width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: #fff; background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.3); animation: stat-float 4s ease-in-out infinite;
}
.stat-value { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; text-shadow: 0 2px 10px rgba(0,0,0,.12); font-variant-numeric: tabular-nums; }
.stat-progress { height: 7px; border-radius: 999px; background: rgba(255,255,255,.22); overflow: hidden; margin-top: .35rem; }
.stat-progress > span {
    display: block; height: 100%; border-radius: inherit; transform-origin: left;
    background: linear-gradient(90deg, rgba(255,255,255,.75), #fff);
    box-shadow: 0 0 10px rgba(255,255,255,.6);
    animation: stat-bar 1.2s .35s cubic-bezier(.2,.7,.2,1) both;
}
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .2rem; }
.stat-hint { font-size: .78rem; color: rgba(255,255,255,.85); }
.stat-more {
    font-size: .74rem; font-weight: 700; white-space: nowrap; color: #fff;
    background: rgba(255,255,255,.2); padding: .2rem .6rem; border-radius: 999px;
    opacity: 0; transform: translateX(-6px); transition: opacity .2s, transform .2s;
}
.stat-card.is-link:hover .stat-more, .stat-card.is-link:focus .stat-more { opacity: 1; transform: none; }

/* Palettes */
.tone-green  { --g1: #036b25; --g2: #22c55e; --glow: rgba(4,128,44,.45); }
.tone-yellow { --g1: #d97706; --g2: #f5a623; --glow: rgba(224,138,0,.45); }
.tone-blue   { --g1: #1d4ed8; --g2: #38bdf8; --glow: rgba(37,99,235,.45); }
.tone-purple { --g1: #6d28d9; --g2: #c084fc; --glow: rgba(124,58,237,.45); }
.tone-dark   { --g1: #111827; --g2: #4b5563; --glow: rgba(17,24,39,.45); }
.tone-red    { --g1: #be123c; --g2: #fb7185; --glow: rgba(225,29,72,.45); }

/* Apparition en cascade */
.stats-grid > .stat-card:nth-child(1) { animation-delay: 0s, 0s; }
.stats-grid > .stat-card:nth-child(2) { animation-delay: .07s, -1.5s; }
.stats-grid > .stat-card:nth-child(3) { animation-delay: .14s, -3s; }
.stats-grid > .stat-card:nth-child(4) { animation-delay: .21s, -4.5s; }
.stats-grid > .stat-card:nth-child(5) { animation-delay: .28s, -6s; }
.stats-grid > .stat-card:nth-child(6) { animation-delay: .35s, -7.5s; }

@keyframes stat-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes stat-flow { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes stat-shine { to { transform: translateX(120%); } }
@keyframes stat-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes stat-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
    .stat-card, .stat-icon, .stat-progress > span { animation: none !important; }
    .stat-card:hover::after { animation: none; }
}

.table-x { width: 100%; margin: 0; color: var(--ink); }
.table-x th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-alt); }
.table-x td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover { background: var(--surface-alt); }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.cell-main { font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: .78rem; }
.logo-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--surface-alt); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--brand); flex-shrink: 0; }

.badge-status { display: inline-block; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.bs-success { background: rgba(4,128,44,.12); color: var(--success); }
.bs-warning { background: rgba(255,194,19,.22); color: var(--warning); }
.bs-danger { background: rgba(220,53,69,.12); color: var(--danger); }
.bs-info { background: rgba(13,110,253,.12); color: var(--info); }
.bs-secondary { background: rgba(107,114,128,.14); color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters .form-control, .filters .form-select { width: auto; min-width: 150px; }
.filters .search { min-width: 220px; flex: 1; max-width: 340px; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2rem; opacity: .4; margin-bottom: .6rem; }
.empty-state p { margin: 0 0 .75rem; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.dl-grid dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.dl-grid dd { margin: .15rem 0 0; font-weight: 500; word-break: break-word; }

.credentials { display: flex; flex-wrap: wrap; gap: .5rem 2rem; }
.credentials span { color: var(--muted); font-size: .8rem; margin-right: .5rem; }
.credentials code { font-size: .95rem; background: rgba(0,0,0,.06); padding: .15rem .45rem; border-radius: 6px; color: inherit; }

.list-feed { list-style: none; margin: 0; padding: 0; }
.list-feed li { display: flex; gap: .85rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.list-feed li:last-child { border-bottom: 0; }
.list-feed .feed-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-feed .unread { background: rgba(255,194,19,.08); }
.list-feed time { color: var(--muted); font-size: .76rem; white-space: nowrap; }

.progress-thin { height: 6px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.nav-tabs-x { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.nav-tabs-x a { padding: .65rem 1rem; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-tabs-x a.active { color: var(--brand); border-bottom-color: var(--brand); }

.chart-box { position: relative; height: 280px; }

/* ---------- Bootstrap : harmonisation ---------- */
.btn { border-radius: 9px; font-weight: 500; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1f1f24; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #1f1f24; }
.btn-light { background: var(--surface); border-color: var(--border); color: var(--ink); }
.form-control, .form-select { border-radius: 9px; border-color: var(--border); background-color: var(--surface); color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(4,128,44,.15); background-color: var(--surface); color: var(--ink); }
.form-label { font-weight: 600; font-size: .82rem; margin-bottom: .3rem; }
.text-muted { color: var(--muted) !important; }
.dropdown-menu, .modal-content { background: var(--surface); color: var(--ink); border-color: var(--border); border-radius: var(--radius); }
.dropdown-item { color: var(--ink); }
.dropdown-item:hover { background: var(--surface-alt); color: var(--ink); }
.modal-header, .modal-footer { border-color: var(--border); }
.alert { border-radius: var(--radius); }
.pagination { margin: 0; }
.page-link { color: var(--brand); background: var(--surface); border-color: var(--border); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-item.disabled .page-link { background: var(--surface-alt); border-color: var(--border); }
:root[data-theme="dark"] .btn-close { filter: invert(1); }
:root[data-theme="dark"] .form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ccc' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.card-footer-x { padding: .85rem 1.25rem; border-top: 1px solid var(--border); }

/* ---------- Cases à cocher en "puces" (type de transport) ---------- */
.choice-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-chip { position: relative; cursor: pointer; margin: 0; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip span {
    display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .95rem; border-radius: 999px;
    border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font-weight: 500;
    transition: background .15s, border-color .15s, color .15s, transform .1s; user-select: none;
}
.choice-chip span i { color: var(--muted); transition: color .15s; }
.choice-chip:hover span { border-color: var(--brand); }
.choice-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice-chip input:checked + span i { color: #fff; }
.choice-chip input:checked + span::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .7rem; margin-left: .1rem; }
.choice-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-chip:active span { transform: scale(.97); }
.choice-grid.is-invalid .choice-chip span { border-color: var(--danger); }

/* ---------- Aperçu de notification (annonces) ---------- */
.phone-preview { background: linear-gradient(160deg, #1f2937, #111827); border-radius: 22px; padding: 1.4rem 1rem 2rem; }
.phone-notif { background: rgba(255,255,255,.93); color: #111827; border-radius: 16px; padding: .75rem .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.phone-notif-head { display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: #6b7280; margin-bottom: .3rem; }
.phone-notif-head img { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; background: #fff; }
.phone-notif strong { display: block; font-size: .9rem; }
.phone-notif p { margin: .15rem 0 0; font-size: .85rem; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Messagerie ---------- */
.messenger { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; height: calc(100vh - 140px); min-height: 480px; }
.messenger .card-x + .card-x { margin-top: 0; }
.conv-list { display: flex; flex-direction: column; overflow: hidden; }
.conv-search { position: relative; padding: .85rem; border-bottom: 1px solid var(--border); }
.conv-search i { position: absolute; left: 1.6rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.conv-search input { padding-left: 2.1rem; }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: .7rem; align-items: center; padding: .75rem .9rem; border-bottom: 1px solid var(--border); color: var(--ink) !important; text-decoration: none; }
.conv-item:hover { background: var(--surface-alt); }
.conv-item.active { background: rgba(4,128,44,.08); box-shadow: inset 3px 0 0 var(--brand); }
.conv-item .logo-thumb { width: 42px; height: 42px; border-radius: 50%; }
.conv-text { flex: 1; min-width: 0; }
.conv-text small { color: var(--muted); display: block; }
.conv-text time { color: var(--muted); font-size: .72rem; flex-shrink: 0; }
.conv-item.unread strong, .conv-item.unread small { color: var(--ink); font-weight: 700; }
.conv-badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: .05rem .45rem; flex-shrink: 0; align-self: center; }
.conv-thread { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.conv-single { height: calc(100vh - 140px); min-height: 480px; max-width: 900px; margin: 0 auto; }
.conv-back { display: block; padding: .6rem 1rem; border-bottom: 1px solid var(--border); text-decoration: none; }

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.chat-header .logo-thumb, .chat-header .avatar { width: 42px; height: 42px; border-radius: 50%; }
.chat-live { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chat-live i { color: #22c55e; font-size: .5rem; vertical-align: middle; margin-right: .2rem; animation: te-pulse 2s infinite; }
@keyframes te-pulse { 50% { opacity: .3; } }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; background:
    radial-gradient(circle at 20% 20%, rgba(4,128,44,.04), transparent 40%), var(--surface-alt); }
.chat-empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.chat-empty i { font-size: 2.2rem; opacity: .4; }
.chat-empty p { margin: .6rem 0 0; }
.chat-date { text-align: center; margin: .9rem 0 .6rem; font-size: .72rem; color: var(--muted); }
.chat-date::before, .chat-date::after { content: ''; display: inline-block; width: 40px; height: 1px; background: var(--border); vertical-align: middle; margin: 0 .6rem; }
.chat-msg { display: flex; margin-bottom: .45rem; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble { max-width: min(75%, 560px); padding: .55rem .8rem .4rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.chat-msg.mine .chat-bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-author { display: block; font-size: .72rem; font-weight: 700; color: var(--brand); margin-bottom: .1rem; }
.chat-title { display: block; font-size: .85rem; margin-bottom: .15rem; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.chat-meta { display: block; text-align: right; font-size: .66rem; opacity: .7; margin-top: .15rem; }
.chat-meta i { margin-left: .3rem; }
.chat-msg.mine .chat-meta i.read { color: var(--accent); opacity: 1; }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem .9rem; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 20px; padding: .55rem 1rem; max-height: 160px; background: var(--surface-alt); color: var(--ink); outline: none; line-height: 1.4; }
.chat-form textarea:focus { border-color: var(--brand); }
.chat-form .btn { width: 42px; height: 42px; border-radius: 50%; padding: 0; flex-shrink: 0; }
.chat-hint { font-size: .68rem; color: var(--muted); text-align: right; padding: 0 1rem .5rem; background: var(--surface); }
@media (max-width: 991.98px) {
    .messenger { grid-template-columns: 1fr; height: calc(100vh - 120px); }
    .messenger.has-current .conv-list { display: none; }
    .messenger:not(.has-current) .conv-thread { display: none; }
    .chat-bubble { max-width: 88%; }
    .chat-hint { display: none; }
}

/* ---------- Connexion ---------- */
.login-body { background: linear-gradient(160deg, var(--brand-deep), #1d1d1d); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 2.25rem; box-shadow: 0 25px 60px rgba(0,0,0,.35); }
.login-card .brand { text-align: center; margin-bottom: 1.5rem; }
.login-card .brand img { height: 56px; }
.login-card .brand h1 { font-size: 1.15rem; margin: .9rem 0 .2rem; font-weight: 700; }
.login-card .brand p { color: var(--muted); margin: 0; font-size: .85rem; }
.login-foot { text-align: center; color: rgba(255,255,255,.55); font-size: .78rem; margin-top: 1.25rem; }

@media print {
    .sidebar, .topbar, .page-actions .btn, .filters, .no-print { display: none !important; }
    .main { margin: 0; }
    .card-x { box-shadow: none; }
}

/* ---------- Calendriers et heures (flatpickr) ---------- */
.date-input, .time-input {
    padding-left: 2.4rem !important; cursor: pointer; background-repeat: no-repeat; background-position: .85rem center; background-size: 15px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304802c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='3'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}
.time-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304802c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}
.date-input.active, .time-input.active { border-color: var(--brand); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 18%, transparent); }

.flatpickr-calendar {
    font-family: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 18px 50px rgba(16, 24, 40, .18); width: 316px; padding: 0 0 .25rem; overflow: hidden;
}
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before, .flatpickr-calendar.arrowBottom::after { display: none; }
.flatpickr-calendar.hasTime.noCalendar { width: 200px; }

/* En-tête dégradé vert : mois, année et flèches */
.flatpickr-months { position: relative; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); padding: .55rem .35rem; align-items: center; }
.flatpickr-months .flatpickr-month { color: #fff; fill: #fff; height: 40px; }
.flatpickr-current-month { font-size: 1.02rem; font-weight: 700; padding-top: 8px; }
.flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 700; color: #fff; background: transparent; border-radius: 8px; padding: 2px 4px; }
.flatpickr-current-month .flatpickr-monthDropdown-months:hover, .flatpickr-current-month input.cur-year:hover { background: rgba(255,255,255,.14); }
.flatpickr-current-month .flatpickr-monthDropdown-months option { color: #1f1f24; background: #fff; }
.flatpickr-current-month input.cur-year { font-weight: 700; color: #fff; border-radius: 8px; }
.flatpickr-current-month .numInputWrapper span.arrowUp::after { border-bottom-color: #fff; }
.flatpickr-current-month .numInputWrapper span.arrowDown::after { border-top-color: #fff; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month {
    top: 50% !important; margin-top: -16px !important; height: 32px; width: 32px; padding: 8px; margin: 0 .35rem;
    border-radius: 50%; color: #fff; fill: #fff; display: flex; align-items: center; justify-content: center; transition: background .15s;
    margin-left: .35rem; margin-right: .35rem;
}
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: rgba(255,255,255,.18); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--accent); }

/* Jours */
.flatpickr-innerContainer { padding: .5rem .55rem 0; }
.flatpickr-rContainer, .flatpickr-days, .dayContainer { width: 100%; min-width: 0; max-width: none; }
span.flatpickr-weekday { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.flatpickr-day {
    color: var(--ink); border: 0; border-radius: 10px; max-width: none; height: 38px; line-height: 38px; margin: 1px 0;
    font-weight: 500; transition: background .12s, color .12s;
}
.flatpickr-day:hover, .flatpickr-day:focus { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); border: 0; }
.flatpickr-day.today { border: 0; color: var(--brand); font-weight: 700; position: relative; }
.flatpickr-day.today::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.flatpickr-day.today:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus {
    background: var(--brand); color: #fff; border: 0; font-weight: 700; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 35%, transparent);
}
.flatpickr-day.selected.today::after { background: var(--accent); }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover { color: color-mix(in srgb, var(--muted) 40%, transparent); background: none; cursor: not-allowed; }

/* Boutons Effacer / Aujourd'hui */
.fp-actions { display: flex; justify-content: space-between; gap: .5rem; padding: .55rem .8rem .4rem; border-top: 1px solid var(--border); margin-top: .35rem; }
.fp-actions button { border: 0; border-radius: 8px; padding: .38rem .8rem; font-weight: 600; font-size: .85rem; background: none; color: var(--muted); }
.fp-actions button:hover { background: var(--surface-alt); color: var(--ink); }
.fp-actions button[data-fp="today"] { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.fp-actions button[data-fp="today"]:hover { background: var(--brand); color: #fff; }

/* Sélecteur d'heure */
.flatpickr-time { border-top: 0 !important; height: 52px; max-height: 52px; }
.flatpickr-time input { color: var(--ink); font-weight: 700; font-size: 1.15rem; border-radius: 10px; }
.flatpickr-time input:hover, .flatpickr-time input:focus, .flatpickr-time .flatpickr-am-pm:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.flatpickr-time .flatpickr-time-separator { color: var(--muted); font-weight: 700; }
.flatpickr-time .numInputWrapper span.arrowUp::after { border-bottom-color: var(--brand); }
.flatpickr-time .numInputWrapper span.arrowDown::after { border-top-color: var(--brand); }

:root[data-theme="dark"] .flatpickr-calendar { box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
:root[data-theme="dark"] .flatpickr-day:hover, :root[data-theme="dark"] .flatpickr-day.today { color: #4cc77a; }
:root[data-theme="dark"] .flatpickr-day.selected, :root[data-theme="dark"] .flatpickr-day.selected:hover { color: #fff; }
:root[data-theme="dark"] .fp-actions button[data-fp="today"] { color: #4cc77a; background: rgba(76, 199, 122, .12); }
:root[data-theme="dark"] .fp-actions button[data-fp="today"]:hover { color: #fff; background: var(--brand); }
/* ---------- Fiche publique des compagnies ---------- */
.showcase-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.showcase-photo { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-alt); border: 1px solid var(--border); }
.showcase-photo img { width: 100%; height: 100%; object-fit: cover; }
.showcase-photo form { position: absolute; top: .4rem; right: .4rem; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.service-tile { cursor: pointer; margin: 0; }
.service-tile input { position: absolute; opacity: 0; pointer-events: none; }
.service-tile span {
    display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; border-radius: 12px;
    border: 1px solid var(--border); background: var(--surface); font-weight: 500; transition: all .15s;
}
.service-tile span i { width: 18px; text-align: center; color: var(--muted); }
.service-tile:hover span { border-color: var(--brand); }
.service-tile input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand); font-weight: 700; }
.service-tile input:checked + span i { color: var(--brand); }
.service-tile input:focus-visible + span { box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 25%, transparent); }
.rating-stars { color: #f5b301; letter-spacing: 2px; }