:root {
    --accent: #4B6DAC;
    --accent-hover: #3A5789;
    --bg: #F3F6FB;
    --surface: #FFFFFF;
    --border: #DEE5F0;
    --text: #1C2233;
    --text-muted: #626B80;
    --edit: #B9740E;
    --edit-bg: rgba(185, 116, 14, 0.12);
    --delete: #C4453C;
    --delete-bg: rgba(196, 69, 60, 0.12);
    --ok: #2F8F5B;
    --ok-bg: rgba(47, 143, 91, 0.12);
    --neutral-pill: #6B7280;
    --neutral-pill-bg: rgba(107, 114, 128, 0.12);
    --warn: #C1791C;
    --warn-bg: rgba(193, 121, 28, 0.12);
    --shadow: 0 1px 2px rgba(20, 26, 43, 0.06), 0 8px 24px rgba(20, 26, 43, 0.06);
    --row-alt: #EEF3FC;
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

h1 {
    font-size: 1.4rem;
    margin: 0 0 1rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.title-icon {
    display: inline-flex;
    color: var(--accent);
    flex: none;
}

.title-icon svg {
    width: 26px;
    height: 26px;
}

/* --- Identity strip + navigation --- */

.identity-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    padding: 0.6rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.identity-strip .logo {
    display: block;
    height: 32px;
    width: auto;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.user-chip:hover {
    background: var(--bg);
    color: var(--text);
}

.identity-strip a {
    display: inline-flex;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex: none;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--accent);
    padding: 0 1.5rem;
}

.app-nav a {
    position: relative;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.85rem 0.95rem;
    display: inline-block;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.app-nav a::after {
    content: "";
    position: absolute;
    left: 0.95rem;
    right: 0.95rem;
    bottom: 0;
    height: 2px;
    background: #fff;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.app-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-nav a:hover::after {
    transform: scaleX(1);
}

.app-nav a.active {
    color: #fff;
    font-weight: 600;
}

.app-nav a.active::after {
    transform: scaleX(1);
}

.app-nav-logout {
    margin-left: auto;
}

.app-content {
    max-width: 1040px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
}

/* --- Buttons --- */

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.55rem 1.05rem;
    border-radius: 7px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn:active {
    transform: translateY(1px);
}

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

/* --- Tables & icon actions --- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

thead tr:first-child th:first-child { border-top-left-radius: 8px; }
thead tr:first-child th:last-child { border-top-right-radius: 8px; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }

tbody tr:nth-child(even) {
    background: var(--row-alt);
}

th, td {
    text-align: left;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #EEF1F7;
    font-size: 0.86rem;
}

th {
    background: #F6F8FC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

.mono, td.mono {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    color: #3a4256;
}

td.mono {
    white-space: nowrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.neutral { background: var(--neutral-pill-bg); color: var(--neutral-pill); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.delete { background: var(--delete-bg); color: var(--delete); }

.actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.actions form {
    margin: 0;
    display: inline;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.icon-btn:hover {
    filter: brightness(0.92);
}

.icon-btn:active {
    transform: translateY(1px);
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.icon-btn.edit {
    background: var(--edit-bg);
    color: var(--edit);
}

.icon-btn.delete {
    background: var(--delete-bg);
    color: var(--delete);
}

.icon-btn.view {
    background: rgba(75, 109, 172, 0.12);
    color: var(--accent);
}

.icon-btn.folder {
    background: var(--neutral-pill-bg);
    color: var(--neutral-pill);
}

/* --- Forms --- */

.form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 640px;
}

.field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.field-row {
    display: flex;
    gap: 1rem;
}

.field-row .field {
    flex: 1;
}

.field-checkbox {
    flex-direction: row;
    align-items: center;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

input, select, textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

.form-actions a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
}

.form-actions a:hover {
    color: var(--text);
}

.error {
    color: var(--delete);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

.success {
    color: var(--ok);
    background: var(--ok-bg);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

.form h2 {
    font-size: 0.95rem;
    margin: 0 0 1.1rem;
}

/* --- Dashboard --- */

.section {
    margin-bottom: 2.25rem;
}

.section h2 {
    font-size: 1rem;
    margin: 0 0 0.9rem;
}

.section .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -0.5rem 0 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-value.warn { color: var(--warn); }
.stat-value.delete { color: var(--delete); }
.stat-value.ok { color: var(--ok); }

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

td.num, th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.total, th.total {
    font-weight: 700;
    background: #F6F8FC;
}

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

/* --- Fil de commentaires (affaire) --- */

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.comment-form textarea {
    width: 100%;
    resize: vertical;
}

.comment-form .form-actions {
    margin-top: 0;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-item {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

.comment-meta .mono {
    color: var(--text-muted);
}

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

.comment-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
}

.comment-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.comment-actions summary {
    display: inline-block;
    cursor: pointer;
    list-style: none;
}

.comment-actions summary::-webkit-details-marker {
    display: none;
}

.comment-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.6rem;
    min-width: 280px;
}

.comment-edit-form textarea {
    width: 100%;
    resize: vertical;
}

.comment-edit-form .form-actions {
    margin-top: 0;
}

/* --- Login page --- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem 2.25rem 2.25rem;
    text-align: center;
}

.auth-card .logo {
    height: 40px;
    width: auto;
    margin-bottom: 1.5rem;
}

.auth-card h1 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-card .form {
    box-shadow: none;
    padding: 0;
    max-width: none;
    text-align: left;
}

.auth-card .form-actions {
    margin-top: 1.25rem;
}

.auth-card .btn {
    width: 100%;
    text-align: center;
    padding: 0.65rem 1rem;
}

.auth-card .error {
    background: var(--delete-bg);
    color: var(--delete);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

/* --- Recherche + tri de colonnes --- */

.search-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.search-bar input[type="search"] {
    flex: 0 1 320px;
    width: 320px;
}

.search-bar .clear-search {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.search-bar .clear-search:hover {
    color: var(--text);
}

th a.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: inherit;
    text-decoration: none;
}

th a.sort-link:hover {
    color: var(--accent);
}

.sort-arrow {
    font-size: 0.7rem;
}

.sort-arrow.muted {
    opacity: 0.35;
}

/* --- Vue détail affaire --- */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1.1rem 2rem;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.5rem 1.75rem;
    max-width: 860px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.detail-field.detail-wide {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-field .icon-btn {
    vertical-align: middle;
    margin-right: 0.4rem;
}

/* --- Pied de page --- */

.app-footer {
    text-align: center;
    padding: 1.5rem 1rem 2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Toast (copie de chemin, etc.) --- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(12px);
    background: var(--text);
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    max-width: 90vw;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Planning --- */

.btn-ghost {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-ghost:hover {
    text-decoration: underline;
}

.text-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

.planning-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.planning-range {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.planning-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.planning-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: none;
}

.planning-table th,
.planning-table td {
    border-bottom: 1px solid #EEF1F7;
    border-right: 1px solid #EEF1F7;
    vertical-align: top;
}

.planning-table th:last-child,
.planning-table td:last-child {
    border-right: none;
}

.planning-table th {
    white-space: normal;
    text-align: center;
    min-width: 110px;
}

.planning-table th:first-child {
    text-align: left;
    min-width: 160px;
}

.planning-name {
    font-weight: 600;
    white-space: nowrap;
}

.planning-cell {
    min-width: 110px;
    padding: 0.4rem 0.5rem;
}

.planning-cell:empty::after {
    content: "";
}

.planning-pill {
    display: block;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    text-align: center;
    line-height: 1.3;
}

.planning-pill:last-child {
    margin-bottom: 0;
}

.planning-pill.visite {
    background: rgba(75, 109, 172, 0.12);
    color: var(--accent);
}

.planning-pill.visite:hover {
    background: rgba(75, 109, 172, 0.22);
}

.planning-pill.absence-conge {
    background: var(--ok-bg);
    color: var(--ok);
}

.planning-pill.absence-formation {
    background: var(--neutral-pill-bg);
    color: var(--neutral-pill);
}

.planning-pill.absence-maladie {
    background: var(--delete-bg);
    color: var(--delete);
}

.planning-pill.absence-autre {
    background: var(--warn-bg);
    color: var(--warn);
}

/* --- Puce de notification "à faire" --- */

.identity-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.todo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--delete);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.15s ease;
}

.todo-badge:hover {
    filter: brightness(0.92);
}

/* --- Actions rapides "à faire" (confirmer/reporter) --- */

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.5rem;
}

.inline-form input[type="date"] {
    padding: 0.3rem 0.4rem;
    font-size: 0.78rem;
    width: 138px;
}

.btn-small {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-small:hover {
    background: var(--accent-hover);
}

.btn-small.ok {
    background: var(--ok);
}

.btn-small.warn {
    background: var(--warn);
}

.btn-small.delete {
    background: var(--delete);
}

.btn-small.ok:hover,
.btn-small.warn:hover,
.btn-small.delete:hover {
    filter: brightness(0.92);
}

/* --- Mini-modale de sélection de date --- */

.det-modal {
    border: none;
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow);
    max-width: 340px;
    width: 90vw;
    background: var(--surface);
    color: var(--text);
}

.det-modal::backdrop {
    background: rgba(15, 20, 32, 0.45);
}

.det-modal h3 {
    font-size: 1rem;
    margin: 0 0 1.1rem;
    text-wrap: balance;
}

.det-modal .field {
    margin-bottom: 0;
}

.det-modal .form-actions {
    margin-top: 1.25rem;
}

.det-modal .form-actions button[type="button"] {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 0;
}

.det-modal .form-actions button[type="button"]:hover {
    color: var(--text);
}

/* --- Pagination --- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.pagination a:hover {
    text-decoration: underline;
}

.pagination-disabled {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* --- Filtre de période (tableau de bord) --- */

.periode-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.periode-filter-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.25rem;
}

.periode-filter a {
    padding: 0.32rem 0.85rem;
    border-radius: 100px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.periode-filter a:hover {
    color: var(--accent);
}

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

/* --- Aide --- */

.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
    border: 1.5px solid var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    flex: none;
}

.help-btn:hover {
    background: var(--accent);
    color: #fff;
}

.help-btn:active {
    transform: scale(0.94);
}

.stat-card {
    position: relative;
}

.help-btn-mini {
    position: absolute;
    top: -8px;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(20, 26, 43, 0.25);
    transition: filter 0.15s ease;
}

.help-btn-mini:hover {
    filter: brightness(1.15);
}

.section-head-with-help {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.section-head-with-help h2 {
    margin: 0;
}

.help-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--neutral-pill-bg);
    color: var(--neutral-pill);
    font-size: 0.68rem;
    font-weight: 700;
    text-decoration: none;
    flex: none;
}

.help-btn-inline:hover {
    background: var(--accent);
    color: #fff;
}

/* --- Page Aide --- */

.help-toc {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.5rem 1.75rem;
    margin: 0 auto 2rem;
    max-width: 900px;
}

.help-toc h2 {
    font-size: 0.95rem;
    margin: 0 0 0.9rem;
}

.help-toc ol {
    margin: 0;
    padding-left: 1.2rem;
    columns: 2;
    column-gap: 2rem;
}

.help-toc li {
    margin-bottom: 0.4rem;
}

.help-toc a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.help-toc a:hover {
    text-decoration: underline;
}

.help-chapter {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.75rem 2rem;
    margin: 0 auto 1.75rem;
    scroll-margin-top: 1.5rem;
    max-width: 900px;
}

.help-chapter h2 {
    font-size: 1.15rem;
    margin: 0 0 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.help-chapter h3 {
    font-size: 0.95rem;
    margin: 1.4rem 0 0.6rem;
    color: var(--accent);
    scroll-margin-top: 1.5rem;
}

.help-chapter p {
    margin: 0 0 0.85rem;
    line-height: 1.6;
    font-size: 0.9rem;
}

.help-chapter ul, .help-chapter ol {
    margin: 0 0 0.85rem;
    padding-left: 1.3rem;
    line-height: 1.6;
    font-size: 0.9rem;
}

.help-chapter li {
    margin-bottom: 0.3rem;
}

.help-chapter strong {
    color: var(--text);
}

.help-chapter code {
    background: var(--bg);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.85em;
}

.help-back-to-top {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
}

.help-back-to-top:hover {
    color: var(--accent);
}

/* --- Info-bulles contextuelles (data-tooltip) --- */

[data-tooltip] {
    position: relative;
}

.help-btn-mini[data-tooltip] {
    position: absolute;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #fff;
    color: #1a1a1a;
    border: 1.5px solid var(--accent);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.45;
    white-space: normal;
    width: max-content;
    max-width: 230px;
    text-align: left;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transition-delay: 0.05s;
    z-index: 60;
    pointer-events: none;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

/* --- Vue mobile (saisie sur chantier) --- */

@media (max-width: 680px) {
    body {
        font-size: 14px;
    }

    .identity-strip {
        padding: 0.5rem 0.9rem;
    }

    .user-chip span {
        display: none;
    }

    .app-nav {
        padding: 0 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .app-nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav a {
        padding: 0.85rem 0.7rem;
        white-space: nowrap;
        flex: none;
    }

    .app-nav-logout {
        margin-left: 0;
    }

    .app-content {
        padding: 1.1rem 0.85rem 2.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .page-header .actions {
        flex-wrap: wrap;
    }

    .page-header .actions .btn,
    .page-header .actions .btn-ghost {
        flex: 1;
        text-align: center;
    }

    .actions {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .btn-small {
        padding: 0.45rem 0.8rem;
        font-size: 0.82rem;
    }

    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        padding: 1.1rem 1.25rem;
    }

    .stats-grid,
    .stats-grid[style] {
        grid-template-columns: 1fr 1fr !important;
    }

    .search-bar {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .search-bar input[type="search"] {
        flex: 1 1 100%;
        width: 100%;
    }

    .periode-filter {
        flex-wrap: wrap;
    }

    .form {
        padding: 1.1rem 1.25rem;
    }

    .comment-edit-form {
        min-width: 0;
    }
}
