/* =============================================================
   NEOA CRM — Feuille de style
   -------------------------------------------------------------
   Esthétique : éditoriale médicale, sobre, dense en information.
   - Typographie : Fraunces (serif éditorial) + Manrope (sans)
   - Palette    : encre anthracite, blanc cassé, accent bordeaux
   - Spirit     : outil de travail, lisible 8h/jour, sans bruit
   ============================================================= */

/* --- Variables --- */
:root {
    --ink:        #1a1a1d;
    --ink-soft:   #2c2c30;
    --ink-mute:   #6b6b71;
    --ink-faint:  #a0a0a8;
    --paper:      #f7f5f0;
    --paper-2:    #efece5;
    --line:       #d8d4ca;
    --line-soft:  #e6e2d8;
    --white:      #ffffff;
    --accent:     #7a1e2b;
    --accent-2:   #9a2735;
    --ok:         #2d6a4f;
    --warn:       #b08000;
    --err:        #8a1c2a;

    --rad:        4px;
    --rad-lg:     8px;
    --shadow-sm:  0 1px 2px rgba(26,26,29,.04);
    --shadow:     0 2px 8px rgba(26,26,29,.06);
    --shadow-lg:  0 8px 32px rgba(26,26,29,.08);

    --serif:      'Fraunces', Georgia, 'Times New Roman', serif;
    --sans:       'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* =============================================================
   AUTH SHELL — pages de login et changement de PIN
   ============================================================= */
.auth-shell {
    min-height: 100vh;
    background: var(--paper);
    background-image:
        radial-gradient(ellipse at top left, rgba(122,30,43,.04), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(45,106,79,.04), transparent 60%);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-canvas {
    width: 100%;
    max-width: 1040px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--rad-lg);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    overflow: hidden;
    min-height: 580px;
}

.auth-decoration {
    background: linear-gradient(150deg, #1a1a1d 0%, #28282d 60%, #1a1a1d 100%);
    color: var(--paper);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}
.auth-decoration::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 80% 20%, rgba(122,30,43,.18), transparent 50%),
        radial-gradient(circle at 10% 90%, rgba(122,30,43,.10), transparent 60%);
    pointer-events: none;
}
.auth-decoration > * { position: relative; z-index: 1; }

.deco-mark {
    width: 56px;
    height: 56px;
    border: 1.5px solid var(--paper);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 30px;
    margin-bottom: 24px;
}
.deco-text { margin-bottom: 48px; }
.deco-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 38px;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 8px;
}
.deco-sub {
    font-size: 14px;
    color: rgba(247, 245, 240, 0.65);
    letter-spacing: 0.01em;
}
.deco-quote {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.35;
    font-style: italic;
    font-weight: 400;
    color: rgba(247, 245, 240, 0.92);
    border-left: 2px solid var(--accent-2);
    padding-left: 20px;
    margin: 16px 0;
}
.deco-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    color: rgba(247, 245, 240, 0.7);
}
.deco-meta .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-2);
    margin-right: 10px;
    vertical-align: middle;
}

.auth-form-wrap {
    padding: 56px 48px;
    display: flex;
    align-items: center;
}
.auth-form { width: 100%; max-width: 360px; margin: 0 auto; }

.auth-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 8px;
}
.auth-sub {
    color: var(--ink-mute);
    font-size: 14px;
    margin: 0 0 32px;
}

.auth-foot {
    margin-top: 28px;
    text-align: center;
    color: var(--ink-mute);
    font-size: 13px;
}
.link {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(122, 30, 43, .3);
    text-underline-offset: 3px;
}
.link:hover { text-decoration-color: var(--accent); }

/* --- Form --- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-mute);
}
.field__input {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--rad);
    background: var(--white);
    font-size: 15px;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.field__input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(26,26,29,.06);
}
.field__input--pin {
    letter-spacing: 0.5em;
    font-family: var(--serif);
    font-size: 18px;
    text-align: center;
    padding: 14px;
}
.field__hint {
    font-size: 12px;
    color: var(--ink-faint);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: var(--rad);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
    background: var(--ink);
    color: var(--paper);
}
.btn--primary:hover { background: var(--ink-soft); }
.btn--full { width: 100%; }

/* =============================================================
   APP SHELL — pages authentifiées
   ============================================================= */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px 1fr;
}

/* --- Sidebar --- */
.sidebar {
    background: var(--ink);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 28px;
    border-bottom: 1px solid rgba(247, 245, 240, 0.08);
    margin-bottom: 24px;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--paper);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 20px;
}
.brand-name {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.01em;
    line-height: 1;
}
.brand-tag {
    font-size: 11px;
    color: rgba(247, 245, 240, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.sidebar__nav {
    flex: 1;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(247, 245, 240, 0.4);
    padding: 0 12px 8px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--rad);
    font-size: 14px;
    color: rgba(247, 245, 240, 0.78);
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(247, 245, 240, 0.04); color: var(--paper); }
.nav-link--active {
    background: rgba(247, 245, 240, 0.08);
    color: var(--paper);
    font-weight: 600;
}
.nav-link--disabled {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}
.nav-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    color: rgba(247, 245, 240, 0.5);
}
.nav-link--active .nav-icon { color: var(--accent-2); }
.nav-pill {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(247, 245, 240, 0.08);
    color: rgba(247, 245, 240, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.sidebar__footer {
    padding: 16px 16px 0;
    border-top: 1px solid rgba(247, 245, 240, 0.08);
    margin-top: 16px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-role {
    font-size: 11px;
    color: rgba(247, 245, 240, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.sidebar__actions { display: flex; flex-direction: column; gap: 2px; }
.action-link {
    padding: 8px 12px;
    border-radius: var(--rad);
    font-size: 13px;
    color: rgba(247, 245, 240, 0.6);
    transition: background .15s, color .15s;
}
.action-link:hover { background: rgba(247, 245, 240, 0.04); color: var(--paper); }
.action-link--danger:hover { color: var(--accent-2); }

/* --- Main area --- */
.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 10;
}
.crumb {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.meta-date {
    font-size: 13px;
    color: var(--ink-mute);
    text-transform: capitalize;
}

.flash-stack {
    padding: 16px 32px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.flash {
    padding: 12px 16px;
    border-radius: var(--rad);
    font-size: 14px;
    border-left: 3px solid;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.flash--error   { border-left-color: var(--err);  color: var(--err);  background: #fdf4f5; }
.flash--success { border-left-color: var(--ok);   color: var(--ok);   background: #f1f7f3; }
.flash--info    { border-left-color: var(--ink);  color: var(--ink);  background: var(--paper-2); }
.flash--warn    { border-left-color: var(--warn); color: var(--warn); background: #fbf6e8; }

.content {
    flex: 1;
    padding: 32px;
}

.footer {
    padding: 16px 32px;
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--ink-faint);
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer__sep { opacity: .5; }

/* --- Hero (dashboard) --- */
.hero {
    padding: 16px 0 32px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 32px;
}
.hero__eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 12px;
}
.hero__title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 42px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 12px;
}
.hero__sub {
    font-size: 15px;
    color: var(--ink-mute);
    max-width: 640px;
    margin: 0;
    line-height: 1.6;
}

/* --- Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--rad-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.card--accent {
    background: var(--paper-2);
    border-color: var(--line);
}
.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}
.card__title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
}
.card__pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--paper-2);
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.card__pill--ok {
    background: rgba(45,106,79,.1);
    color: var(--ok);
}
.card__body { font-size: 14px; }
.card__text {
    color: var(--ink-soft);
    line-height: 1.6;
    margin: 0;
}

/* --- Status list --- */
.status-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-soft);
}
.status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    flex-shrink: 0;
}
.status--warn .status__dot { background: var(--warn); }
.status--err .status__dot  { background: var(--err); }

/* --- Roadmap --- */
.roadmap {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}
.roadmap li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line-soft);
    font-size: 14px;
    color: var(--ink-soft);
}
.roadmap__last { border-bottom: none; }
.roadmap__num {
    font-family: var(--serif);
    font-weight: 600;
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
    min-width: 20px;
}

/* =============================================================
   ERROR PAGES
   ============================================================= */
.error-shell {
    min-height: 100vh;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.error-page {
    text-align: center;
    max-width: 480px;
}
.error-num {
    font-family: var(--serif);
    font-size: 120px;
    line-height: 1;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.04em;
    margin-bottom: 16px;
}
.error-title {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}
.error-sub {
    color: var(--ink-mute);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 880px) {
    .auth-canvas {
        grid-template-columns: 1fr;
    }
    .auth-decoration {
        display: none;
    }
    .auth-form-wrap {
        padding: 40px 28px;
    }
}

@media (max-width: 720px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 16px;
    }
    .sidebar__brand { width: 100%; padding: 0 0 12px; margin-bottom: 12px; }
    .sidebar__nav { flex: 1; flex-direction: row; gap: 8px; padding: 0; flex-wrap: wrap; }
    .nav-section { flex: 1; min-width: 140px; }
    .sidebar__footer { width: 100%; }

    .hero__title { font-size: 30px; }
    .content { padding: 20px 16px; }
    .topbar { padding: 14px 16px; }
}
