
:root {
    --primary: #2864e8;
    --primary-dark: #194fc5;
    --background: #f5f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #788398;
    --border: #e8ecf3;
    --sidebar: #ffffff;
    --success: #159b69;
    --radius: 14px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

button {
    font-family: inherit;
    cursor: pointer;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
    width: 255px;
    min-height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 27px 17px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.8px;
    padding: 0 9px;
    margin-bottom: 43px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 21px;
    font-weight: 800;
}

.sidebar-label {
    color: #a0a9b8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0 10px;
    margin-bottom: 12px;
}

.secondary-label {
    margin-top: 29px;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border: none;
    background: transparent;
    color: #68758b;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition: 0.2s;
}

.nav-link > span:first-child {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-link:hover {
    background: #f3f6fc;
    color: var(--primary);
}

.nav-link.active {
    background: #edf3ff;
    color: var(--primary);
    font-weight: 700;
}

.ai-badge {
    margin-left: auto;
    background: #e8e1ff;
    color: #7752d6;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 800;
}

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 19px 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-avatar,
.avatar-button {
    background: #e9efff;
    color: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.profile-info strong {
    font-size: 11px;
}

.profile-info span {
    font-size: 10px;
    color: var(--muted);
}

/* CONTENU PRINCIPAL */

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 94px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
}

.breadcrumb {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 7px;
}

.breadcrumb span {
    color: var(--text);
}

.topbar h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 22px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #19b47a;
    border-radius: 50%;
}

.avatar-button {
    border: none;
}

/* PAGES */

.page-content {
    padding: 34px 38px;
    flex: 1;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.welcome-section,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 27px;
}

.welcome-section h2,
.section-heading h2 {
    font-size: 21px;
    margin-bottom: 7px;
}

.welcome-section p,
.section-heading p {
    color: var(--muted);
    font-size: 12px;
}

.primary-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 17px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* CARTES STATISTIQUES */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 0;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.stat-icon,
.quick-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
}

.blue {
    background: #edf3ff;
    color: #2864e8;
}

.purple {
    background: #f1edff;
    color: #8660dc;
}

.orange {
    background: #fff3e8;
    color: #e58a3a;
}

.green {
    background: #e9f8f0;
    color: #159b69;
}

.stat-value {
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-top: 19px;
}

.stat-description {
    font-size: 10px;
    color: var(--muted);
    margin-top: 6px;
}

/* PANNEAUX */

.content-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 23px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 23px;
}

.panel-header h3 {
    font-size: 14px;
    margin-bottom: 6px;
}

.panel-header p {
    color: var(--muted);
    font-size: 11px;
}

.empty-state {
    min-height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: 10px;
}

.empty-icon {
    width: 47px;
    height: 47px;
    background: #f1f4fa;
    color: #9aa6b8;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 21px;
    margin-bottom: 3px;
}

.empty-state strong {
    font-size: 12px;
}

.empty-state p {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.quick-panel {
    display: flex;
    flex-direction: column;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 13px 0;
    text-align: left;
}

.quick-action:last-child {
    border-bottom: none;
}

.quick-action > span:nth-child(2) {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.quick-action strong {
    font-size: 11px;
}

.quick-action small {
    font-size: 10px;
    color: var(--muted);
}

.arrow {
    font-size: 21px;
    color: #a5afbd;
}

.quick-action:hover strong {
    color: var(--primary);
}

/* PIED DE PAGE */

.footer {
    padding: 17px 38px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .sidebar {
        width: 72px;
        padding: 20px 10px;
    }

    .brand {
        justify-content: center;
        padding: 0;
    }

    .brand > span,
    .sidebar-label,
    .nav-link:not(.active) {
        font-size: 0;
    }

    .nav-link {
        justify-content: center;
        padding: 12px 5px;
    }

    .nav-link > span:first-child {
        font-size: 19px;
    }

    .nav-link.active {
        font-size: 0;
    }

    .ai-badge,
    .profile-info,
    .profile-avatar {
        display: none;
    }

    .sidebar-bottom {
        justify-content: center;
    }

    .topbar {
        padding: 0 18px;
    }

    .topbar-right .status-indicator {
        display: none;
    }

    .page-content {
        padding: 24px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .welcome-section,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer {
        padding: 15px;
    }
}

@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Fenêtre d'ajout de client */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.55);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.visible {
    display: flex;
}

.modal-card {
    background: white;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0 0 6px;
}

.modal-header p {
    margin: 0;
    color: #64748b;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    color: #64748b;
}

#formulaire-client {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#formulaire-client label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

#formulaire-client input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    margin-bottom: 8px;
    font: inherit;
}

#formulaire-client input:focus {
    outline: 2px solid #2864e8;
    border-color: transparent;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row > div {
    display: flex;
    flex-direction: column;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.secondary-button {
    background: #eef2f7;
    color: #334155;
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    cursor: pointer;
}

#message-client {
    margin: 4px 0;
    font-size: 13px;
}

@media (max-width: 500px) {
    .modal-card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Tableau des devis */
.devis-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.devis-table th,
.devis-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e8edf3;
    font-size: 13px;
}

.devis-table th {
    color: #64748b;
    font-weight: 600;
    background: #f8fafc;
}

.devis-table td {
    color: #334155;
}

.devis-status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.devis-status.brouillon {
    background: #fff4db;
    color: #946200;
}

.devis-status.valide {
    background: #dcfce7;
    color: #166534;
}

.devis-status.refuse {
    background: #fee2e2;
    color: #991b1b;
}

/* Fenêtre de création de devis */
.modal-devis-card {
    max-width: 700px;
}

.devis-form-section {
    margin-top: 24px;
}

.devis-form-section h3 {
    margin-bottom: 5px;
}

.devis-form-section > p {
    color: #64748b;
    font-size: 13px;
}

#formulaire-devis {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#formulaire-devis label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

#formulaire-devis select,
#formulaire-devis textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    font: inherit;
    background: white;
}

#formulaire-devis select:focus,
#formulaire-devis textarea:focus {
    outline: 2px solid #2864e8;
    border-color: transparent;
}

.devis-total {
    background: #f5f7fb;
    border-radius: 12px;
    padding: 18px;
    margin-top: 15px;
}

.devis-total > div {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    color: #64748b;
}

.devis-total-ttc {
    border-top: 1px solid #dbe2ea;
    margin-top: 8px;
    padding-top: 15px !important;
    color: #172033 !important;
    font-size: 17px;
}

#message-devis {
    font-size: 13px;
}

/* Lignes de prestations du formulaire de devis */
.devis-ligne {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px auto;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

.devis-ligne select,
.devis-ligne input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 11px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: white;
    font: inherit;
}

.devis-ligne button {
    white-space: nowrap;
}

#ajouter-ligne-devis {
    margin-top: 8px;
}

@media (max-width: 550px) {
    .devis-ligne {
        grid-template-columns: 1fr 85px;
    }

    .devis-ligne button {
        grid-column: 1 / -1;
    }
}

/* Fiche détaillée d'un devis */
.modal-detail-card {
    max-width: 760px;
}

.detail-client {
    background: #f5f7fb;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 22px;
}

.detail-client h3 {
    margin-top: 0;
}

.detail-client p {
    margin: 6px 0;
    color: #64748b;
    font-size: 14px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.detail-table th,
.detail-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e8edf3;
    font-size: 13px;
}

.detail-table th {
    color: #64748b;
    background: #f8fafc;
}

.detail-totaux {
    background: #f5f7fb;
    padding: 18px;
    border-radius: 10px;
    margin-top: 20px;
}

.detail-totaux div {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
}

.detail-totaux .detail-ttc {
    border-top: 1px solid #dbe2ea;
    margin-top: 8px;
    padding-top: 14px;
    font-size: 18px;
    font-weight: 700;
}

.devis-table tbody tr {
    cursor: pointer;
}

.devis-table tbody tr:hover {
    background: #f5f8ff;
}
/* FENETRE PREPARATION EMAIL */

.modal-email-card {
    width: 620px;
    max-width: 95%;
}

#formulaire-email {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#formulaire-email label {
    font-weight: 600;
    margin-top: 8px;
}

#formulaire-email input,
#formulaire-email textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #dce2ec;
    border-radius: 8px;
    font: inherit;
    box-sizing: border-box;
}

#formulaire-email textarea {
    resize: vertical;
    line-height: 1.6;
}

.email-piece-jointe {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f5f7fb;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
}

.email-piece-jointe p {
    margin: 4px 0 0;
    color: #718096;
    font-size: 13px;
}

/* AUTHENTIFICATION ET SESSION */
.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f5f7fb 0%, #eaf0ff 100%);
}
.auth-screen[hidden] { display: none; }
.auth-card {
    width: min(100%, 430px);
    padding: 38px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(25, 45, 85, .12);
}
.auth-brand { display:flex; align-items:center; gap:10px; margin-bottom:32px; font-size:21px; font-weight:800; }
.auth-brand-icon { display:grid; place-items:center; width:38px; height:38px; border-radius:11px; color:#fff; background:var(--primary); }
.auth-card h1 { margin-bottom:8px; font-size:25px; }
.auth-subtitle { margin-bottom:26px; color:var(--muted); line-height:1.5; }
.auth-card label { display:block; margin:16px 0 7px; font-weight:600; }
.auth-card input, .auth-card select { width:100%; padding:13px 14px; border:1px solid #dce2ec; border-radius:9px; font:inherit; background:#fff; }
.auth-card input:focus, .auth-card select:focus { outline:2px solid rgba(40,100,232,.18); border-color:var(--primary); }
.auth-submit { width:100%; justify-content:center; margin-top:20px; }
.auth-message { min-height:20px; margin-top:12px; color:#b42318; line-height:1.4; }
.auth-security-note { margin-top:25px; color:var(--muted); font-size:11px; text-align:center; }
.auth-back { display:block; margin:14px auto 0; border:0; background:none; color:var(--primary); font:inherit; }
.logout-button { margin-left:auto; border:0; background:transparent; color:#68758b; font-size:19px; padding:7px; border-radius:7px; }
.logout-button:hover { background:#f3f6fc; color:var(--primary); }
@media (max-width: 480px) { .auth-card { padding:27px 22px; } }


/* =========================================================
   LYNIS — identité visuelle
   Couche de personnalisation : conserve les composants existants
   ========================================================= */
:root {
    --primary: #7134e8;
    --primary-dark: #5520c8;
    --background: #f7f5fc;
    --surface: #ffffff;
    --text: #19152a;
    --muted: #817b91;
    --border: #ebe7f3;
    --sidebar: #fff;
    --success: #159b69;
    --radius: 16px;
    --lynis-violet: #4c0ff7;
    --lynis-purple: #7a3df0;
    --lynis-lavender: #b38bff;
}
body { background: var(--background); color: var(--text); }
.sidebar { border-right-color: #eee9f7; box-shadow: 8px 0 30px rgba(40, 20, 80, .025); }
.brand { gap: 12px; font-size: 22px; letter-spacing: 3px; font-weight: 700; color: #211936; }
.lynis-mark { display: block; width: 35px; height: 45px; flex: 0 0 auto; }
.brand .lynis-mark { width: 34px; height: 43px; }
.auth-brand { gap: 12px; letter-spacing: 4px; color: #211936; }
.auth-brand .lynis-mark { width: 39px; height: 50px; }
.nav-link { border-radius: 11px; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-link:hover { background: #f4efff; color: var(--primary); }
.nav-link.active { color: #fff; background: linear-gradient(110deg, #7134e8, #914cf4); box-shadow: 0 7px 18px rgba(113, 52, 232, .19); }
.primary-button { background: linear-gradient(110deg, #7134e8, #914cf4); border-radius: 10px; box-shadow: 0 5px 14px rgba(113, 52, 232, .14); }
.primary-button:hover { background: linear-gradient(110deg, #6028d5, #7d39e6); }
.stat-card, .panel { border-color: #ece7f4; box-shadow: 0 5px 22px rgba(37, 20, 70, .035); }
.stat-icon.purple, .quick-icon.purple { background: #f0e8ff; color: #7134e8; }
.empty-icon { background: #f2edfc; color: #9062e8; }
.auth-screen {
    background:
      radial-gradient(ellipse at 18% 18%, rgba(128, 67, 255, .25), transparent 36%),
      radial-gradient(ellipse at 85% 88%, rgba(76, 15, 247, .22), transparent 38%),
      #100b20;
}
.auth-card {
    border: 1px solid rgba(179, 139, 255, .22);
    border-radius: 22px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
}
.auth-brand { color: #211936; }
.auth-brand-icon { display: none; }
.auth-card h1 { letter-spacing: -.7px; }
.auth-card input:focus, .auth-card select:focus {
    outline: 3px solid rgba(113, 52, 232, .13);
    border-color: #8b5cf6;
}
.auth-submit { box-shadow: 0 8px 22px rgba(113, 52, 232, .22); }
.status-dot { box-shadow: 0 0 0 4px rgba(25, 180, 122, .10); }
.footer { color: #9991aa; }
@media (max-width: 720px) {
    .brand .lynis-mark { width: 31px; height: 39px; }
}
