/* =============================================================
   ADM Conseil — Feuille de style globale
   Palette : crème · sauge · terracotta · encre
   Typographie : Fraunces (serif) + Plus Jakarta Sans (sans)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT,WONK@9..144,300..700,0..100,0..1&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --cream: #F4EFE6;
    --cream-soft: #FAF6EE;
    --ink: #1F2421;
    --ink-soft: #3A413D;
    --ink-mute: #6B7068;
    --sage: #6B7F65;
    --sage-deep: #4F6149;
    --terracotta: #C97B5C;
    --rose: #E8C4B0;
    --border: #D9D2C4;
    --border-soft: #E5DFD2;
    --shadow-sm: 0 1px 2px rgba(31,36,33,0.04);
    --shadow: 0 4px 16px rgba(31,36,33,0.06);
    --shadow-lg: 0 12px 40px rgba(31,36,33,0.10);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all .2s ease;
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
/* iOS Safari grossit automatiquement certains textes "trop petits" — on désactive */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
/* Sécurité globale : empêche tout débordement horizontal qui ferait scroller la page entière.
   Si un tableau ou un bloc précis a besoin de scroll horizontal, il le gère lui-même
   (cf .table-card { overflow-x: auto; }). */
html, body { overflow-x: hidden; }
body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ===== Typographie ===== */
.font-display { font-family: var(--font-display); }
.italic { font-style: italic; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }

/* =====================================================================
   PUBLIC NAV
   ===================================================================== */
.public-nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(244, 239, 230, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.public-nav-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    height: 80px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand .logo {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--sage-deep);
    box-shadow: inset 0 0 0 4px var(--cream);
    display: flex; align-items: center; justify-content: center;
}
.brand .logo::after {
    content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--terracotta);
}
.brand-text { line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.brand-name em { font-style: italic; color: var(--sage-deep); font-weight: 500; }
.brand-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--ink-soft); }

.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a {
    font-size: 14px; text-decoration: none; color: var(--ink); position: relative; padding: 4px 0;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%;
    transition: background-size .3s ease, color .2s;
}
.nav-links a:hover { background-size: 100% 1px; }
.nav-links a.active { color: var(--sage-deep); font-weight: 600; }

.btn-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 999px; font-size: 14px;
    text-decoration: none; transition: var(--transition); border: 1px solid var(--ink);
    background: transparent; color: var(--ink); white-space: nowrap;
}
.btn-pill:hover { background: var(--ink); color: var(--cream); }
.btn-pill.primary { background: var(--ink); color: var(--cream); }
.btn-pill.primary:hover { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn-pill.sage { background: var(--sage-deep); color: var(--cream); border-color: var(--sage-deep); }
.btn-pill.sage:hover { background: var(--ink); border-color: var(--ink); }
.btn-pill.cream { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.btn-pill.sm { padding: 6px 14px; font-size: 12px; }

.nav-toggle { display: none; background: none; border: none; padding: 8px; color: var(--ink); }

@media (max-width: 860px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
        position: absolute; top: 80px; left: 0; right: 0;
        background: var(--cream); border-bottom: 1px solid var(--border); padding: 24px;
    }
    .nav-toggle { display: block; }
}

/* =====================================================================
   PUBLIC PAGES — HERO
   ===================================================================== */
main { min-height: 60vh; }
.section { padding: 80px 24px; }
.section-narrow { max-width: 980px; margin: 0 auto; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.hero { position: relative; overflow: hidden; padding: 100px 24px 140px; }
.hero-blob-1 {
    position: absolute; top: -160px; right: -160px;
    width: 600px; height: 600px; border-radius: 50%; background: var(--rose);
    opacity: 0.3; filter: blur(80px); pointer-events: none;
}
.hero-blob-2 {
    position: absolute; top: 50%; left: -120px;
    width: 400px; height: 400px; border-radius: 50%; background: var(--sage);
    opacity: 0.2; filter: blur(80px); pointer-events: none;
}
.hero-grain {
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(31,36,33,0.04) 1px, transparent 1px);
    background-size: 3px 3px; opacity: 0.6; pointer-events: none;
}
.hero-inner { position: relative; max-width: 1280px; margin: 0 auto; }
.hero-eyebrow {
    display: flex; align-items: center; gap: 12px;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.25em;
    color: var(--sage-deep); margin-bottom: 32px;
}
.hero-eyebrow::before { content: ''; display: inline-block; width: 48px; height: 1px; background: var(--sage-deep); }
.hero h1 {
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    line-height: 1.02; letter-spacing: -0.02em; max-width: 14ch;
}
.hero h1 .accent { color: var(--sage-deep); font-style: italic; }
.hero h1 .accent-warm { color: var(--terracotta); font-style: italic; }
.hero h1 .muted { color: var(--ink-soft); }
.hero p.lead {
    margin: 40px 0 0; max-width: 38rem; font-size: 18px; line-height: 1.6; color: var(--ink-soft);
}
.hero-actions { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 16px; }
.hero-actions .btn-pill { padding: 14px 28px; }

.hero-stats { margin-top: 80px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; max-width: 760px; }
.hero-stat .num { font-family: var(--font-display); font-size: clamp(1.75rem, 3vw, 2.5rem); color: var(--sage-deep); line-height: 1; }
.hero-stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-top: 8px; }
@media (max-width: 640px) { .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 24px 32px; } }

/* ===== Sections ===== */
.section-tinted { background: var(--cream-soft); border-top: 1px solid var(--border); }
.section-eyebrow {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.25em;
    color: var(--sage-deep); margin-bottom: 24px;
}
.section h2 { font-size: clamp(2rem, 4vw, 3rem); }

.split { display: grid; grid-template-columns: 1fr; gap: 48px; }
@media (min-width: 900px) { .split { grid-template-columns: 5fr 7fr; gap: 80px; } }

.cards-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 700px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }

.card {
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .icon-bubble {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--sage-deep); color: var(--cream);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; font-size: 18px;
}
.card h3 { font-size: 22px; margin-bottom: 8px; }
.card p { font-size: 14px; color: var(--ink-soft); margin: 0; }
.card .tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.card .tag {
    font-size: 11px; padding: 4px 10px; border-radius: 999px;
    background: var(--cream-soft); border: 1px solid var(--border); color: var(--ink-soft);
}

/* ===== Process numbered ===== */
.process-grid { display: grid; grid-template-columns: 1fr; gap: 40px; }
@media (min-width: 800px) { .process-grid { grid-template-columns: repeat(3, 1fr); gap: 56px; } }
.process-num {
    font-family: var(--font-display);
    font-size: 64px; line-height: 1; color: transparent;
    -webkit-text-stroke: 1px var(--sage-deep); margin-bottom: 12px;
}
.process-step h3 { font-size: 22px; margin-bottom: 12px; }
.process-step p { color: var(--ink-soft); margin: 0; }

/* ===== Testimonial ===== */
.section-dark {
    background: var(--ink); color: var(--cream); padding: 100px 24px;
    position: relative; overflow: hidden;
}
.testimonial { max-width: 760px; margin: 0 auto; text-align: center; position: relative; }
.testimonial .quote-mark {
    font-family: var(--font-display); font-size: 96px; line-height: 1;
    color: var(--terracotta); margin-bottom: 16px;
}
.testimonial blockquote {
    font-family: var(--font-display); font-style: italic; margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.3; margin-bottom: 32px;
}
.testimonial .author { display: flex; align-items: center; justify-content: center; gap: 12px; }
.testimonial .author-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--terracotta); color: var(--ink);
    font-family: var(--font-display); font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}
.testimonial .author-info { text-align: left; }
.testimonial .author-info .name { font-weight: 500; }
.testimonial .author-info .meta { font-size: 12px; opacity: 0.7; }

/* ===== CTA Banner ===== */
.cta-banner {
    background: var(--sage-deep); color: var(--cream);
    border-radius: 28px; padding: 80px 40px; text-align: center;
    position: relative; overflow: hidden; max-width: 1080px; margin: 0 auto;
}
.cta-banner::after {
    content: ''; position: absolute; bottom: -80px; right: -80px;
    width: 280px; height: 280px; border-radius: 50%;
    background: var(--terracotta); opacity: 0.2;
}
.cta-banner h2 { position: relative; font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 20px; }
.cta-banner p { position: relative; font-size: 18px; opacity: 0.9; max-width: 32rem; margin: 0 auto 36px; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer {
    background: var(--ink); color: var(--cream);
    padding: 80px 24px 40px; border-top: 1px solid var(--border);
}
.site-footer .container { max-width: 1280px; margin: 0 auto; }
.footer-cols {
    display: grid; grid-template-columns: 1fr; gap: 40px;
    padding-bottom: 56px;
}
@media (min-width: 800px) { .footer-cols { grid-template-columns: 5fr 3fr 4fr; } }
.footer-cols .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.5; margin-bottom: 16px; }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols ul li { margin-bottom: 8px; font-size: 14px; opacity: 0.8; }
.footer-cols ul li a { text-decoration: none; }
.footer-cols ul li a:hover { opacity: 1; }
.footer-bottom {
    padding-top: 32px; border-top: 1px solid rgba(244,239,230,0.15);
    font-size: 12px; opacity: 0.6;
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.footer-bottom a { text-decoration: none; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.footer-brand .logo {
    width: 36px; height: 36px; border-radius: 50%; background: var(--cream);
    display: flex; align-items: center; justify-content: center;
}
.footer-brand .logo::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--terracotta); }
.footer-brand .name { font-family: var(--font-display); font-size: 20px; }
.footer-brand .name em { font-style: italic; }
.footer-cols p { opacity: 0.7; font-size: 14px; max-width: 28rem; margin: 0; }

/* =====================================================================
   FORMULAIRES (publics & internes)
   ===================================================================== */
.field { display: block; margin-bottom: 20px; }
.field-label {
    display: block; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 8px;
}
.input, .textarea, .select {
    width: 100%; max-width: 100%; padding: 12px 16px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--cream);
    color: var(--ink); font-family: inherit; font-size: 15px;
    box-sizing: border-box;
    transition: var(--transition);
}
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--sage-deep);
    box-shadow: 0 0 0 3px rgba(107,127,101,0.2);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .form-row.cols-2 { grid-template-columns: repeat(2, 1fr); } }

/* ===== Contact Page ===== */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 48px; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 5fr 7fr; gap: 80px; } }
.contact-info-list { margin-top: 48px; display: flex; flex-direction: column; gap: 24px; }
.contact-info-item { display: flex; gap: 16px; align-items: flex-start; }
.contact-info-item .icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--cream); border: 1px solid var(--border);
    color: var(--sage-deep);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.contact-info-item .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 4px; }
.contact-info-item .value { font-size: 16px; color: var(--ink); }

.contact-form-card {
    background: var(--cream-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
}

/* =====================================================================
   FLASH MESSAGES
   ===================================================================== */
.flash-stack { margin-bottom: 24px; }
.flash {
    padding: 14px 18px; border-radius: 10px; margin-bottom: 12px; font-size: 14px;
    border: 1px solid transparent;
}
.flash-success { background: #E8F0E5; color: var(--sage-deep); border-color: #C7DBC1; }
.flash-error   { background: #FBEAE2; color: #8E4730; border-color: #F1C9B7; }
.flash-info    { background: var(--cream-soft); color: var(--ink-soft); border-color: var(--border); }
.flash-warning { background: #FBF1DD; color: #8a6a1f; border-color: #EFD9A8; }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.login-wrap {
    min-height: calc(100vh - 80px);
    display: flex; align-items: center; justify-content: center;
    padding: 60px 24px;
}
.login-card {
    background: var(--cream-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px; max-width: 420px; width: 100%;
}
.login-card h1 { font-family: var(--font-display); font-size: 28px; margin-bottom: 6px; }
.login-card .sub { font-size: 14px; color: var(--ink-soft); margin-bottom: 28px; }
.login-card .row { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 20px; font-size: 12px; color: var(--ink-soft); }
.login-card .row a { color: var(--sage-deep); text-decoration: underline; }
.login-card button[type=submit] { width: 100%; justify-content: center; }

/* =====================================================================
   APP LAYOUT (espace client + admin)
   ===================================================================== */
.app-shell {
    display: grid; grid-template-columns: 260px 1fr;
    min-height: 100vh; background: var(--cream-soft);
}
@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        /* Row 1 : mobile bar (auto), row 2 : app-main fills remaining (1fr).
           Sans cette règle, le grid laisse l'espace libre flotter et le contenu
           se positionne mal sur les pages avec peu de contenu (factures, mail, etc.) */
        grid-template-rows: auto 1fr;
    }
    .app-mobile-bar { grid-row: 1; }
    .app-main { grid-row: 2; }
}

/* ===== Sidebar ===== */
.sidebar {
    background: var(--cream);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 0;
}
.sidebar.dark { background: var(--ink); color: var(--cream); border-right: none; }
.sidebar.dark .side-link { color: rgba(244,239,230,0.7); }
.sidebar.dark .side-link.active { background: rgba(244,239,230,0.08); color: var(--cream); }
.sidebar.dark .side-link:hover { background: rgba(244,239,230,0.04); }
.sidebar.dark .side-brand .logo { background: var(--cream); }
.sidebar.dark .side-brand .name { color: var(--cream); }
.sidebar.dark .side-foot { border-top: 1px solid rgba(244,239,230,0.15); }
.sidebar.dark .side-foot button { border-color: rgba(244,239,230,0.2); color: var(--cream); }

.side-brand {
    display: flex; align-items: center; gap: 10px; padding: 22px 20px;
}
.side-brand .logo {
    width: 36px; height: 36px; border-radius: 50%; background: var(--sage-deep);
    box-shadow: inset 0 0 0 4px var(--cream);
    display: flex; align-items: center; justify-content: center;
}
.side-brand .logo::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--terracotta); }
.side-brand .name { font-family: var(--font-display); font-size: 18px; }
.side-brand .name em { font-style: italic; color: var(--sage-deep); }
.side-brand .role { font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.7; margin-top: 2px; }

.side-nav { flex: 1; padding: 12px; }
.side-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--ink); text-decoration: none; font-size: 14px;
    margin-bottom: 2px; transition: var(--transition);
    border: none; background: transparent; width: 100%; text-align: left; font-family: inherit;
}
.side-link:hover { background: var(--cream-soft); }
.side-link.active { background: var(--cream-soft); color: var(--sage-deep); font-weight: 500; }
.side-link .badge {
    margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 999px;
    background: var(--sage-deep); color: var(--cream);
}
.side-link svg { flex-shrink: 0; }

.side-foot { padding: 16px; border-top: 1px solid var(--border); }
.user-card {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.user-card .avatar {
    width: 38px; height: 38px; border-radius: 50%; background: var(--sage-deep); color: var(--cream);
    display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px;
    flex-shrink: 0;
}
.user-card .info { min-width: 0; }
.user-card .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .email { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .logout-btn {
    width: 100%; padding: 8px; border-radius: 10px; background: transparent;
    border: 1px solid var(--border); color: var(--ink-soft); font-size: 12px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    text-decoration: none; transition: var(--transition);
}
.side-foot .logout-btn:hover { background: var(--cream-soft); }

/* ===== App main ===== */
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    height: 72px; padding: 0 32px;
    background: var(--cream); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.topbar-title .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-soft); }
.topbar-title h1 { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.app-content { padding: 32px; flex: 1; min-width: 0; }
@media (max-width: 700px) { .app-content { padding: 20px; } }

/* ===== Mobile header (cachée sur desktop) ===== */
.app-mobile-bar {
    display: none;
    height: 60px; padding: 0 16px;
    background: var(--cream); border-bottom: 1px solid var(--border);
    align-items: center; justify-content: space-between;
}
.app-mobile-bar a { text-decoration: none; color: var(--ink); font-size: 13px; }
@media (max-width: 900px) {
    .sidebar { display: none; }
    .sidebar.open {
        display: flex; position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 100;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .app-mobile-bar { display: flex; }
    .app-content { padding: 20px; }
    .app-topbar { padding: 0 16px; height: 64px; }
}

/* ===== Stat cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.stat-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.stat-card .val { font-family: var(--font-display); font-size: 28px; }
.stat-card.accent-sage .icn { color: var(--sage-deep); }
.stat-card.accent-warm .icn { color: var(--terracotta); }

/* ===== Section heading inside app ===== */
.app-section-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.app-section-head h2 { font-family: var(--font-display); font-size: 22px; }

/* ===== List rows (dossiers, clients) ===== */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
    display: flex; align-items: center; gap: 18px;
    text-decoration: none; color: inherit;
    transition: var(--transition);
}
.row-item:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); }
.row-item .icon-square {
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--cream-soft); color: var(--sage-deep);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.row-item .body { flex: 1; min-width: 0; }
.row-item .body .top { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.row-item .body .title { font-weight: 500; color: var(--ink); }
.row-item .body .desc { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .body .meta { font-size: 11px; color: var(--ink-soft); display: flex; gap: 12px; flex-wrap: wrap; }
.row-item .chevron { color: var(--ink-soft); flex-shrink: 0; }

/* ===== Status badges ===== */
.badge {
    display: inline-flex; align-items: center;
    font-size: 10px; padding: 4px 10px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.badge-en_cours, .badge-actif { background: var(--sage-deep); color: var(--cream); }
.badge-en_attente, .badge-nouveau { background: var(--terracotta); color: var(--cream); }
.badge-cloture, .badge-suspended { background: var(--cream-soft); color: var(--ink-soft); border: 1px solid var(--border); }

/* ===== Table ===== */
.table-card {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 18px; text-align: left; }
@media (max-width: 700px) {
    .table th, .table td { padding: 10px 12px; font-size: 13px; }
    /* Évite le wrap vertical inutile sur les cellules monétaires/numériques */
    .table .actions, .table td:first-child { white-space: nowrap; }
}
.table thead {
    background: var(--cream-soft); border-bottom: 1px solid var(--border);
}
.table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--ink-soft); font-weight: 500;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--cream-soft); }
.table tbody tr.clickable { cursor: pointer; }
.table .avatar-cell { display: flex; align-items: center; gap: 12px; }
.table .avatar-sm {
    width: 36px; height: 36px; border-radius: 50%; background: var(--sage-deep); color: var(--cream);
    display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px;
    flex-shrink: 0;
}
.table .actions { text-align: right; white-space: nowrap; }
.table .icon-btn {
    background: transparent; border: 1px solid var(--border); color: var(--ink-soft);
    padding: 6px 10px; border-radius: 8px; font-size: 12px; text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px; margin-left: 6px;
}
.table .icon-btn:hover { background: var(--cream-soft); }
.table .icon-btn.danger { color: var(--terracotta); border-color: var(--rose); }
.table .icon-btn.danger:hover { background: var(--rose); color: var(--ink); }

@media (max-width: 700px) {
    .table th, .table td { padding: 10px 12px; font-size: 13px; }
    .hide-sm { display: none; }
}

/* ===== Detail page (dossier) ===== */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 2fr 1fr; gap: 24px; } }
/* Empêche les colonnes du grid de déborder à cause du contenu (ex : input file iOS) */
.detail-grid > * { min-width: 0; }
.detail-card {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px;
    overflow-wrap: break-word; word-break: break-word; min-width: 0;
}
.detail-card .small-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--sage-deep); margin-bottom: 8px; }
.detail-card h1 { font-family: var(--font-display); font-size: 28px; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--border); }
.detail-meta .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 4px; }
.detail-meta .val { font-size: 14px; font-weight: 500; }

/* ===== Documents list ===== */
.doc-list {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.doc-row {
    display: flex; align-items: center; gap: 16px; padding: 14px 18px;
    border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--cream-soft); }
.doc-row .doc-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--cream-soft); color: var(--sage-deep);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-row .doc-info { flex: 1; min-width: 0; }
/* Filename qui peut être très long (ex: documents générés avec _doc_290_20260504...).
   On force le wrap "anywhere" pour qu'il se coupe au caractère plutôt que pousser la page.
   IMPORTANT : le filename DOIT être dans un <span class="filename"> pour que ces règles
   s'appliquent (les text nodes anonymes ne sont pas stylable). */
.doc-row .doc-name {
    font-size: 14px; font-weight: 500;
    min-width: 0;
}
.doc-row .doc-name .filename {
    overflow-wrap: anywhere; word-break: break-word; min-width: 0;
    flex: 1 1 auto;
}
.doc-row .doc-meta { font-size: 11px; color: var(--ink-soft); overflow-wrap: anywhere; word-break: break-word; }
/* Sur mobile, on force le doc-name à passer en bloc pour que le filename wrap
   naturellement (l'inline-style display:flex est neutralisé par !important).
   Le badge apparaît alors inline après le filename, ce qui est OK visuellement. */
@media (max-width: 700px) {
    .doc-row .doc-name {
        display: block !important;
        overflow-wrap: anywhere; word-break: break-word;
    }
    .doc-row .doc-name .filename { display: inline; }
    .doc-row .doc-name span:not(.filename) {
        display: inline-block; margin-left: 4px; vertical-align: middle;
    }
}

/* ===== Timeline ===== */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.timeline-item { display: flex; gap: 12px; position: relative; }
.timeline-item::before {
    content: ''; position: absolute; left: 5px; top: 16px; bottom: -22px;
    width: 1px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    width: 12px; height: 12px; border-radius: 50%; margin-top: 4px;
    background: var(--sage-deep); flex-shrink: 0; position: relative; z-index: 1;
}
.timeline-dot.warm { background: var(--terracotta); }
.timeline-dot.mute { background: var(--ink-mute); }
.timeline-content .time { font-size: 11px; color: var(--ink-soft); margin-bottom: 2px; }
.timeline-content .text { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
.timeline-content { min-width: 0; flex: 1; }
/* Liens "pill" dans le suivi (pour les filenames cliquables) — autorise le wrap */
.timeline-content a { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
/* Le span filename DOIT pouvoir shrinker en flex */
.suivi-doc-link .filename {
    overflow-wrap: anywhere; word-break: break-word; min-width: 0;
    flex: 1 1 auto;
}

/* ===== Upload zone ===== */
.upload-zone {
    background: var(--cream); border: 2px dashed var(--border);
    border-radius: var(--radius); padding: 40px 24px;
    text-align: center; color: var(--ink-soft);
}
.upload-zone input[type=file] { margin-top: 12px; }

/* ===== Search ===== */
.search-inline {
    display: flex; align-items: center; gap: 8px;
    background: var(--cream); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 14px; max-width: 380px;
}
.search-inline input { background: transparent; border: none; outline: none; flex: 1; font-family: inherit; font-size: 14px; color: var(--ink); }
.search-inline.full { width: 100%; max-width: none; }

/* ===== Buttons (forms) ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px;
    border: 1px solid var(--ink); background: var(--ink); color: var(--cream);
    font-size: 14px; cursor: pointer; text-decoration: none; transition: var(--transition);
    font-family: inherit;
}
.btn:hover { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn.sage { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn.sage:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--cream); }
.btn.danger { background: var(--terracotta); border-color: var(--terracotta); }
.btn.danger:hover { background: #a35e43; border-color: #a35e43; }
.btn.sm { padding: 8px 16px; font-size: 13px; }

/* ===== Pure utility ===== */
.spacer { height: 24px; }
.text-muted { color: var(--ink-soft); }
.text-small { font-size: 13px; }
.text-center { text-align: center; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--ink-soft); text-decoration: none; margin-bottom: 24px;
}
.back-link:hover { color: var(--ink); }

/* ===== Empty state ===== */
.empty {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 60px 24px;
    text-align: center; color: var(--ink-soft);
}
.empty h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; color: var(--ink); }
.empty p { margin: 0 0 20px; }

/* ===== Modal-ish form card ===== */
.form-card {
    background: var(--cream); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px; max-width: 720px;
    overflow-wrap: break-word; word-break: break-word; min-width: 0;
}
/* Espacement automatique entre form-card empilés (reminders, letter_templates, etc.) */
.form-card + .form-card { margin-top: 16px; }
.form-card h2 { font-family: var(--font-display); font-size: 22px; margin-bottom: 20px; }

/* Mobile : padding réduit pour éviter que les form-card et detail-card débordent */
@media (max-width: 700px) {
    .form-card, .detail-card { padding: 20px; }
    /* Les <input type="file"> iOS ont une largeur native qui peut pousser le parent → on contraint */
    input[type=file] { max-width: 100%; box-sizing: border-box; }
}

/* ===== Responsive helpers ===== */
@media (max-width: 700px) {
    .hero { padding: 60px 20px 80px; }
    .section { padding: 56px 20px; }
    .public-nav-inner { padding: 0 16px; }
    .cta-banner { padding: 48px 24px; }
}

/* ===== Animations ===== */
.fade-up { animation: fadeUp .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .15s; }
.delay-3 { animation-delay: .25s; }
.delay-4 { animation-delay: .35s; }

/* =====================================================================
   CHAT / MESSAGERIE
   ===================================================================== */
.chat-thread {
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 320px;
}
.chat-day-sep {
    text-align: center;
    margin: 12px 0 4px;
    position: relative;
}
.chat-day-sep::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px; background: var(--border);
    z-index: 0;
}
.chat-day-sep span {
    position: relative;
    background: var(--cream);
    padding: 0 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
}
.chat-bubble-row {
    display: flex;
    width: 100%;
}
.chat-bubble-row.me {
    justify-content: flex-end;
}
.chat-bubble-row.them {
    justify-content: flex-start;
}
.chat-bubble {
    max-width: 76%;
    padding: 12px 16px 8px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}
.chat-bubble-row.me .chat-bubble {
    background: var(--sage-deep);
    color: var(--cream);
    border-bottom-right-radius: 6px;
}
.chat-bubble-row.them .chat-bubble {
    background: var(--cream-soft);
    color: var(--ink);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}
.chat-content { white-space: pre-wrap; }
.chat-meta {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}
.chat-bubble-row.them .chat-meta { color: var(--ink-soft); }

.chat-composer {
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-composer textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    resize: none;
    line-height: 1.5;
    min-height: 50px;
}
.chat-composer button[type="submit"] {
    align-self: flex-end;
}
.chat-composer > div:last-child {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Bouton "joindre un fichier" */
.chat-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--cream-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: var(--transition);
}
.chat-attach-btn:hover { background: var(--cream); color: var(--ink); }
.chat-attach-btn input[type="file"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Pièces jointes dans les bulles */
.chat-image-link {
    display: block;
    margin-top: 6px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 280px;
}
.chat-image-link img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: cover;
}

.chat-file {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: var(--transition);
    min-width: 220px;
}
.chat-bubble-row.me .chat-file {
    background: rgba(244, 239, 230, 0.15);
    color: var(--cream);
    border: 1px solid rgba(244, 239, 230, 0.25);
}
.chat-bubble-row.me .chat-file:hover { background: rgba(244, 239, 230, 0.25); }
.chat-bubble-row.them .chat-file {
    background: var(--cream);
    border: 1px solid var(--border);
    color: var(--ink);
}
.chat-bubble-row.them .chat-file:hover { background: var(--cream-soft); }

.chat-file-icon { flex-shrink: 0; opacity: 0.85; }
.chat-file-info { flex: 1; min-width: 0; line-height: 1.3; }
.chat-file-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-file-size {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
}
.chat-file-dl { flex-shrink: 0; opacity: 0.7; }

/* ===== Emoji picker ===== */
.chat-emoji-wrap {
    position: relative;
    display: inline-flex;
}
.chat-emoji-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--cream-soft);
    border: 1px solid var(--border);
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
}
.chat-emoji-btn:hover {
    background: var(--cream);
    color: var(--sage-deep);
    border-color: var(--sage-deep);
}
.emoji-panel {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 296px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.emoji-panel.open { display: grid; }
.emoji-item {
    background: transparent;
    border: none;
    width: 100%; aspect-ratio: 1;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.emoji-item:hover, .emoji-item:focus {
    background: var(--cream-soft);
    outline: none;
}
@media (max-width: 480px) {
    .emoji-panel {
        width: 88vw;
        right: -4px;
        grid-template-columns: repeat(8, 1fr);
    }
}

/* =====================================================================
   IMPRESSION — Cache tout le shell de navigation pour ne garder que
   le contenu principal (utile pour /devis.php qui est une vraie page web
   et non un template standalone comme invoice_pdf.php).
   ===================================================================== */
@media print {
    /* Public site — header + footer + nav */
    .public-nav, .site-footer { display: none !important; }
    /* Client app — sidebar, mobile bar, topbar */
    .sidebar, .app-mobile-bar, .app-topbar { display: none !important; }
    /* On reset le shell en bloc pour que main prenne toute la page */
    .app-shell {
        display: block !important;
        min-height: 0 !important;
        background: white !important;
    }
    .app-main { display: block !important; }
    .app-content { padding: 0 !important; }
    /* Fond blanc partout pour économiser l'encre */
    body, main, .app-shell, .app-main, .app-content { background: white !important; }
    /* Forcer les couleurs à s'imprimer correctement (sinon Safari les affadit) */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
