/* CRM HYS Consulting Tech — thème clair « carte », inspiré des CRM modernes
   (fond gris doux, cartes blanches, accent bleu, rail d'icônes déployable).
   Écrit à la main, pas de Tailwind CLI. */

:root {
    /* Surfaces */
    --canvas: #f1f2f4;
    --surface: #ffffff;
    --surface-alt: #f7f8fa;
    --border: #e4e6e9;
    --border-soft: #eef0f2;

    /* Texte */
    --text: #2b2f33;
    --text-muted: #6b7178;
    --text-faint: #98a0a8;

    /* Accent */
    --accent: #5b8fc7;
    --accent-strong: #3f7cbb;
    --accent-weak: #eaf1f9;
    --stat: #6ea0d6;

    /* Statuts */
    --danger: #c0392b;
    --danger-weak: #fdecea;
    --success: #3a9b63;
    --success-weak: #e8f5ec;
    --warning: #b9770e;
    --warning-weak: #fdf3e3;

    --radius: 4px;
    --radius-lg: 6px;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
    --shadow-pop: 0 6px 24px rgba(16, 24, 40, 0.12);

    --rail: 56px;
    --rail-open: 236px;

    /* Alias de compatibilité (anciens templates) */
    --color-hys-blue: var(--accent);
    --color-hys-blue-dark: var(--accent-strong);
    --color-hys-blue-pale: var(--accent-weak);
    --color-sustainable-green: var(--success);
    --color-gray-50: var(--surface-alt);
    --color-gray-100: var(--border-soft);
    --color-gray-200: var(--border);
    --color-gray-400: var(--text-faint);
    --color-gray-600: var(--text-muted);
    --color-gray-900: var(--text);
    --color-danger: var(--danger);
    --color-warning: var(--warning);
}

* {
    box-sizing: border-box;
}

/* L'attribut `hidden` doit toujours l'emporter, même sur un `display` inline
   (ex. un overlay `display:flex` de modale). */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
}

.icon {
    display: block;
    flex: none;
}

/* ---- Indicateur de chargement (cercle animé) ---- */
.turbo-progress-bar {
    display: none !important;
}

.app-progress {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(241, 242, 244, 0.55);
}

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--accent-weak);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinner-rotate 0.7s linear infinite, spinner-pulse 1.4s ease-in-out infinite;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

/* Le rayon augmente puis revient (respiration) */
@keyframes spinner-pulse {
    0%, 100% {
        scale: 0.8;
    }
    50% {
        scale: 1;
    }
}

.spinner--sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
    animation: spinner-rotate 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: spinner-rotate 1.6s linear infinite;
    }
}

/* ===================================================================
   Ossature : rail d'icônes fixe + colonne de contenu
   =================================================================== */
.app-layout {
    min-height: 100vh;
    padding-left: var(--rail);
}

.app-layout--guest {
    padding-left: 0;
}

/* ---- Rail latéral (déployable au survol) ---- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--rail);
    z-index: 40;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.16s ease, box-shadow 0.16s ease;
}

.app-sidebar:hover,
.app-sidebar:focus-within {
    width: var(--rail-open);
    box-shadow: var(--shadow-pop);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 56px;
    padding: 0 18px;
    flex: none;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
}

.app-sidebar__brand-mark {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.app-sidebar__nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.app-sidebar__nav a,
.app-sidebar__logout button {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 42px;
    padding: 0 18px;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text-muted);
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.app-sidebar__nav a:hover,
.app-sidebar__logout button:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.app-sidebar__nav a.active {
    color: var(--accent-strong);
    background: var(--accent-weak);
    border-left-color: var(--accent);
    font-weight: 600;
}

.app-sidebar__logout {
    flex: none;
    border-top: 1px solid var(--border-soft);
    margin: 0;
}

.app-sidebar__label {
    opacity: 0;
    transition: opacity 0.12s ease;
}

.app-sidebar:hover .app-sidebar__label,
.app-sidebar:focus-within .app-sidebar__label {
    opacity: 1;
}

/* ---- Colonne de contenu ---- */
.app-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Barre du haut ---- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-topbar__heading {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.app-topbar__search {
    position: relative;
    flex: 1;
    max-width: 420px;
    margin: 0 auto 0 8px;
    display: flex;
    align-items: center;
}

.app-topbar__search .icon {
    position: absolute;
    left: 10px;
    color: var(--text-faint);
    pointer-events: none;
}

.app-topbar__search input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    font: inherit;
    font-size: 0.85rem;
}

.app-topbar__search input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-weak);
}

.app-topbar__menu {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin-left: auto;
    height: 100%;
}

.app-topbar__menu a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    border-bottom: 2px solid transparent;
}

.app-topbar__menu a:hover {
    color: var(--text);
    background: var(--surface-alt);
}

.app-topbar__menu a.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
}

.app-topbar__avatar {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.app-topbar__role {
    font-size: 0.72rem;
    color: var(--text-faint);
}

/* Menu déroulant natif <details> de la barre du haut (Paramétrage) */
.app-topbar__group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.app-topbar__group > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    list-style: none;
    border-bottom: 2px solid transparent;
    user-select: none;
}

.app-topbar__group > summary::-webkit-details-marker { display: none; }
.app-topbar__group > summary::marker { content: ''; }

.app-topbar__group > summary:hover,
.app-topbar__group[open] > summary {
    color: var(--text);
    background: var(--surface-alt);
}

.app-topbar__group > summary.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
}

.app-topbar__submenu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    z-index: 40;
}

.app-topbar__submenu a {
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
}

.app-topbar__submenu a:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.app-topbar__submenu a.active {
    color: var(--accent-strong);
}

@media (max-width: 860px) {
    .app-topbar__menu a span,
    .app-topbar__group > summary span {
        display: none;
    }
    .app-topbar__heading {
        display: none;
    }
}

/* ---- Zone principale ---- */
.app-main {
    flex: 1;
    padding: 20px;
    max-width: 100%;
}

.app-main--guest {
    padding: 0;
}

.app-main__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.app-main__header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}

/* ===================================================================
   Composants
   =================================================================== */

/* ---- Cartes ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.card__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.card__menu {
    border: 0;
    background: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: var(--radius);
    text-decoration: none;
}

.card__menu:hover {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.card__body {
    padding: 16px;
}

/* ---- Grille de widgets ---- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ---- Statistique (grand chiffre) ---- */
.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat__value {
    font-size: 2.6rem;
    font-weight: 300;
    line-height: 1;
    color: var(--stat);
}

.stat__label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ---- Tuile chiffre cliquable (tableau de bord) ---- */
.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-decoration: none;
    color: inherit;
}

.stat-tile:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-card);
}

.stat-tile__value {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    color: var(--stat);
}

.stat-tile__label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-tile--total {
    background: var(--accent-weak);
    border-color: var(--accent);
}

.stat-tile--total .stat-tile__value {
    color: var(--accent-strong);
    font-weight: 600;
}

.stat-tile--total .stat-tile__label {
    color: var(--accent-strong);
}

/* Variante compacte (tableau de bord) */
.widget-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
}

.stat-tile--sm {
    padding: 10px 12px;
}

.stat-tile--sm .stat-tile__value {
    font-size: 1.4rem;
}

.stat-tile--sm .stat-tile__label {
    font-size: 0.72rem;
}

/* ---- Graphes du tableau de bord ---- */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.chart-box {
    position: relative;
    height: 320px;
}

@media (max-width: 900px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

/* ---- Boutons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.btn-outline {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--accent-weak);
    color: var(--accent-strong);
    white-space: nowrap;
}

.badge--success { background: var(--success-weak); color: var(--success); }
.badge--danger  { background: var(--danger-weak); color: var(--danger); }
.badge--warning { background: var(--warning-weak); color: var(--warning); }
.badge--muted   { background: var(--border-soft); color: var(--text-muted); }

/* ---- Alertes ---- */
.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-weak);
    color: var(--success);
    border-color: #bfe3cc;
}

.alert-error,
.alert-danger {
    background: var(--danger-weak);
    color: var(--danger);
    border-color: #f2c4be;
}

.alert-info {
    background: var(--accent-weak);
    color: var(--accent-strong);
    border-color: #c7dcef;
}

/* ---- Formulaires ---- */
form .form-row {
    margin-bottom: 1rem;
}

form label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form input[type="password"],
form input[type="number"],
form input[type="date"],
form input[type="datetime-local"],
form input[type="search"],
form select,
form textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--surface);
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-weak);
}

form .form-help,
form .help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

form .form-errors,
.form-error,
form .help + ul,
form label + ul {
    color: var(--danger);
    font-size: 0.8rem;
    margin: 0.25rem 0 0;
    padding-left: 1rem;
}

/* Rendu des formulaires Symfony (form_div_layout) */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 20px;
}

form > div,
.form-grid > div {
    margin-bottom: 1rem;
}

form .checkbox label,
form label.checkbox-inline {
    font-weight: 400;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* ---- Formulaire d'opportunité : largeur réduite, 3 colonnes, onglets ---- */
.card--form {
    max-width: 920px;
}

.opp-form .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1080px) {
    .opp-form .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .opp-form .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.form-tabs__tab {
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
    padding: 8px 14px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.form-tabs__tab:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.form-tabs__tab.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

[data-tabs-target="panel"] {
    padding-top: 4px;
}

/* ---- Formulaire d'opportunité : labels 1rem, fond des champs, icône d'aide ---- */
.opp-form label {
    display: inline-block;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.opp-form input[type="text"],
.opp-form input[type="email"],
.opp-form input[type="tel"],
.opp-form input[type="password"],
.opp-form input[type="number"],
.opp-form input[type="date"],
.opp-form input[type="datetime-local"],
.opp-form select,
.opp-form textarea,
.opp-form .ts-control {
    background: #e0d8d8;
}

.opp-form .ts-wrapper.focus .ts-control {
    background: #e0d8d8;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.help-icon:hover,
.help-icon:focus-visible {
    background: var(--accent);
    outline: none;
}

.help-icon:hover::after,
.help-icon:focus::after {
    content: attr(data-help);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 240px;
    padding: 7px 10px;
    background: var(--text);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    z-index: 60;
    pointer-events: none;
}

/* Champ « client » + bouton d'ajout rapide */
.field-add {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 1rem;
}

.field-add > div {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.btn-icon {
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.15rem;
    line-height: 1;
    display: grid;
    place-items: center;
}

.form-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 560px) {
    .form-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* ---- Popup (élément <dialog> natif) ---- */
.dialog {
    border: 0;
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-pop);
    max-width: 560px;
    width: 92vw;
    color: var(--text);
    background: var(--surface);
}

.dialog::backdrop {
    background: rgba(16, 24, 40, 0.45);
}

.dialog--wide {
    max-width: 940px;
    width: 94vw;
}

.dialog__toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dialog__toolbar .dialog__title {
    flex: 1;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-viewer__frame {
    width: 100%;
    height: 70vh;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.dialog__body {
    padding: 20px;
}

.dialog__title {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 600;
}

.dialog label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dialog label input,
.dialog label textarea,
.dialog label select {
    margin-top: 4px;
}

.dialog__msg {
    margin: 4px 0 12px;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 0.82rem;
}

.dialog__msg--error {
    background: var(--danger-weak);
    color: var(--danger);
}

.dialog__msg--info {
    background: var(--accent-weak);
    color: var(--accent-strong);
}

.dialog--error .dialog__title {
    color: var(--danger);
}

.dialog__error-list {
    margin: 6px 0 4px;
    padding-left: 1.1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.dialog__error-list li {
    margin-bottom: 4px;
}

/* ---- Tom Select : accord avec le thème ---- */
.ts-wrapper {
    font-size: 0.88rem;
}

.ts-control {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    min-height: 38px;
    box-shadow: none;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-weak);
}

.ts-dropdown {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    margin-top: 3px;
}

.ts-dropdown .active {
    background: var(--accent-weak);
    color: var(--accent-strong);
}

.ts-dropdown .option {
    padding: 7px 10px;
}

/* ---- Détail (paires clé/valeur) ---- */
.detail-list {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 10px 16px;
    font-size: 1rem;
}

.detail-list dt {
    color: var(--text-muted);
}

.detail-list dd {
    margin: 0;
}

/* ---- Ligne de progression (fiche opportunité) ---- */
.stepper {
    list-style: none;
    display: flex;
    margin: 0 0 18px;
    padding: 0;
}

.stepper__step {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: 0.76rem;
    color: var(--text-faint);
    min-width: 0;
}

.stepper__step::before {
    content: '';
    position: absolute;
    top: 11px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.stepper__step:first-child::before {
    display: none;
}

.stepper__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: 0 auto 6px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    font-size: 11px;
    font-weight: 700;
}

.stepper__name {
    display: block;
    padding: 0 4px;
}

.stepper__step--done {
    color: var(--text-muted);
}

.stepper__step--done::before,
.stepper__step--current::before {
    background: var(--success);
}

.stepper__step--done .stepper__dot {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.stepper__step--current {
    color: var(--accent-strong);
    font-weight: 600;
}

.stepper__step--current .stepper__dot {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.status-banner {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.status-banner--danger {
    background: var(--danger-weak);
    color: var(--danger);
    border: 1px solid #f2c4be;
}

/* ---- Barre d'actions de statut (sous la fiche) ---- */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.action-bar__label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-right: 2px;
}

.action-bar__item {
    margin: 0;
}

/* ---- Fiche + rail d'interactions ---- */
.opp-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.opp-layout__main {
    flex: 1;
    min-width: 0;
}

.opp-layout__main .card--form {
    max-width: none;
}

.interaction-rail {
    flex: none;
    width: 116px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.interaction-rail > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.interaction-rail__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 10px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.74rem;
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.interaction-rail__btn:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.interaction-rail__btn .icon {
    width: 20px;
    height: 20px;
}

@media (max-width: 860px) {
    .opp-layout {
        flex-direction: column;
    }
    .interaction-rail {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .interaction-rail > div {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .interaction-rail__btn {
        width: auto;
        flex-direction: row;
    }
}

/* ---- Listes en cartes (interactions / documents / tâches d'une fiche) ---- */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    padding: 12px 14px;
}

.record-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.record-card__title {
    font-weight: 600;
}

.record-card__meta {
    font-size: 0.78rem;
    color: var(--text-faint);
    margin-left: auto;
}

.record-card__body {
    margin: 0;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.record-card__foot {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-faint);
}

.record-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.record-card__actions form {
    margin: 0;
}

/* ---- Alertes proactives ---- */
.alerte-group {
    border-left: 3px solid var(--border);
    margin-bottom: 14px;
}

.alerte-group--danger {
    border-left-color: var(--danger);
}

.alerte-group--warning {
    border-left-color: var(--warning);
}

.alerte-group__consigne {
    margin-top: 0;
    margin-bottom: 10px;
}

.alerte-group__ok {
    margin: 0;
    font-size: 0.85rem;
    color: var(--success);
}

a.alerte-item {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.alerte-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-weak);
}

/* Pastille de compteur sur le lien « Alerte » de la barre du haut */
.app-topbar__alerte {
    position: relative;
}

.app-topbar__count {
    display: inline-grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

/* ---- Barre de filtres ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.filter-bar a {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
}

.filter-bar a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.filter-bar--form {
    align-items: center;
    margin-bottom: 10px;
}

.filter-bar--form label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.filter-bar--form input[type="date"] {
    width: auto;
    height: 32px;
    padding: 2px 8px;
    font-size: 0.82rem;
}

.filter-bar--form .btn {
    padding: 0.3rem 0.7rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ---- Calendrier des tâches ---- */
.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-nav__label {
    min-width: 140px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--border-soft);
    gap: 1px;
}

.calendar__weekday {
    background: var(--surface-alt);
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-faint);
}

.calendar__day {
    background: var(--surface);
    min-height: 104px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendar__day--muted {
    background: var(--surface-alt);
}

.calendar__day--muted .calendar__daynum {
    color: var(--text-faint);
}

.calendar__daynum {
    font-size: 0.78rem;
    color: var(--text-muted);
    align-self: flex-end;
}

.calendar__day--today .calendar__daynum {
    background: var(--accent);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.calendar__task {
    display: block;
    padding: 3px 6px;
    border-radius: var(--radius);
    background: var(--accent-weak);
    border-left: 3px solid var(--accent);
    font-size: 0.74rem;
    line-height: 1.25;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
}

.calendar__task-label {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.calendar__task-sub {
    display: block;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar__task--faite {
    background: var(--success-weak);
    border-left-color: var(--success);
}

.calendar__task--annulee {
    background: var(--border-soft);
    border-left-color: var(--text-faint);
    opacity: 0.7;
    text-decoration: line-through;
}

@media (max-width: 720px) {
    .calendar__day {
        min-height: 72px;
    }
    .calendar__task-sub {
        display: none;
    }
}

/* ---- Tables ---- */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

table.data-table th,
table.data-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.86rem;
}

table.data-table th {
    color: var(--text-faint);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table.data-table tbody tr:hover {
    background: var(--surface-alt);
}

/* ---- Checklists ---- */
.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.checklist input[type="checkbox"] {
    margin-top: 0.2rem;
}

/* ---- Pipeline Kanban (legacy, conservé pour la reconstruction) ---- */
.pipeline-board {
    display: flex;
    gap: 0.9rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.pipeline-column {
    flex: 0 0 260px;
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.pipeline-column__title {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-column__count {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pipeline-column.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.opp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.6rem;
    cursor: grab;
    font-size: 0.85rem;
    box-shadow: var(--shadow-card);
}

.opp-card:active {
    cursor: grabbing;
}

.opp-card__title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.opp-card__meta {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.opp-card--missing-next-action {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px var(--danger);
}

/* ---- Login ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--accent-weak), var(--canvas));
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    font-size: 1.15rem;
    margin-top: 0;
    color: var(--text);
}

.login-card .btn {
    width: 100%;
    justify-content: center;
}
