/* Saynely - styles.css - v20260615-1 */

:root {
    --bg: #1c1e23;
    --bg-soft: #23262d;
    --panel: #2b2f37;
    --panel-hover: #343945;
    --text: #f4f6fb;
    --muted: #b7bfcc;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #c026d3;
    --accent-2: #7c3aed;
    --accent-soft: rgba(192, 38, 211, 0.18);
    --danger: #b42318;
    --danger-hover: #8d1d14;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle 540px at top left, rgba(192, 38, 211, 0.14), transparent),
        radial-gradient(circle 440px at top center, rgba(124, 58, 237, 0.12), transparent),
        linear-gradient(180deg, #1b1d22 0%, #1c1e23 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 18px 18px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 22px 24px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        linear-gradient(135deg, #20232a, #17191d);
    box-shadow: var(--shadow);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    height: 62px;
    padding: 0 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
}

.brand-logo {
    height: 56px;
    width: auto;
    display: block;
    object-fit: contain;
}

.app-brand h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.app-brand p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.app-brand-text p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-user span {
    font-weight: 600;
    color: #fff;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #c0392b, var(--danger));
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #a93226, var(--danger-hover));
    transform: translateY(-1px);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    text-decoration: none;
    font-weight: 600;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.18s ease;
}

.main-nav a:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
    transform: translateY(-1px);
}

.main-nav-wrapper {
    margin-bottom: 28px;
}

.mobile-nav-toggle {
    display: none;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.18s ease;
}

.mobile-nav-toggle:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

/* Éléments du drawer — cachés sur desktop */
.nav-backdrop    { display: none; }
.nav-drawer-header { display: none; }

.page-content {
    min-height: 60vh;
}

.page-intro {
    margin-bottom: 18px;
}

.page-intro-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.page-intro h2 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 800;
}

.page-intro-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.page-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.back-link:hover {
    color: #fff;
}

.content-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.015));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.toolbar {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1 1 auto;
    min-width: 260px;
}

.search-box input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-size: 0.96rem;
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
    color: #9ea7b6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(192, 38, 211, 0.55);
    box-shadow: 0 0 0 3px rgba(192, 38, 211, 0.14);
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.9rem;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.22);
}

.btn-primary:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.btn-secondary {
    color: #fff;
    background: var(--panel);
    border-color: var(--line);
}

.btn-secondary:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

.btn-ghost {
    color: var(--muted);
    background: transparent;
    border-color: var(--line);
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.btn-danger {
    background: linear-gradient(135deg, #c0392b, #8d1d14);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #047857, #065f46);
    color: #fff;
}
.btn-success:hover {
    background: linear-gradient(135deg, #065f46, #064e3b);
    transform: translateY(-1px);
}

/* Form en ligne (sans marge) — utile pour intégrer un <form> au milieu
   d'autres boutons sans casser l'alignement. */
.inline-form {
    display: inline-block;
    margin: 0;
}

.btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--panel);
    border-color: var(--line);
    color: var(--muted);
}

.btn-block {
    width: 100%;
}

.list-section {
    margin-top: 4px;
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.item-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: 0.18s ease;
}

.item-card:hover {
    transform: translateY(-1px);
    border-color: rgba(192,38,211,0.35);
}

.item-card-body {
    padding: 20px;
}

.item-card-top h3 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.item-title {
    color: #fff;
    text-decoration: none;
}

.item-title::after {
    content: '';
    position: absolute;
    inset: 0;
}

.item-title:hover {
    color: #f3d9ff;
}

.item-card-footer .btn {
    position: relative;
    z-index: 1;
}

.item-meta {
    display: grid;
    gap: 12px;
}

.item-meta > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.item-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
}

.empty-state h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.empty-state p {
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--muted);
}

.empty-state-inline {
    padding: 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    color: var(--muted);
    text-align: center;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(192,38,211,0.35);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
}

.stat-value-small {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--muted);
}

.stat-sub {
    font-size: 0.78rem;
    color: var(--muted);
}

.stat-sub--danger {
    color: #f87171;
    font-weight: 600;
}

/* Bar chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding-top: 24px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
}

.bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

.bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
}

.bar-fill {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    min-height: 4px;
    transition: height 0.3s ease;
}

.bar-fill--empty {
    background: var(--line);
    border-radius: 4px;
}

.bar-label {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
}

/* Modal envoi mail */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #1e293b;
    border-radius: 10px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 12px 48px rgba(0,0,0,.4);
    color: #f1f5f9;
}

.modal-box .form-control {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #475569;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 0.92rem;
    color: #f1f5f9;
    background: #0f172a;
    outline: none;
    display: block;
}

.modal-box .form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,.2);
}

.modal-box .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #cbd5e1;
}

.modal-header h3 { color: #f1f5f9; }
.modal-close { color: #94a3b8; }
.modal-close:hover { background: #334155; }

.contact-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.contact-chip {
    background: #334155;
    color: #cbd5e1;
    border: 1.5px solid #475569;
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.contact-chip:hover {
    background: #475569;
    color: #f1f5f9;
}

.contact-chip--active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #fff;
}

.contact-chip--star {
    border-color: #f59e0b;
    color: #fcd34d;
}

.contact-chip--star.contact-chip--active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #fff;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--muted);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.modal-close:hover { background: var(--line); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

/* Texte d'avertissement dans une modale (confirmation suppression, etc.) */
.modal-warn-text {
    color: #cbd5e1;
    font-size: .88rem;
    background: rgba(180, 35, 24, 0.12);
    border-left: 3px solid var(--danger);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 12px 0 0;
}
.modal-warn-text strong { color: #fff; }

.form-group {
    margin-bottom: 0.9rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.form-error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* PDF staleness indicators */
.pdf-stale-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    cursor: default;
}

.pdf-ok-info {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.25rem 0.4rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
}

.notes-box {
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    line-height: 1.75;
}

.notes-empty {
    font-style: italic;
    color: var(--muted);
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.record-meta {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-top: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
}

.section-header h3 {
    margin: 0;
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    transition: 0.18s ease;
}

.mini-list-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(192,38,211,0.35);
}

.mini-list-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.empty-inline {
    color: var(--muted);
    font-style: italic;
    padding: 12px 0;
}

.form-card {
    max-width: 820px;
}

.styled-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
}

.required {
    color: #f87171;
    margin-left: 4px;
}

.help-text {
    color: var(--muted);
    font-size: 0.85rem;
}

.field-error {
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 600;
}

.form-global-errors {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
}

.styled-form input,
.styled-form select,
.styled-form textarea {
    width: 100%;
}

.styled-form textarea {
    min-height: 110px;
}

.danger-card {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 34px 28px;
}

.danger-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 18px;
    background: rgba(220, 38, 38, 0.12);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.danger-card h3 {
    margin: 0 0 16px;
    font-size: 1.4rem;
}

.danger-text {
    font-size: 1rem;
    margin-bottom: 10px;
}

.danger-subtext {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 24px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.filter-group {
    min-width: 180px;
}

.filter-card {
    padding: 18px 20px;
}

.demarche-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.demarche-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: 0.18s ease;
    position: relative;
    cursor: pointer;
}

.demarche-card:hover {
    transform: translateY(-1px);
    border-color: rgba(192,38,211,0.30);
}

.demarche-main {
    flex: 1;
}

.demarche-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.demarche-header h3 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
}

.demarche-header a {
    color: #fff;
}

.demarche-header a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.demarche-header a:hover {
    color: #f3d9ff;
}

.demarche-actions .btn {
    position: relative;
    z-index: 1;
}

.demarche-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-badge {
    display: inline-flex;
    width: fit-content;
    align-self: flex-start;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.status-open {
    background: rgba(59,130,246,0.16);
    color: #93c5fd;
}

.status-late {
    background: rgba(239,68,68,0.16);
    color: #fca5a5;
}

.status-closed {
    background: rgba(34,197,94,0.16);
    color: #86efac;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
    transition: 0.18s ease;
    text-decoration: none;
}

.timeline-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(192,38,211,0.35);
    transform: translateY(-1px);
}

.timeline-dot {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    flex-shrink: 0;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-title {
    font-weight: 700;
    color: #fff;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--muted);
}

.devis-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.devis-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: 0.18s ease;
    position: relative;
    cursor: pointer;
}

.devis-card:hover {
    transform: translateY(-1px);
    border-color: rgba(192,38,211,0.30);
}

.devis-main {
    flex: 1;
}

.devis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.devis-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.devis-header a {
    color: #fff;
}

.devis-header a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.devis-header a:hover {
    color: #f3d9ff;
}

.devis-actions .btn {
    position: relative;
    z-index: 1;
}

.devis-date {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.devis-objet {
    margin-bottom: 8px;
    color: #e6e9ef;
}

.devis-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-hero {
    margin-bottom: 24px;
}

.dashboard-company {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(192,38,211,0.12), rgba(59,130,246,0.08));
    border: 1px solid rgba(255,255,255,0.06);
}

.dashboard-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    padding: 10px;
}

.dashboard-company h1 {
    margin: 0 0 6px;
    font-size: 2rem;
    font-weight: 800;
}

.dashboard-company p {
    margin: 0;
    color: var(--muted);
}

.dashboard-company-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.dashboard-company-main {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.dashboard-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 220px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.05);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.dashboard-settings-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(192,38,211,0.35);
    transform: translateY(-1px);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

.quick-actions {
    display: grid;
    gap: 12px;
}

.quick-action-card {
    display: block;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    transition: 0.18s ease;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(192,38,211,0.45);
    box-shadow: 0 8px 24px rgba(192,38,211,0.15);
}

.quick-action-title {
    display: block;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.quick-action-sub {
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: 24px;
    background: rgba(17,24,39,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #c026d3, #7c3aed);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.auth-header h2 {
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--muted);
}

.auth-logo {
    width: 220px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    object-fit: contain;
}

.auth-actions {
    margin-top: 24px;
}

.form-errors {
    margin-bottom: 18px;
}

.form-error {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(220,38,38,0.12);
    border: 1px solid rgba(220,38,38,0.35);
    color: #fca5a5;
    font-size: 0.95rem;
}

.user-dropdown {
    position: relative;
}

.user-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px;
}

.user-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.user-dropdown-toggle:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

.chevron {
    font-size: 0.85rem;
    color: var(--muted);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    margin-top: 6px;
    padding: 10px;
    border-radius: 14px;
    background: #111827;
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0,0,0,0.28);
    display: none;
    z-index: 1200;
}

.user-dropdown:hover .user-dropdown-menu,
.user-dropdown:focus-within .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a,
.user-dropdown-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease;
}

.user-dropdown-menu a:hover,
.user-dropdown-logout:hover {
    background: rgba(255,255,255,0.05);
}

.user-dropdown-menu form {
    margin: 0;
    padding: 0;
}

.app-footer {
    margin-top: 44px;
    padding: 20px 10px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-user {
        width: 100%;
        justify-content: space-between;
    }

    .user-dropdown {
        width: 100%;
    }

    .user-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .user-dropdown-menu {
        left: 0;
        right: auto;
        width: 100%;
        min-width: unset;
    }

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

    .dashboard-company {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-company-row {
        align-items: flex-start;
    }

    .dashboard-settings-btn {
        width: 100%;
        justify-content: center;
    }
}

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

    .demarche-card,
    .devis-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .demarche-actions,
    .devis-actions {
        width: 100%;
    }

    .demarche-actions .btn,
    .devis-actions .btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 14px 12px 12px;
    }

    .app-brand h1 {
        font-size: 1.6rem;
    }

    /* Bouton hamburger */
    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: auto;
        margin-bottom: 12px;
    }

    .main-nav-wrapper {
        margin-bottom: 12px;
    }

    /* Backdrop semi-transparent */
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .58);
        z-index: 499;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
    }

    .nav-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Panneau drawer */
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: min(280px, 82vw);
        height: 100vh;
        background: var(--bg-soft);
        border-right: 1px solid var(--line);
        box-shadow: 4px 0 32px rgba(0, 0, 0, .5);
        z-index: 500;
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin-bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .main-nav.is-open {
        transform: translateX(0);
    }

    /* En-tête du drawer */
    .nav-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 16px;
        border-bottom: 1px solid var(--line);
        flex-shrink: 0;
    }

    .nav-drawer-brand {
        font-weight: 800;
        font-size: 1.05rem;
        background: linear-gradient(135deg, var(--accent), var(--accent-2));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .nav-drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: 1px solid var(--line);
        background: transparent;
        color: var(--muted);
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.18s ease;
        flex-shrink: 0;
    }

    .nav-drawer-close:hover {
        background: var(--panel-hover);
        color: var(--text);
    }

    /* Liens dans le drawer */
    .main-nav a {
        width: 100%;
        justify-content: flex-start;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--line);
        min-height: 52px;
        padding: 0 20px;
        box-shadow: none;
        font-size: 0.98rem;
        transition: background 0.15s ease, padding-left 0.15s ease;
    }

    .main-nav a:hover {
        transform: none;
        background: var(--panel-hover);
        border-color: var(--line);
        padding-left: 28px;
    }

    .page-intro-row {
        align-items: stretch;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 10px;
    }

    .toolbar-actions {
        width: 100%;
        margin-top: 0;
    }

    .toolbar-actions .btn {
        flex: 1 1 auto;
    }

    .filter-card {
        padding: 12px 14px;
    }

    .filter-card .search-box {
        flex: none;
        min-width: 0;
        width: 100%;
    }

    .filter-card .toolbar {
        gap: 10px;
        justify-content: flex-start;
    }

    .filter-card .search-box input,
    .filter-card .filter-group select,
    .filter-card .toolbar .btn {
        min-height: 40px;
    }

    .filter-card .toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
        margin-top: 0;
        align-self: stretch;
    }

    .filter-card .toolbar-actions .btn {
        width: 100%;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: rgba(255,255,255,0.04);
    color: #fff;
}

select option {
    background-color: #1f2430;
    color: #ffffff;
}

select option:checked,
select option:hover {
    background-color: #7c3aed;
    color: #ffffff;
}

.messages-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.message-alert {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-weight: 600;
    box-shadow: var(--shadow);
}

.message-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    color: #dcfce7;
}

.message-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fecaca;
}

.message-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
    color: #fde68a;
}

.message-info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
    color: #dbeafe;
}

.mail-history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mail-history-item {
    padding: 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-left: 3px solid rgba(192,38,211,0.55);
    transition: 0.18s ease;
}

.mail-history-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(192,38,211,0.35);
}

.mail-history-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mail-history-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.mail-history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mail-body-preview {
    max-height: 180px;
    overflow: auto;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0,0,0,0.16);
    border: 1px solid rgba(255,255,255,0.05);
    line-height: 1.7;
    color: #f4f6fb;
}

@media (max-width: 768px) {
    .mail-history-header {
        flex-direction: column;
    }

    .mail-history-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .mail-history-actions .btn {
        flex: 1 1 auto;
    }
}

.dashboard-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.dashboard-subtle-btn {
    opacity: 0.82;
    font-size: 0.9rem;
}

.dashboard-subtle-btn:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .dashboard-actions-stack {
        align-items: stretch;
        width: 100%;
    }
}

.plan-badge {
    display: inline-flex;
    margin-top: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #d1fae5;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.plan-badge.trial {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.28);
}

.cgu-row {
    display: flex;
    flex-direction: column;
    align-items: center;   /* ← LE point clé */
    gap: 10px;
}

.cgu-label {
    width: 100%;
    text-align: center;
    margin: 0;
}

.cgu-checkbox {
    display: flex;
    justify-content: center;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #98a2b8;
    display: flex;
    align-items: center;
    z-index: 1;
}

.toggle-password:hover {
    color: #7c3aed;
}

/* ---- CALENDRIER DÉMARCHES ---- */
.cal-card {
    padding: 24px;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.cal-month-title {
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-day-header {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding-bottom: 8px;
}

.cal-cell {
    min-height: 90px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-cell--empty {
    border-color: transparent;
    background: none;
}

.cal-cell--today {
    border-color: rgba(192, 38, 211, 0.5);
    background: rgba(192, 38, 211, 0.06);
}

.cal-day-num {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 2px;
}

.cal-cell--today .cal-day-num {
    color: #c026d3;
}

.cal-event {
    display: block;
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.cal-event.status-open {
    background: rgba(59,130,246,0.16);
    color: #93c5fd;
}

.cal-event.status-late {
    background: rgba(239,68,68,0.20);
    color: #fca5a5;
}

.cal-event--contrat {
    background: rgba(16,185,129,0.18);
    color: #6ee7b7;
    font-weight: 600;
}

.cal-event--negociation {
    background: rgba(249,115,22,0.18);
    color: #fdba74;
    font-weight: 600;
}

.cal-event--previsionnel {
    background: rgba(168,85,247,0.12);
    color: #d8b4fe;
    border: 1px dashed rgba(168,85,247,0.45);
    padding: 2px 5px;
}

.cal-event:hover {
    filter: brightness(1.2);
}

.cal-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--muted);
}

.cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.cal-dot.status-open     { background: #93c5fd; }
.cal-dot.status-late     { background: #fca5a5; }

/* ============================================================
   DEVIS / CONTRATS / FACTURES — badges d'état dans les listes
   ============================================================ */

.devis-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.doc-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .02em;
    white-space: nowrap;
}

.doc-badge--ok {
    background: rgba(16,185,129,.18);
    color: #6ee7b7;
}

.doc-badge--pending {
    background: rgba(245,158,11,.14);
    color: #fcd34d;
}

.doc-badge--sent {
    background: rgba(59,130,246,.16);
    color: #93c5fd;
}
.doc-badge--edited {
    background: rgba(168,162,158,.18);
    color: #d6d3d1;
}

/* Badges d'avancement démarche (statut métier) */
.status-statut-prospection {
    background: rgba(59,130,246,.16);
    color: #93c5fd;
}
.status-statut-relance {
    background: rgba(245,158,11,.16);
    color: #fcd34d;
}
.status-statut-devis {
    background: rgba(168,85,247,.16);
    color: #c4b5fd;
}
.status-statut-contrat {
    background: rgba(16,185,129,.16);
    color: #6ee7b7;
}
.status-statut-sans_suite {
    background: rgba(100,116,139,.16);
    color: #94a3b8;
}

/* Date d'échéance dépassée dans la liste */
.meta-late {
    color: #fca5a5;
    font-weight: 600;
}

/* Badges header démarche */
.demarche-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.doc-badge--lg {
    font-size: 0.82rem;
    padding: 4px 12px;
}

.stat-value--ok {
    color: #6ee7b7;
}

.stat-value--pending {
    color: #fcd34d;
}

/* ============================================================
   STRUCTURE LIST — filter bar & pipeline badges
   ============================================================ */

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-bar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-bar-search {
    flex: 1 1 260px;
    min-width: 200px;
}

/* Champ recherche compact (ex. liste démarches avec beaucoup de filtres) */
.filter-bar-search--sm {
    flex: 0 1 230px;
    min-width: 170px;
}

.filter-bar-select select,
.filter-bar-select--sm select {
    height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.88rem;
    cursor: pointer;
}

.filter-bar-select select {
    min-width: 180px;
}

.filter-bar-select--lg select {
    min-width: 260px;
}

.filter-bar-select--sm select {
    min-width: 120px;
}

.filter-bar-select select:focus,
.filter-bar-select--sm select:focus,
.filter-bar-select--lg select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.filter-bar-inactif {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}

.filter-inactif-label {
    font-size: 0.85rem;
}

.filter-inactif-input {
    width: 64px;
    height: 42px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.88rem;
    text-align: center;
}

/* Version ultra-compacte pour 2 chiffres max */
.filter-inactif-input--sm {
    width: 18px;
    height: 42px;
    padding: 0 2px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.88rem;
    text-align: center;
}

.filter-inactif-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.filter-inactif-unit {
    font-size: 0.85rem;
    color: var(--muted);
}

.filter-bar-actions {
    display: flex;
    gap: 10px;
}

/* Badge type de lieu sur les cartes structure */
.type-lieu-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(192, 38, 211, .14);
    color: #e879f9;
    letter-spacing: .02em;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 6px;
}

/* Compteur de résultats */
.list-count {
    font-size: 0.83rem;
    color: var(--muted);
    margin-bottom: 10px;
}

/* Pipeline badges sur les cartes */
.pipeline-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.pipeline-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .02em;
    white-space: nowrap;
}

.pipeline-badge--demarche {
    background: rgba(59,130,246,.18);
    color: #93c5fd;
}

.pipeline-badge--devis {
    background: rgba(245,158,11,.18);
    color: #fcd34d;
}

.pipeline-badge--contrat {
    background: rgba(16,185,129,.18);
    color: #6ee7b7;
}

.pipeline-badge--facture {
    background: rgba(168,85,247,.18);
    color: #c4b5fd;
}

/* Mobile */
@media (max-width: 640px) {
    .filter-bar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar-select select,
    .filter-inactif-input {
        width: 100%;
        min-width: 0;
    }

    .filter-bar-inactif {
        flex-wrap: wrap;
    }

    .filter-bar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
.cal-dot.cal-dot--contrat      { background: #6ee7b7; }
.cal-dot.cal-dot--negociation  { background: #fdba74; }
.cal-dot.cal-dot--previsionnel { background: #d8b4fe; }

/* -----------------------------------------------------------------------
   Pièces jointes
   ----------------------------------------------------------------------- */

.pj-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pj-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.pj-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

/* Badge extension */
.pj-ext {
    flex-shrink: 0;
    display: inline-block;
    padding: .15rem .4rem;
    border-radius: 4px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .03em;
    background: var(--muted);
    color: var(--bg);
}
.pj-ext--pdf  { background: #f87171; color: #fff; }
.pj-ext--jpg,
.pj-ext--jpeg,
.pj-ext--png  { background: #60a5fa; color: #fff; }
.pj-ext--doc,
.pj-ext--docx { background: #818cf8; color: #fff; }
.pj-ext--zip  { background: #fbbf24; color: #1c1e23; }

.pj-meta {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.pj-nom {
    color: var(--accent);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pj-nom:hover { text-decoration: underline; }

.pj-type {
    font-size: .72rem;
    color: var(--muted);
}

.pj-taille {
    font-size: .72rem;
    color: var(--muted);
}

.pj-delete-form { flex-shrink: 0; }

.pj-empty {
    color: var(--muted);
    font-size: .875rem;
    margin-bottom: 1.25rem;
}

/* Formulaire d'upload */
.pj-upload-form { margin-top: .5rem; }

.pj-upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.pj-file-input {
    flex: 1 1 200px;
    font-size: .83rem;
    color: var(--text);
}

.pj-nom-input {
    flex: 1 1 180px;
    padding: .4rem .65rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: .83rem;
}
.pj-nom-input::placeholder { color: var(--muted); }

.pj-type-select {
    flex: 0 1 180px;
    padding: .4rem .65rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: .83rem;
}

.pj-hint {
    margin: .4rem 0 0;
    font-size: .72rem;
    color: var(--muted);
}

/* Section "Documents de la prestation" (M2M) */
.section-header-sub {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 400;
    margin-left: .5rem;
}

.pj-prestation-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.pj-prestation-item {
    border-radius: 6px;
    transition: background .12s;
}
.pj-prestation-item:hover {
    background: var(--bg-soft);
}

.pj-prestation-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .5rem;
    cursor: pointer;
    border-radius: 6px;
}

.pj-prestation-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.pj-prestation-nom {
    font-size: .88rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

.pj-prestation-dl {
    flex-shrink: 0;
    color: var(--muted);
    font-size: .8rem;
    text-decoration: none;
    padding: .15rem .4rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: .12s;
}
.pj-prestation-dl:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.pj-prestation-actions {
    margin-top: .5rem;
}

/* Pièces jointes dans les formulaires d'envoi de mail */
.pj-mail-list {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: .5rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pj-mail-list--inline {
    background: transparent;
    border: none;
    padding: 0;
}

.pj-mail-group-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin: .4rem 0 .2rem;
}

.pj-mail-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .4rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: .85rem;
    transition: background .12s;
}
.pj-mail-item:hover {
    background: rgba(255,255,255,.05);
}
.pj-mail-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* -----------------------------------------------------------------------
   Import CSV de structures
   ----------------------------------------------------------------------- */

.import-rule-box {
    margin: 1rem 0;
    padding: .85rem 1rem;
    background: rgba(192,38,211,0.07);
    border: 1px solid rgba(192,38,211,0.35);
    border-radius: 8px;
}

.import-rule-title {
    margin: 0 0 .4rem;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--accent);
}

.import-rule-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: .86rem;
    color: var(--text);
}
.import-rule-list li {
    margin: .3rem 0;
}
.import-rule-list code {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .05rem .35rem;
    font-size: .82rem;
    color: var(--accent);
}

.import-help-list,
.import-help-codes {
    margin: .5rem 0 1rem;
    padding-left: 1.2rem;
    font-size: .88rem;
    color: var(--text);
}
.import-help-list li,
.import-help-codes li {
    margin: .2rem 0;
}

.import-help-codes {
    list-style: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .15rem .75rem;
}

.import-help-codes code,
.import-help-note code {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .05rem .35rem;
    font-size: .82rem;
    color: var(--accent);
}

.import-help-sub {
    font-size: .88rem;
    margin: .75rem 0 .25rem;
}

.import-help-note {
    font-size: .82rem;
    color: var(--muted);
    margin-top: .75rem;
}

.import-form-row {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}

.import-file-input {
    flex: 1 1 240px;
    font-size: .85rem;
    color: var(--text);
}

/* Rapport d'import */
.import-result {
    margin-bottom: 1rem;
}

.import-result-line {
    font-size: .95rem;
    margin: .35rem 0;
}
.import-result-line--ok   { color: #6ee7b7; }
.import-result-line--warn { color: #fbbf24; }
.import-result-line--err  { color: #f87171; }

.import-result-block {
    margin-top: .75rem;
}

.import-result-list {
    margin: .25rem 0 0;
    padding-left: 1.2rem;
    font-size: .83rem;
    color: var(--muted);
}
.import-result-list li {
    margin: .15rem 0;
}
.import-result-details summary {
    cursor: pointer;
    font-size: .83rem;
    color: var(--muted);
    user-select: none;
    margin-top: 4px;
    padding-left: 1.2rem;
    list-style: none;
}
.import-result-details summary::-webkit-details-marker { display: none; }
.import-result-details summary::before {
    content: '▸ ';
    display: inline-block;
    margin-right: 4px;
}
.import-result-details[open] > summary::before { content: '▾ '; }
.import-result-details summary:hover { color: var(--text); }

/* Mini-list — carte cliquable (stretched link) */
.mini-list-item--clickable {
    position: relative;
    cursor: pointer;
}
.mini-list-item--clickable:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(192,38,211,0.35);
    transform: translateY(-1px);
}

.mini-list-stretched-link {
    color: inherit;
    text-decoration: none;
}
.mini-list-stretched-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
}
.mini-list-stretched-link:hover {
    color: #f3d9ff;
}

/* ============================================================
   Carte des structures (Leaflet)
   ============================================================ */
.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.map-stats {
    font-size: .9rem;
    color: var(--muted);
}
.map-stats strong {
    color: var(--text);
}
.map-stats-warn {
    color: #f59e0b;
}

.map-card {
    padding: 14px;
}
.structure-map-canvas {
    width: 100%;
    height: 600px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 12px;
    font-size: .82rem;
    color: var(--muted);
}
.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.map-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: inline-block;
    flex-shrink: 0;
}
.map-dot--contrat  { background: #16a34a; }
.map-dot--devis    { background: #2563eb; }
.map-dot--demarche { background: #f59e0b; }
.map-dot--prospect { background: #94a3b8; }

/* Popups Leaflet — contenu */
.map-popup strong {
    font-size: .95rem;
}
.map-popup-type {
    color: #c026d3;
    font-size: .78rem;
    margin-top: 2px;
}
.map-popup-ville {
    color: #555;
    font-size: .82rem;
    margin-top: 2px;
}
.map-popup-link {
    display: inline-block;
    margin-top: 8px;
    font-size: .82rem;
    font-weight: 600;
    color: #c026d3;
    text-decoration: none;
}
.map-popup-link:hover {
    text-decoration: underline;
}

/* Historique d'activité (timeline) sur la fiche structure */
.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: var(--line);
}
.timeline-item {
    position: relative;
    padding: 8px 0 8px 30px;
    min-height: 28px;
}
.timeline-marker {
    position: absolute;
    left: 4px;
    top: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--muted);
    border: 2px solid #1c1e23;
    box-shadow: 0 0 0 1px var(--line);
}
.timeline-item--creation .timeline-marker { background: #94a3b8; }
.timeline-item--demarche .timeline-marker { background: #f59e0b; }
.timeline-item--echange  .timeline-marker { background: #06b6d4; }
.timeline-item--mail     .timeline-marker { background: #a855f7; }
.timeline-item--devis    .timeline-marker { background: #2563eb; }
.timeline-item--contrat  .timeline-marker { background: #16a34a; }
.timeline-item--facture  .timeline-marker { background: #db2777; }
.timeline-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.timeline-libelle {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
a.timeline-libelle:hover {
    color: #f3d9ff;
}
.timeline-date {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}
.timeline-detail {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* Liste dépliante des structures non localisées (page carte) */
.non-loc-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    padding: 4px 0;
    user-select: none;
}
.non-loc-details summary::-webkit-details-marker { display: none; }
.non-loc-details summary::before {
    content: '▸ ';
    display: inline-block;
    margin-right: 4px;
}
.non-loc-details[open] summary::before {
    content: '▾ ';
}
.non-loc-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.non-loc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}
.non-loc-main {
    min-width: 0;
    flex: 1;
}
.non-loc-nom {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.non-loc-nom:hover {
    color: #f3d9ff;
}
.non-loc-adresse {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* Les boutons d'action restent cliquables par-dessus le lien étendu */
.detail-actions--raised {
    position: relative;
    z-index: 1;
}

/* ============================================================
   Vue tableau (liste structures et autres listes data-grid)
   ============================================================ */

/* Bascule cartes / tableau dans la barre d'actions de page */
.view-toggle {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    background: var(--panel);
    box-shadow: inset 0 0 0 1px var(--line);
}
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    height: 38px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}
.view-toggle-btn--active,
.view-toggle-btn--active:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

/* Barre d'actions de masse (au-dessus du tableau) */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}
.bulk-count {
    font-size: .9rem;
    color: var(--muted);
}
.bulk-count #bulk-count {
    color: var(--text);
    font-weight: 700;
}

/* Tableau de données */
.data-table-wrap {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.015));
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table thead th {
    /* En-tête figé en haut quand on scrolle verticalement.
       Fond opaque obligatoire pour masquer les lignes qui passent dessous. */
    position: sticky;
    top: 0;
    z-index: 2;
    background: #2b2f37;
    color: var(--muted);
    text-align: left;
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }

/* En-têtes triables */
.data-th-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
}
.data-th-link:hover { color: var(--text); }
.data-th-link--active { color: var(--text); }
.sort-ind {
    font-size: .9rem;
    color: var(--accent);
}

/* Cellules spécifiques */
.data-th-check, .data-td-check {
    width: 38px;
    padding-right: 0;
}
.data-th-check input, .data-td-check input { cursor: pointer; }
.data-td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pied de tableau — ligne de totaux */
.data-table tfoot td {
    background: #2b2f37;
    border-top: 2px solid var(--line);
    color: var(--text);
    font-weight: 700;
    padding: 12px 14px;
    position: sticky;
    bottom: 0;
    z-index: 1;
}
.data-td-total-label {
    text-align: right;
    color: var(--muted);
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .04em;
}
.data-td-mail {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-td-actions { text-align: right; padding: 8px 12px; }
.data-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.data-link:hover { color: #f3d9ff; }

/* ============================================================
   Barre de progression (modale de géolocalisation, etc.)
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    margin: 14px 0 8px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 6px;
    transition: width 0.25s ease;
}
.progress-text {
    text-align: center;
    color: var(--muted);
    margin: 0 0 8px;
    font-size: .9rem;
}
.progress-text strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* Formulaire d'import du PDF rempli (dans la section dépliable) */
.fiche-import-form {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}
.fiche-import-label {
    display: block;
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 6px;
}
.fiche-import-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.fiche-import-row input[type="file"] {
    flex: 1 1 auto;
    min-width: 200px;
    padding: 8px;
}

/* Écran de validation : tableau de comparaison + grilles de form */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    margin-top: 8px;
}
.compare-table th {
    text-align: left;
    color: var(--muted);
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .04em;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
}
.compare-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.compare-current { color: var(--muted); }
.compare-apply   { text-align: center; }
.compare-table input[type="text"] {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
}
.form-fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 12px 0;
}
.form-fieldset legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.form-fieldset label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}
/* Surcharge les radios/checkbox que .styled-form passe par défaut en width:100% */
.form-fieldset input[type="radio"],
.form-fieldset input[type="checkbox"],
.styled-form input[type="radio"],
.styled-form input[type="checkbox"] {
    width: auto;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0;
}
.form-grid {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group-full { grid-column: 1 / -1; }
.form-group label {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    margin-bottom: 4px;
}

/* Section dépliable "Fiche de renseignements" sur la fiche démarche */
.fiche-renseignements-details summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.fiche-renseignements-details summary::-webkit-details-marker { display: none; }
.fiche-renseignements-details summary::before {
    content: '▸';
    font-size: .9rem;
    color: var(--muted);
    transition: transform 0.15s ease;
    display: inline-block;
}
.fiche-renseignements-details[open] summary::before { content: '▾'; }
.fiche-renseignements-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.fiche-renseignements-body {
    margin-top: 16px;
    padding-left: 16px;
    border-left: 2px solid var(--line);
}
.fiche-renseignements-body p { margin: 0 0 12px; }