/* ===================================================
   SafeSend - Stylesheet principale
   Design : sobre, professionnel, confiance
   =================================================== */

:root { /* SS_APP_SKIN */
    /* Palette SafeSend (extraite du logo officiel) */
    --brand: #2A5F87;          /* Bleu intermédiaire (dégradé enveloppe) */
    --brand-dark: #1A3A52;     /* Bleu marine profond ("Safe", bouclier) */
    --brand-deep: #0F2940;     /* Bleu très profond pour fonds sombres */
    --brand-light: #4A8AB5;    /* Bleu clair (touches lumineuses) */
    --accent: #5FA8A3;         /* Turquoise ("Send", lignes mouvement) */
    --accent-dark: #4A8F8A;    /* Turquoise foncé pour hover */
    --accent-light: #8CC5C2;   /* Turquoise clair pour highlights */

    --bg: #F4F8FA;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* =============== Navigation =============== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(8px);
    background-color: rgba(255, 255, 255, 0.95);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--brand);
    letter-spacing: -0.01em;
}

.nav-brand .lock-icon {
    width: 32px; height: 32px;
    background: var(--brand);
    color: white;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14.5px;
}
.nav-links a:hover { color: var(--brand); background: var(--surface-2); }
.nav-links a.active { color: var(--brand); background: var(--info-bg); }

.nav-cta { display: flex; gap: 10px; }

/* =============== Boutons =============== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14.5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); color: white; box-shadow: var(--shadow); }
.btn-accent  { background: var(--accent); color: white; }
.btn-accent:hover  { background: var(--accent-dark); color: white; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--brand); background: var(--surface-2); }
.btn-ghost   { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* =============== Alertes =============== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border-left: 4px solid;
    font-size: 14.5px;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: #065f46; }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: #92400e; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: #1e40af; }

/* =============== Formulaires =============== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.form-label small { font-weight: 400; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14.5px;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11, 59, 92, 0.12);
}
.form-control::placeholder { color: var(--text-subtle); }
textarea.form-control { resize: vertical; min-height: 100px; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-help { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* =============== Cards =============== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.card-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* =============== Layouts app =============== */
.app-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 20px;
    font-weight: 700;
    font-size: 18px;
    color: var(--brand);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a.active { background: var(--brand); color: white; }
.sidebar-nav a .icon { width: 18px; display: inline-flex; justify-content: center; }
.sidebar-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); padding: 18px 14px 8px; }

.main-content { padding: 32px 40px; max-width: 100%; overflow-x: hidden; min-width: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-muted); margin-top: 4px; font-size: 14.5px; }

/* =============== Tables =============== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }

/* =============== Badges =============== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: #065f46; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #1e40af; }
.badge-muted   { background: var(--surface-2);  color: var(--text-muted); }

/* =============== Stats tiles =============== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-family: var(--font-display); }
.stat-trend { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.stat-icon { position: absolute; top: 20px; right: 20px; font-size: 24px; opacity: 0.3; }

/* =============== Folder / file icons =============== */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.folder-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: center;
    transition: all .15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.folder-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--brand); color: inherit; }
.folder-icon { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: white; font-size: 20px; flex-shrink: 0; }
.folder-name { font-weight: 600; font-size: 15px; }
.folder-count { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* =============== Modals =============== */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-close { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

/* =============== Page d'accueil / marketing =============== */
.hero {
    padding: 100px 0 80px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(20, 184, 166, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    pointer-events: none;
}
.hero-content { position: relative; max-width: 780px; }
.hero-eyebrow {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: 52px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}
.hero h1 .highlight { color: var(--accent); font-style: italic; }
.hero p { font-size: 18px; color: rgba(255, 255, 255, 0.85); margin-bottom: 32px; line-height: 1.6; max-width: 640px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

.section { padding: 80px 0; }
.section-header { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-eyebrow { color: var(--accent-dark); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; margin-bottom: 12px; }
.section-title { font-family: var(--font-display); font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 14px; }
.section-subtitle { font-size: 17px; color: var(--text-muted); }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: all .2s; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--info-bg); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 18px; }
.feature-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.feature-text { color: var(--text-muted); font-size: 14.5px; line-height: 1.65; }

.section-alt { background: var(--surface-2); }

.cta-band { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%); color: white; padding: 72px 0; text-align: center; position: relative; }
.cta-band h2 { font-family: var(--font-display); font-size: 34px; margin-bottom: 14px; letter-spacing: -0.02em; }
.cta-band p { color: rgba(255, 255, 255, 0.85); font-size: 17px; margin-bottom: 28px; max-width: 560px; margin-left: auto; margin-right: auto; }

.footer { background: var(--text); color: rgba(255, 255, 255, 0.7); padding: 48px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
.footer h4 { color: white; font-size: 14px; margin-bottom: 14px; letter-spacing: 0.02em; }
.footer a { color: rgba(255, 255, 255, 0.6); display: block; padding: 3px 0; font-size: 14px; }
.footer a:hover { color: white; }
.footer-bottom { padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 13px; text-align: center; }

/* =============== Pricing =============== */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; align-items: stretch; }
.pricing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    position: relative;
}
.pricing-card.featured { border-color: var(--brand); border-width: 2px; transform: scale(1.02); }
.pricing-card.featured::before {
    content: 'RECOMMANDÉ';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand);
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.pricing-name { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pricing-amount { font-family: var(--font-display); font-size: 40px; font-weight: 700; margin: 12px 0; letter-spacing: -0.02em; }
.pricing-amount .period { font-size: 15px; color: var(--text-muted); font-family: var(--font-sans); font-weight: 500; }
.pricing-features { list-style: none; margin: 20px 0; flex: 1; }
.pricing-features li { padding: 8px 0; font-size: 14.5px; display: flex; gap: 10px; align-items: flex-start; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* =============== Login pages =============== */
.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-pane {
    padding: 40px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--surface);
}
.auth-visual {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: white;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(20, 184, 166, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
}
.auth-visual-content { position: relative; max-width: 440px; }
.auth-visual h2 { font-family: var(--font-display); font-size: 40px; line-height: 1.15; margin-bottom: 16px; }
.auth-visual p { font-size: 16px; line-height: 1.7; color: rgba(255, 255, 255, 0.85); }
.auth-form-wrap { max-width: 420px; width: 100%; margin: 0 auto; }
.auth-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-sub { color: var(--text-muted); margin-bottom: 28px; font-size: 14.5px; }
/* v67 — sélecteur séparés */
.portal-tabs { display: flex; gap: 10px; margin-bottom: 24px; }
.portal-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; text-align: center; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13.5px; font-weight: 500; color: var(--text-muted); background: var(--surface); cursor: pointer; transition: border-color .15s, color .15s, box-shadow .15s, background .15s; }
.portal-tab:hover { border-color: var(--text-subtle); color: var(--text); }
.portal-tab.active { border-color: var(--brand-deep); color: var(--brand-deep); background: #f7fafc; box-shadow: inset 0 0 0 1px var(--brand-deep); font-weight: 600; }

/* =============== Responsive =============== */
@media (max-width: 960px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .sidebar-nav { flex-direction: row; overflow-x: auto; flex-wrap: nowrap; }
    .sidebar-section { display: none; }
    .main-content { padding: 24px 20px; }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .hero h1 { font-size: 38px; }
    .section-title { font-size: 28px; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .nav-links { display: none; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero { padding: 60px 0 50px; }
}

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeInUp 0.4s ease-out; }

/* Share link box */
.share-result {
    background: var(--info-bg);
    border: 1px solid var(--info);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    word-break: break-all;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 13px;
}

/* ============================================================
   v63 — Refonte visuelle (header blanc par défaut + style assagi)
   Ajouté en fin de fichier : surcharge volontairement les règles
   précédentes par ordre de cascade. Le bloc <style> du layout
   (branding perso) reste prioritaire via !important quand présent.
   ============================================================ */

/* -- Palette assagie -- */
:root {
    --accent: #0E8C82;          /* teal désaturé (était #14B8A6) */
    --accent-dark: #0B6F67;
    --accent-light: #8CC5C2;
    --radius: 7px;
    --radius-sm: 5px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* -- Boutons : primary marine profond mat -- */
.btn-primary { background: var(--brand-deep); color: #fff; }
.btn-primary:hover { background: #0b2236; color: #fff; box-shadow: none; }
.btn-outline { background: #fff; color: var(--brand-deep); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: #fff; }

/* -- Header BLANC par défaut (si pas de branding perso) -- */
.app-topbar {
    height: 64px;
    background: #fff;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    position: relative;
    z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 14px; }
/* logo SANS carré blanc : transparent, juste contraint en taille */
.app-topbar .topbar-brand img {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    max-height: 38px;
    max-width: 190px;
    display: block;
}
.topbar-brand-text { display: flex; flex-direction: column; gap: 1px; }
.topbar-brand-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
    color: var(--text-subtle); font-weight: 600; opacity: 1;
}
.topbar-brand-name { font-size: 15px; font-weight: 600; line-height: 1.15; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar-user { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; line-height: 1.3; }
.topbar-user-label {
    color: var(--text-subtle); text-transform: uppercase;
    font-size: 10px; letter-spacing: .08em; font-weight: 600; opacity: 1;
}
.topbar-user-name { font-weight: 500; font-size: 13px; color: var(--text-muted); }
.topbar-logout {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 13px;
    background: #fff; color: var(--text-muted);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    font-size: 13px; font-weight: 500; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.topbar-logout:hover { background: var(--surface-2); border-color: var(--text-subtle); color: var(--text); }

/* body en colonne (repris du layout pour le cas header blanc) */
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; }
/* .app-layout flex retiré : écrasait la grille (display:grid ligne 205) */

/* -- Sidebar : item actif en marine deep (cohérent avec primary) -- */
.sidebar-nav a.active { background: var(--brand-deep); color: #fff; }

/* -- Cartes : ombres plus discrètes -- */
.card, .table-wrap, .folder-card { box-shadow: var(--shadow-sm); }
.folder-card:hover { transform: none; box-shadow: var(--shadow); border-color: var(--brand); }

/* -- Mobile -- */
@media (max-width: 760px) {
    .app-topbar { height: 56px; padding: 0 16px; }
    .app-topbar .topbar-brand img { max-height: 30px; max-width: 130px; }
    .topbar-brand-text { display: none; }
    .topbar-user { display: none; }
}
/* v66 — Logo cliquable */

/* v66 — Logo cliquable vers l'accueil */
.topbar-logo-link { display:inline-flex; align-items:center; text-decoration:none; cursor:pointer; transition:opacity .15s; }
.topbar-logo-link:hover { opacity:.8; }


/* ============================================================
   === MOBILE v1 === (n'affecte que les petits écrans)
   ============================================================ */

/* Burger : masqué sur desktop */
.nav-burger { display: none; }
.nav-mobile { display: none; }

@media (max-width: 860px) {
    /* Navigation publique : burger + panneau */
    .nav-links { display: none; }
    .nav-cta { display: none; }

    .nav-burger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 42px; height: 42px;
        padding: 0 9px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        cursor: pointer;
    }
    .nav-burger span {
        display: block; height: 2px; width: 100%;
        background: var(--text-muted); border-radius: 2px;
        transition: transform .18s ease, opacity .18s ease;
    }
    .nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-burger.open span:nth-child(2) { opacity: 0; }
    .nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .navbar-inner { position: relative; flex-wrap: wrap; }

    .nav-mobile {
        display: none;
        width: 100%;
        order: 10;
        flex-direction: column;
        gap: 2px;
        padding: 10px 0 14px;
        border-top: 1px solid var(--border);
        margin-top: 12px;
    }
    .nav-mobile.open { display: flex; }
    .nav-mobile a {
        color: var(--text-muted);
        padding: 12px 10px;
        border-radius: var(--radius-sm);
        font-weight: 500;
        font-size: 16px;
        text-decoration: none;
    }
    .nav-mobile a.active { color: var(--brand); background: var(--info-bg); }
    .nav-mobile-cta {
        display: flex; flex-direction: column; gap: 8px;
        margin-top: 10px; padding-top: 12px;
        border-top: 1px solid var(--border);
    }
    .nav-mobile-cta .btn { width: 100%; justify-content: center; }
}

@media (max-width: 640px) {
    /* Confort de lecture */
    .container, .container-narrow { padding: 0 16px; }
    .hero h1 { font-size: 30px; line-height: 1.2; }
    .hero p { font-size: 16px; }
    .hero-ctas .btn { width: 100%; justify-content: center; }
    .section-title { font-size: 24px; }

    /* Tableaux : plus compacts, indice de défilement */
    .table { font-size: 13px; }
    .table th, .table td { padding: 10px 10px; white-space: nowrap; }
    .table-wrap { -webkit-overflow-scrolling: touch; position: relative; }

    /* Modales : plein écran utile */
    .modal { width: 100%; max-width: 100%; margin: 0; border-radius: 12px; padding: 18px; }
    .modal-backdrop { padding: 12px; align-items: flex-start; overflow-y: auto; }

    /* Cibles tactiles */
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }

    /* Liens longs (partage) : pas de débordement */
    .share-result { word-break: break-all; font-size: 12px; }
    input.form-control { font-size: 16px; } /* évite le zoom auto iOS */
}

/* ============================================================
   === MOBILE v2 === Layout applicatif (tableau de bord)
   Placé en FIN de fichier volontairement : `.app-layout` est
   redéfini plus haut (display:flex) APRÈS le @media d'origine,
   ce qui neutralisait le responsive. Ici, on gagne par ordre
   de source. N'affecte que <= 960px : desktop inchangé.
   ============================================================ */

@media (max-width: 960px) {
    /* Le shell repasse en pile verticale (bat le display:flex tardif) */
    .app-layout {
        display: block;
        min-height: 0;
    }

    /* Barre latérale -> bandeau horizontal en haut */
    .sidebar {
        position: static;
        height: auto;
        width: 100%;
        max-width: none;
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 10px;
        overflow: visible;
    }
    .sidebar-brand { display: none; }
    .sidebar-section { display: none; }

    /* Liens en ligne, défilables horizontalement */
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    .sidebar-nav a {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 9px 12px;
        font-size: 13.5px;
        border-radius: var(--radius-sm);
    }

    /* Contenu : pleine largeur */
    .main-content {
        padding: 20px 16px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 640px) {
    .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .page-title { font-size: 22px; }
    .page-header .btn { width: 100%; justify-content: center; }

    /* Cartes de statistiques : une seule colonne, lisible */
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .folder-grid { grid-template-columns: 1fr; }

    /* Tableaux : compacts + défilement horizontal fluide */
    .table { font-size: 13px; }
    .table th, .table td { padding: 10px 10px; white-space: nowrap; }
    .table-wrap { -webkit-overflow-scrolling: touch; }

    /* Cibles tactiles + pas de zoom auto iOS sur les champs */
    .btn { min-height: 42px; }
    input.form-control, select.form-control, textarea.form-control { font-size: 16px; }
}

/* ============================================================
   === MOBILE v3 === Anti-débordement du tableau de bord
   ============================================================ */

/* Grille du tableau de bord (ex-style inline de dashboard.php) */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

/* Les enfants d'une grille ont min-width:auto : ils refusent de rétrécir
   sous la largeur de leur contenu (d'où le débordement). On l'autorise. */
.dash-grid > * { min-width: 0; }

@media (max-width: 960px) {
    /* Une seule colonne */
    .dash-grid { grid-template-columns: 1fr; gap: 16px; }

    /* Filet de sécurité : grilles encore définies en style inline dans les vues.
       `!important` est le seul moyen de l'emporter sur un attribut style. */
    .main-content [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* Rien ne peut dépasser la largeur de l'écran */
    .main-content .card,
    .main-content .table-wrap { min-width: 0; max-width: 100%; }
    .card-header { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 640px) {
    /* Les tableaux DANS un .table-wrap peuvent garder nowrap (ils défilent).
       Ailleurs, on autorise le retour à la ligne pour ne pas pousser la carte. */
    .table th, .table td { white-space: normal; }
    .table-wrap .table th,
    .table-wrap .table td { white-space: nowrap; }

    /* Les e-mails/URL longs ne doivent jamais élargir la page */
    .table td { overflow-wrap: anywhere; }
    .table-wrap .table td { overflow-wrap: normal; }
}