/* ==========================================================================
   SESAME Converter - Design System v2
   "Refined health-tech with Senegalese soul"
   Palette: emerald + sand-gold + cream + ink-black
   Typography: Plus Jakarta Sans (body) + Fraunces (display, serif)
   ========================================================================== */

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

:root {
    --emerald-50:  #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;
    --emerald-950: #022c22;

    --sand-50:  #fefce8;
    --sand-100: #fef9c3;
    --sand-200: #fef08a;
    --sand-300: #fde047;
    --sand-400: #facc15;
    --sand-500: #eab308;
    --sand-600: #ca8a04;
    --sand-700: #a16207;

    --cream:        #fdfbf7;
    --cream-warm:   #f9f5ed;
    --ink:          #0a1f1a;
    --ink-soft:     #1a3a32;
    --muted:        #6b7c75;
    --muted-soft:   #95a39d;
    --border:       #e5ebe8;
    --border-soft:  #f1f5f3;

    --primary:    var(--emerald-700);
    --primary-50: var(--emerald-50);
    --primary-fg: #ffffff;
    --accent:     var(--sand-500);
    --success:    var(--emerald-600);
    --warning:    #d97706;
    --info:       #0891b2;
    --danger:     #dc2626;

    --sidebar-w: 272px;
    --header-h:  86px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 20px;

    --shadow-xs: 0 1px 2px rgba(6, 78, 59, 0.04);
    --shadow-sm: 0 2px 8px -1px rgba(6, 78, 59, 0.06), 0 1px 3px rgba(6, 78, 59, 0.04);
    --shadow:    0 4px 16px -2px rgba(6, 78, 59, 0.08), 0 2px 6px rgba(6, 78, 59, 0.04);
    --shadow-lg: 0 12px 32px -8px rgba(6, 78, 59, 0.12), 0 4px 12px rgba(6, 78, 59, 0.06);
    --shadow-xl: 0 24px 56px -12px rgba(6, 78, 59, 0.18), 0 8px 24px rgba(6, 78, 59, 0.08);
    --shadow-glow: 0 0 0 4px rgba(4, 120, 87, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'ss01', 'cv01', 'cv02';
}

h1, h2, h3, h4, h5, h6, .display {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.2;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--emerald-800); }

::selection { background: var(--emerald-200); color: var(--ink); }

/* === GUEST / Split-screen login === */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 980px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

.auth-brand {
    position: relative;
    background: linear-gradient(155deg, var(--emerald-900) 0%, var(--emerald-800) 45%, var(--emerald-700) 100%);
    color: #fff;
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    isolation: isolate;
}
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(234, 179, 8, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(110, 231, 183, 0.08) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 40m-30 0a30 30 0 1 0 60 0a30 30 0 1 0 -60 0' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='1'/%3E%3C/svg%3E");
    z-index: -1;
}
.auth-brand::after {
    content: '';
    position: absolute;
    top: -120px; right: -120px;
    width: 380px; height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.18) 0%, transparent 70%);
    z-index: -1;
    animation: float 12s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, 20px); }
}

.auth-brand-head { display: flex; align-items: center; gap: 0.85rem; }
.auth-brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, var(--sand-400), var(--sand-500));
    display: grid; place-items: center;
    color: var(--emerald-900); font-size: 1.05rem;
    box-shadow: 0 8px 20px rgba(234, 179, 8, 0.3);
}
.auth-brand-name {
    font-family: 'Fraunces', serif;
    font-size: 0.98rem; font-weight: 600;
    letter-spacing: -0.02em;
}

.auth-brand-body { max-width: 460px; }
.auth-brand-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.63rem;
    color: var(--sand-300);
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: inline-flex; align-items: center; gap: 0.5rem;
}
.auth-brand-eyebrow::before {
    content: ''; width: 32px; height: 1px; background: var(--sand-400);
}
.auth-brand-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.65rem, 3.5vw, 2.25rem);
    font-weight: 500;
    line-height: 1.1;
    color: #fff;
    margin: 0 0 1.25rem;
    letter-spacing: -0.025em;
}
.auth-brand-title em {
    font-style: italic;
    color: var(--sand-300);
    font-weight: 400;
}
.auth-brand-lede {
    font-size: 0.86rem; line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    max-width: 420px;
}

.auth-brand-stats { display: flex; gap: 2.5rem; margin-top: 2rem; }
.auth-brand-stat-value {
    font-family: 'Fraunces', serif;
    font-size: 1.55rem; font-weight: 600;
    color: #fff; line-height: 1;
}
.auth-brand-stat-label {
    font-size: 0.63rem; text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 0.35rem;
}

.auth-brand-foot {
    font-size: 0.63rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex; justify-content: space-between; align-items: center;
}
.auth-brand-foot strong { color: rgba(255, 255, 255, 0.85); font-weight: 600; }

.auth-form-side {
    display: flex; align-items: center; justify-content: center;
    padding: 3rem 2rem;
    background: var(--cream);
    position: relative;
}
.auth-form-side::before {
    content: '';
    position: absolute;
    top: 10%; right: -10%;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--emerald-100) 0%, transparent 70%);
    opacity: 0.5; z-index: 0;
}
.auth-form-wrap { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.63rem;
    color: var(--emerald-700);
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.auth-title {
    font-family: 'Fraunces', serif;
    font-size: 1.85rem;
    font-weight: 500;
    color: var(--ink);
    margin: 0 0 0.5rem;
    letter-spacing: -0.025em;
    line-height: 1.1;
}
.auth-subtitle {
    color: var(--muted);
    margin: 0 0 2.5rem;
    font-size: 0.63rem;
}

/* === FORMS === */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.63rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.form-control, .form-select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-family: inherit;
    font-size: 0.63rem;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:hover, .form-select:hover { border-color: var(--emerald-300); }
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--emerald-600);
    box-shadow: var(--shadow-glow);
}

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.2;
    white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow); }

.btn-primary {
    background: var(--emerald-700);
    color: #fff;
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
    background: var(--emerald-800);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(4, 120, 87, 0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary, .btn-outline-secondary {
    background: #fff; color: var(--ink); border-color: var(--border);
}
.btn-secondary:hover, .btn-outline-secondary:hover {
    border-color: var(--emerald-400);
    color: var(--emerald-800);
}

.btn-outline-primary {
    background: transparent;
    color: var(--emerald-700);
    border-color: var(--emerald-200);
}
.btn-outline-primary:hover {
    background: var(--emerald-50);
    border-color: var(--emerald-400);
    color: var(--emerald-800);
}

.btn-success { background: var(--emerald-600); color: #fff; box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25); }
.btn-success:hover { background: var(--emerald-700); color: #fff; transform: translateY(-1px); }

.btn-outline-danger { background: transparent; color: var(--danger); border-color: #fecaca; }
.btn-outline-danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.btn-outline-warning { background: transparent; color: var(--sand-700); border-color: var(--sand-200); }
.btn-outline-warning:hover { background: var(--sand-50); color: var(--sand-700); }

.btn-lg { padding: 1rem 1.75rem; font-size: 0.86rem; border-radius: 14px; }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.63rem; border-radius: 8px; }

.w-100 { width: 100%; }

/* === APP LAYOUT === */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(178deg, var(--emerald-900) 0%, var(--emerald-950) 100%);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}
.sidebar::before {
    content: '';
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cpath d='M0 0L100 100M100 0L0 100' stroke='rgba(255,255,255,0.015)' stroke-width='1'/%3E%3C/svg%3E");
    pointer-events: none;
}
.sidebar-brand {
    padding: 1.5rem 1.5rem 1.25rem;
    display: flex; align-items: center; gap: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative; z-index: 1;
}
.sidebar-brand-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.sidebar-brand-pill {
    display: inline-flex; align-items: center;
    align-self: flex-start;
    padding: 0.12rem 0.45rem;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--sand-400), var(--sand-500));
    color: var(--emerald-900);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}
.sidebar-mark {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, var(--sand-400), var(--sand-500));
    display: grid; place-items: center;
    color: var(--emerald-900); font-size: 0.98rem;
    box-shadow: 0 6px 16px rgba(234, 179, 8, 0.35);
    flex-shrink: 0;
}
.sidebar-brand-name {
    font-family: 'Fraunces', serif;
    font-size: 0.98rem; color: #fff;
    font-weight: 600; line-height: 1;
    letter-spacing: -0.01em;
}
.sidebar-brand-sub {
    font-size: 0.63rem; color: var(--sand-300);
    text-transform: uppercase; letter-spacing: 0.18em;
    margin-top: 0.15rem;
}

.sidebar-nav {
    flex: 1; padding: 1.5rem 1rem;
    overflow-y: auto; position: relative; z-index: 1;
}
.sidebar-section-label {
    font-size: 0.63rem; text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(255,255,255,0.35);
    font-weight: 700;
    margin: 0 0.85rem 0.65rem;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    margin-bottom: 0.25rem;
    font-size: 0.86rem; font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
}
.sidebar-nav .nav-link i {
    font-size: 0.98rem; width: 20px;
    text-align: center; opacity: 0.8;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.05); color: #fff;
}
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.12) 0%, rgba(234, 179, 8, 0.04) 100%);
    color: #fff; font-weight: 600;
}
.sidebar-nav .nav-link.active::before {
    content: ''; position: absolute;
    left: -1rem; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--sand-400);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.5);
}
.sidebar-nav .nav-link.active i { color: var(--sand-300); opacity: 1; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    position: relative; z-index: 1;
}
.user-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem; border-radius: 10px;
}
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--sand-400), var(--sand-500));
    display: grid; place-items: center;
    color: var(--emerald-900);
    font-weight: 700; font-size: 0.63rem;
    flex-shrink: 0;
}
.user-name { color: #fff; font-size: 0.63rem; font-weight: 600; line-height: 1.1; }
.user-role {
    font-size: 0.64rem; color: var(--sand-300);
    text-transform: uppercase; letter-spacing: 0.16em;
    margin-top: 0.2rem;
}
.btn-logout {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    width: 100%; margin-top: 0.65rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.63rem;
    border-radius: 9px;
    transition: all 0.15s;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    font-weight: 500;
    text-decoration: none;
}
.btn-logout:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fee;
}

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

.page-header {
    background: rgba(253, 251, 247, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 20;
    height: var(--header-h);
}
.page-header-titles {
    display: flex; flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.page-header-brand {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--muted);
}
.page-header-brand-mark {
    display: inline-flex; align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800));
    color: #fff;
    letter-spacing: 0.12em;
    font-weight: 800;
    font-size: 0.63rem;
    box-shadow: 0 2px 6px rgba(4, 120, 87, 0.25);
}
.page-header-brand-sep {
    color: var(--muted-soft);
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0;
}
.page-header-brand-name {
    color: var(--ink-soft);
    letter-spacing: 0.18em;
}
.page-title {
    font-family: 'Fraunces', serif;
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.page-meta {
    color: var(--muted);
    font-size: 0.8rem;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
}
.page-meta i { color: var(--emerald-600); }

.page-body { padding: 1.5rem 2rem 2.5rem; }

/* === CARDS === */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.95rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h5, .card-header h6 {
    margin: 0;
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 0.86rem;
    letter-spacing: -0.01em;
}
.card-body { padding: 1.5rem; }
.card-title { font-family: 'Fraunces', serif; font-weight: 500; font-size: 0.98rem; }

/* === STAT CARDS === */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    border-radius: 50%;
    transform: translate(40%, -40%);
    opacity: 0.06;
    background: currentColor;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem;
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 0.98rem;
    flex-shrink: 0;
}
.stat-trend {
    font-size: 0.63rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    background: var(--emerald-50);
    color: var(--emerald-700);
    display: inline-flex; align-items: center; gap: 0.25rem;
}
.stat-value {
    font-family: 'Fraunces', serif;
    font-size: 1.35rem; font-weight: 500;
    line-height: 1.05;
    color: var(--ink);
    letter-spacing: -0.025em;
    margin-bottom: 0.35rem;
}
.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-primary { color: var(--emerald-600); }
.stat-primary .stat-icon { background: var(--emerald-50); color: var(--emerald-700); }
.stat-success { color: var(--emerald-600); }
.stat-success .stat-icon { background: var(--emerald-50); color: var(--emerald-700); }
.stat-warning { color: var(--sand-600); }
.stat-warning .stat-icon { background: var(--sand-50); color: var(--sand-700); }
.stat-info { color: var(--info); }
.stat-info .stat-icon { background: #ecfeff; color: var(--info); }

/* === ALERTS === */
.alert {
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    font-size: 0.86rem;
    font-weight: 500;
}
.alert-success { background: var(--emerald-50); border-color: var(--emerald-200); color: var(--emerald-800); }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--sand-50); border-color: var(--sand-200); color: var(--sand-700); }
.alert-info    { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }
.btn-close {
    background: transparent; border: 0; cursor: pointer;
    font-size: 1.05rem; line-height: 1; opacity: 0.5;
    padding: 0; margin-left: auto;
}
.btn-close:hover { opacity: 1; }
.btn-close::before { content: '×'; }

/* === FORMAT SELECTION === */
.format-card { display: block; cursor: pointer; margin: 0; }
.format-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.format-card-body {
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.25rem;
    text-align: center;
    background: #fff;
    transition: all 0.18s ease;
    position: relative;
    overflow: hidden;
}
.format-card-body i {
    font-size: 1.85rem;
    display: block;
    margin-bottom: 0.65rem;
    transition: transform 0.2s;
}
.format-card:hover .format-card-body i { transform: scale(1.08); }
.format-name {
    font-family: 'Fraunces', serif;
    font-weight: 600; font-size: 0.86rem;
    color: var(--ink);
    margin-bottom: 0.2rem;
}
.format-desc { color: var(--muted); font-size: 0.63rem; }
.format-card input[type="radio"]:checked + .format-card-body {
    border-color: var(--emerald-600);
    background: linear-gradient(135deg, var(--emerald-50) 0%, #fff 70%);
    box-shadow: 0 0 0 4px var(--emerald-50), var(--shadow);
}
.format-card input[type="radio"]:checked + .format-card-body::after {
    content: '✓';
    position: absolute;
    top: 10px; right: 12px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--emerald-600);
    color: #fff;
    display: grid; place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* === UPLOAD === */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--cream-warm) 0%, #fff 100%);
    padding: 2.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.upload-zone:hover {
    border-color: var(--emerald-400);
    background: linear-gradient(135deg, var(--emerald-50) 0%, #fff 100%);
}
.upload-zone.dragover {
    border-color: var(--emerald-600);
    background: var(--emerald-50);
    transform: scale(1.01);
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.upload-prompt i, .upload-info i {
    display: block;
    margin: 0 auto 0.85rem;
    transition: transform 0.2s;
}
.upload-zone:hover .upload-prompt i { transform: translateY(-3px); }
.upload-prompt strong { color: var(--emerald-700); }

/* === TABLES === */
.table-responsive { overflow-x: auto; }
.table { width: 100%; margin: 0; border-collapse: collapse; }
.table thead th {
    background: var(--cream-warm);
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.63rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--emerald-50); }
.table-warning, .table-light { background: var(--cream-warm); }
.align-middle { vertical-align: middle !important; }

.text-end { text-align: right; }
.text-center { text-align: center; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.small { font-size: 0.8rem; }

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.63rem;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.04em;
}
.bg-primary { background: var(--emerald-700) !important; color: #fff !important; }
.bg-success { background: var(--emerald-600) !important; color: #fff !important; }
.bg-secondary { background: var(--muted) !important; color: #fff !important; }
.bg-danger { background: var(--danger) !important; color: #fff !important; }
.bg-success-subtle { background: var(--emerald-50) !important; color: var(--emerald-800) !important; }
.text-success-emphasis { color: var(--emerald-800); }
.bg-danger-subtle { background: #fef2f2 !important; color: #991b1b !important; }
.text-danger-emphasis { color: #991b1b; }

/* === PROGRESS === */
.progress {
    height: 8px;
    background: var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--emerald-600);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar.bg-success { background: var(--emerald-600); }
.progress-bar.bg-primary { background: var(--emerald-700); }

/* === PAGINATION === */
.pagination { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.page-item { list-style: none; }
.page-link {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink-soft);
    background: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-block;
}
.page-item.active .page-link {
    background: var(--emerald-700);
    border-color: var(--emerald-700);
    color: #fff;
}
.page-link:hover { background: var(--emerald-50); border-color: var(--emerald-300); }

/* === TABS === */
.nav-tabs {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid var(--border);
}
.nav-item { list-style: none; }
.nav-tabs .nav-link {
    background: transparent;
    border: 0;
    padding: 0.85rem 1.25rem;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 0.86rem;
    transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 0.45rem;
}
.nav-tabs .nav-link:hover { color: var(--ink); }
.nav-tabs .nav-link.active {
    color: var(--emerald-700);
    border-bottom-color: var(--emerald-600);
}

/* === MODALS === */
.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    background: #fff;
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 0.86rem;
    margin: 0;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* === UTILITIES === */
.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--emerald-700) !important; }
.text-success { color: var(--emerald-600) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--sand-600) !important; }
.text-info { color: var(--info) !important; }

.row { display: flex; flex-wrap: wrap; margin: 0 -0.5rem; }
.row > [class*="col-"] { padding: 0 0.5rem; }
.g-3 { row-gap: 1rem; column-gap: 0; }
.g-3 > * { padding: 0.5rem; }

.col-12 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-5 { flex: 0 0 41.666%; max-width: 41.666%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333%; max-width: 58.333%; }
    .col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
}
@media (min-width: 992px) {
    .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-lg-8 { flex: 0 0 66.666%; max-width: 66.666%; }
}

.d-flex { display: flex; }
.d-inline { display: inline; }
.d-block { display: block; }
.d-none { display: none !important; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.my-3 { margin-top: 1rem; margin-bottom: 1rem; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.ms-auto { margin-left: auto; }
.float-end { float: right; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.ps-3 { padding-left: 1rem; }

.display-1 { font-size: 4rem; }
.display-3 { font-size: 3rem; }
.display-4 { font-size: 2.5rem; font-family: 'Fraunces', serif; }
.opacity-50 { opacity: 0.5; }
.h-100 { height: 100%; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }

.btn-group, .btn-group-sm { display: inline-flex; gap: 0.25rem; }

.spinner-border, .spinner-border-sm {
    display: inline-block;
    width: 1rem; height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
    vertical-align: -2px;
}
@keyframes spinner { to { transform: rotate(360deg); } }

.input-group {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1.5px solid var(--border);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-group:focus-within {
    border-color: var(--emerald-600);
    box-shadow: var(--shadow-glow);
}
.input-group .form-control,
.input-group .form-select {
    border: 0; border-radius: 0; flex: 1;
}
.input-group .form-control:focus,
.input-group .form-select:focus { box-shadow: none; }
.input-group-text {
    display: flex; align-items: center;
    padding: 0 1rem;
    background: var(--cream-warm);
    color: var(--muted);
    font-size: 0.86rem;
    border-right: 1px solid var(--border);
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-header, .page-body { padding-left: 1rem; padding-right: 1rem; }
    .auth-split { grid-template-columns: 1fr; }
}

.fade-in { animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger > * { opacity: 0; animation: stagger 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.15s; }
.stagger > *:nth-child(3) { animation-delay: 0.25s; }
.stagger > *:nth-child(4) { animation-delay: 0.35s; }
.stagger > *:nth-child(5) { animation-delay: 0.45s; }
@keyframes stagger {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

details summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
    user-select: none;
    transition: color 0.15s;
    display: inline-flex; align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
    content: '+';
    display: inline-grid;
    place-items: center;
    width: 22px; height: 22px;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    margin-left: 0.5rem;
    font-weight: 400;
    transition: transform 0.2s;
    font-size: 0.63rem;
    line-height: 1;
}
details[open] summary::after { transform: rotate(45deg); }

.card-footer {
    background: var(--cream-warm);
    border-top: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
}
.bg-white { background: #fff !important; }
.border-bottom-0 { border-bottom: 0 !important; }
.border-warning, .border-success { border-color: var(--sand-400) !important; }

.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active.show,
.tab-content > .tab-pane.show.active { display: block; }
.fade { transition: opacity 0.15s linear; opacity: 0; }
.fade.show { opacity: 1; }

/* Bootstrap-compatible form-label override won't conflict because Bootstrap is loaded first */
.form-text { color: var(--muted); font-size: 0.63rem; margin-top: 0.3rem; }

/* Misc icon helpers */
.bi { display: inline-block; vertical-align: -0.125em; }

/* ==========================================================================
   RESPONSIVE — corrections mobile / tablette
   --------------------------------------------------------------------------
   Problème corrigé : sous 768px la .sidebar était masquée (translateX(-100%))
   mais AUCUN bouton ne posait la classe .open -> navigation impossible sur
   téléphone. On ajoute le bouton burger, le voile, et on traite les
   débordements horizontaux (tableaux, en-têtes, boutons).
   ========================================================================== */

/* ---- Bouton burger : masqué sur grand écran ---- */
.burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    margin-right: .25rem;
    border: 1px solid var(--sand-200, #e7e3d4);
    background: #fff;
    border-radius: 11px;
    color: var(--emerald-900, #16291e);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    flex: 0 0 auto;
}
.burger:hover { background: #f7f5ee; border-color: #cfd8d2; }
.burger:active { transform: scale(.96); }

/* ---- Voile derrière le menu ---- */
.sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(11, 32, 22, .5);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    z-index: 1090;
    opacity: 0;
    transition: opacity .25s ease;
}
.sidebar-backdrop.on { opacity: 1; }

/* ---- Tableaux : jamais de débordement horizontal ---- */
/* L'historique a beaucoup de colonnes : on rend le tableau défilable
   plutôt que de laisser la page entière déborder. */
.table-responsive, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { max-width: 100%; }

@media (max-width: 768px) {

    /* Le burger apparaît */
    .burger { display: inline-flex; }

    /* Menu en panneau glissant, au-dessus du voile */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 1100;
        width: 268px;
        max-width: 84vw;
        box-shadow: 0 0 40px rgba(0,0,0,.28);
        overflow-y: auto;
    }

    .main-content { margin-left: 0; width: 100%; }

    /* En-tête : le titre et la date passent l'un sous l'autre */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
        padding: 1rem;
    }
    .page-header-titles {
        display: flex; align-items: center; gap: .6rem;
        flex-wrap: wrap; width: 100%;
    }
    .page-title { font-size: 1.3rem; }

    /* La pastille de date prend trop de place sur petit écran */
    .page-meta { font-size: .78rem; padding: .35rem .6rem; }

    .page-body { padding: 1rem; }

    /* Cartes et formulaires : on récupère de la largeur */
    .card, .cv-card, .bl-card { padding: 1.1rem; border-radius: 13px; }

    /* Boutons pleine largeur : bien plus confortables au pouce */
    .btn { padding: .6rem 1rem; }
    .d-flex.gap-2 > .btn,
    .d-flex.gap-2 > .btn + .btn { flex: 1 1 auto; }

    /* Grilles de formats : une colonne */
    .bl-formats, .cv-formats { grid-template-columns: 1fr !important; }

    /* Les tableaux larges (historique) deviennent défilables */
    .table-responsive { display: block; width: 100%; }

    /* Voile d'attente : la carte doit tenir dans l'écran */
    .bl-ov-card { min-width: 0; width: 88vw; padding: 1.6rem 1.2rem 1.3rem; }
}

/* Très petits écrans (≤ 380px) */
@media (max-width: 380px) {
    .page-header-brand-name { display: none; }   /* garde « CMU » seul */
    .page-title { font-size: 1.15rem; }
    .page-meta { display: none; }                /* la date n'est pas essentielle */
}

/* Confort tactile : cibles d'au moins 44px (recommandation d'accessibilité) */
@media (hover: none) and (pointer: coarse) {
    .sidebar-nav .nav-link { padding-top: .7rem; padding-bottom: .7rem; }
}

/* Tableaux de la page « Structure des fichiers » : non encapsulés dans un
   .table-responsive, on les rend défilables directement. */
@media (max-width: 768px) {
    .fs-table { display: block; overflow-x: auto; white-space: nowrap; }
}
