/* Cellulo Forecast — design system (mobile first, WCAG-friendly) */

@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&display=swap");

:root {
    --brand-primary: #1e3a5f;
    --brand-primary-dark: #152a47;
    --brand-primary-light: #2d5280;
    --brand-accent: #3b6ea8;
    --brand-accent-soft: #e8eef6;
    --brand-success: #15803d;
    --brand-success-soft: #dcfce7;
    --brand-surface: #ffffff;
    --brand-bg: #eef2f7;
    --brand-bg-alt: #f8fafc;
    --brand-text: #1a2b3c;
    --brand-muted: #64748b;
    --brand-border: #e2e8f0;
    --brand-shadow: 0 1px 3px rgba(30, 58, 95, 0.08);
    --brand-shadow-md: 0 4px 16px rgba(30, 58, 95, 0.1);
    --brand-radius: 0.625rem;
    --brand-radius-lg: 0.875rem;
    --transition: 150ms ease;

    --bs-primary: var(--brand-primary);
    --bs-primary-rgb: 30, 58, 95;
    --bs-success: var(--brand-success);
    --bs-success-rgb: 21, 128, 61;
    --bs-body-font-family: "Noto Sans", system-ui, -apple-system, sans-serif;
    --bs-body-color: var(--brand-text);
    --bs-body-bg: var(--brand-bg);
    --bs-border-color: var(--brand-border);
    --bs-link-color: var(--brand-accent);
    --bs-link-hover-color: var(--brand-primary-dark);
    --bs-border-radius: var(--brand-radius);
    --bs-border-radius-lg: var(--brand-radius-lg);

    /* === Design system v2 tokens (refonte mobile) === */
    --brand-warning: #b45309;
    --brand-warning-soft: #fef3c7;
    --brand-danger: #b91c1c;
    --brand-danger-soft: #fee2e2;
    --brand-shadow-lg: 0 12px 36px rgba(21, 42, 71, 0.18);
    --brand-radius-sm: 0.375rem;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --font-display: "Figtree", system-ui, -apple-system, sans-serif;
    --font-body: "Noto Sans", system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    --control-min: 44px;
    --control-lg: 48px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--bs-body-font-family);
    color: var(--brand-text);
    background-color: var(--brand-bg);
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.card-header strong {
    font-family: "Figtree", var(--bs-body-font-family);
    font-weight: 600;
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 0.75rem 1rem;
    background: var(--brand-surface);
    color: var(--brand-primary);
    font-weight: 600;
    border-radius: 0 0 var(--brand-radius) 0;
    box-shadow: var(--brand-shadow-md);
}

.skip-link:focus {
    left: 0;
}

/* Header / navbar */
.app-navbar {
    background: linear-gradient(135deg, var(--brand-primary-dark) 0%, var(--brand-primary) 55%, var(--brand-primary-light) 100%);
    box-shadow: 0 2px 12px rgba(21, 42, 71, 0.25);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.app-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0;
}

.brand-logo {
    height: 2.25rem;
    width: auto;
    object-fit: contain;
}

.brand-name {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: #fff;
    line-height: 1.2;
}

.brand-name small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 500;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--brand-radius);
    transition: background-color var(--transition), color var(--transition);
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.app-navbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
}

.app-navbar .navbar-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.app-navbar .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.app-navbar .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.4);
    padding: 0.4rem 0.55rem;
}

.app-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

/* Main layout */
.app-main {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    max-width: 1140px;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.page-header .page-subtitle {
    color: var(--brand-muted);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--brand-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--brand-primary-dark);
}

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

.card-header {
    background: var(--brand-bg-alt);
    border-bottom: 1px solid var(--brand-border);
    font-weight: 600;
    padding: 0.85rem 1.25rem;
}

.card-header strong {
    color: var(--brand-primary);
}

/* KPI */
.kpi-card {
    transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--brand-shadow-md);
}

.kpi-card .kpi-value {
    font-family: "Figtree", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1.1;
}

.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: var(--brand-muted);
    line-height: 1.3;
}

/* Client cards (mobile) */
.client-card {
    transition: box-shadow var(--transition), border-color var(--transition);
}

.client-card:hover {
    box-shadow: var(--brand-shadow-md);
    border-color: var(--brand-accent-soft);
}

.bulk-assignment-card {
    border-color: rgba(59, 110, 168, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.bulk-selection-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    background: #fff;
    color: var(--brand-muted);
}

.bulk-selection-summary strong {
    color: var(--brand-primary);
    font-size: 1.25rem;
    line-height: 1;
}

.client-select-col {
    width: 44px;
    text-align: center;
}

.assignee-stack {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.1rem 0.25rem;
    cursor: help;
}

.assignee-stack:focus-visible {
    outline: 3px solid rgba(59, 110, 168, 0.28);
    outline-offset: 3px;
    border-radius: 999px;
}

.assignee-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-left: -0.35rem;
    border: 2px solid var(--brand-surface);
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    font-family: "Figtree", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.16);
    transition: transform var(--transition), box-shadow var(--transition);
}

.assignee-avatar:first-child {
    margin-left: 0;
}

.assignee-stack:hover .assignee-avatar,
.assignee-stack:focus-visible .assignee-avatar {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(30, 58, 95, 0.2);
}

.assignee-avatar:nth-child(2) {
    background: var(--brand-accent);
}

.assignee-avatar:nth-child(3) {
    background: var(--brand-success);
}

.assignee-avatar:nth-child(4) {
    background: var(--brand-primary-light);
}

.assignee-avatar--more {
    background: var(--brand-bg-alt);
    color: var(--brand-primary);
}

.assignee-empty {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--brand-muted);
    font-size: 0.82rem;
}

/* Forms — touch targets */
.form-control,
.form-select,
.btn {
    min-height: 44px;
    border-radius: var(--brand-radius);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(59, 110, 168, 0.2);
}

/* Géographie — cascades région / wilaya / commune */
.geo-cascade {
    background: var(--brand-bg-alt);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius-lg);
    padding: 1rem 1.25rem;
    margin-top: 0.25rem;
}

.geo-cascade__head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--brand-border);
}

.geo-cascade__pin {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--brand-accent-soft);
    position: relative;
}

.geo-cascade__pin::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--brand-accent);
    box-shadow: 0 -0.45rem 0 -0.12rem var(--brand-accent);
}

.geo-cascade__title {
    display: block;
    font-family: "Figtree", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-primary);
    line-height: 1.3;
}

.geo-cascade__hint {
    display: block;
    font-size: 0.8rem;
    color: var(--brand-muted);
    margin-top: 0.15rem;
    line-height: 1.35;
}

.geo-cascade__field .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--brand-text);
}

.geo-cascade__field .form-select {
    width: 100%;
}

.geo-cascade__field .form-select:disabled {
    background-color: #f1f5f9;
    color: var(--brand-muted);
    cursor: not-allowed;
    opacity: 0.85;
}

.geo-cascade.is-loading .form-select {
    opacity: 0.65;
    pointer-events: none;
}

.geo-cascade--filter {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.geo-cascade--filter .geo-cascade__filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-muted);
    margin: 0 0 0.35rem;
    line-height: 1.2;
}

.geo-cascade--filter .geo-cascade__fields {
    margin: 0;
}

.geo-cascade--compact {
    padding: 0.75rem 1rem;
    margin-top: 0;
}

.geo-cascade--compact .geo-cascade__head {
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .geo-cascade--default .geo-cascade__field:not(:last-child) .form-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"),
            var(--bs-form-select-bg-img, url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"));
        background-position: right 2.25rem center, right 0.75rem center;
        background-size: 0.65rem, 16px 12px;
        padding-right: 3.25rem;
    }
}

.geo-cascade--readonly {
    background: var(--brand-surface);
    border-color: var(--brand-border);
    margin-bottom: 0;
}

.geo-cascade--readonly .geo-cascade__head {
    border-bottom-color: var(--brand-border);
}

.geo-cascade__pin--locked::after {
    box-shadow: none;
    width: 0.35rem;
    height: 0.5rem;
    border-radius: 0;
    background: transparent;
    border: 2px solid var(--brand-muted);
    border-top: none;
    transform: translateY(0.15rem);
}

.geo-cascade__value {
    min-height: 44px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: var(--brand-bg-alt);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    color: var(--brand-text);
    font-weight: 500;
}

.geo-field-single .form-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.geo-field-single .form-select {
    width: 100%;
}

.btn {
    font-weight: 500;
    transition: background-color var(--transition), border-color var(--transition),
        color var(--transition), box-shadow var(--transition);
}

.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 110, 168, 0.35);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-success {
    background-color: var(--brand-success);
    border-color: var(--brand-success);
}

.btn-lg {
    min-height: 48px;
    font-size: 1.05rem;
}

/* Tables */
.table {
    --bs-table-hover-bg: var(--brand-accent-soft);
}

.table thead th {
    font-family: "Figtree", sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--brand-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom-width: 1px;
}

.table a {
    font-weight: 500;
    text-decoration: none;
}

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

.dr-clickable-row {
    cursor: pointer;
}

.dr-clickable-row:focus-visible {
    outline: 3px solid rgba(59, 110, 168, 0.28);
    outline-offset: -3px;
}

.dr-clickable-row:hover .dr-primary-link,
.dr-clickable-row:focus-visible .dr-primary-link {
    color: var(--brand-primary-dark);
}

.dr-primary-link {
    color: var(--brand-primary);
    font-weight: 700;
    text-decoration: none;
}

.dr-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--brand-muted);
    font-size: 0.9rem;
}

/* List groups */
.list-group-item-action {
    border-left: 3px solid transparent;
    transition: border-color var(--transition), background-color var(--transition);
}

.list-group-item-action:hover,
.list-group-item-action:focus-visible {
    border-left-color: var(--brand-accent);
    background-color: var(--brand-accent-soft);
}

/* Badges */
.badge.bg-primary {
    background-color: var(--brand-primary) !important;
}

.badge.bg-secondary {
    background-color: var(--brand-muted) !important;
}

/* Tabs (exports) */
.app-tabs.nav-tabs {
    border-bottom: 2px solid var(--brand-border);
    gap: 0.25rem;
}

.app-tabs .nav-link {
    color: var(--brand-muted);
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: var(--brand-radius) var(--brand-radius) 0 0;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}

.app-tabs .nav-link:hover {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-accent-soft);
}

.app-tabs .nav-link.active {
    color: var(--brand-primary);
    background: transparent;
    border-bottom-color: var(--brand-primary);
    font-weight: 600;
}

/* Visit form */
.visit-line-card {
    border-left: 3px solid var(--brand-accent);
}

.sticky-save-bar {
    position: static;
    background: transparent;
    padding: 1rem 0 0;
    margin-top: 1rem;
}

.sticky-save-bar .btn {
    box-shadow: var(--brand-shadow-md);
}

.table-sort-link {
    align-items: center;
    color: inherit;
    display: inline-flex;
    gap: 0.35rem;
    min-height: var(--control-min);
    padding: 0.25rem 0;
    text-decoration: none;
    white-space: nowrap;
}

.table-sort-link:hover,
.table-sort-link:focus-visible {
    color: var(--brand-primary);
    text-decoration: none;
}

.table-sort-link.is-active {
    font-weight: 600;
}

.table-sort-icon {
    font-size: 0.7rem;
    line-height: 1;
    opacity: 0.35;
}

.table-sort-link.is-active .table-sort-icon {
    opacity: 1;
}

.draft-autosave-status {
    min-height: 1.25rem;
}

.draft-autosave-status.is-pending {
    color: var(--bs-secondary-color, #6c757d);
}

.draft-autosave-status.is-saving {
    color: var(--brand-primary, #0d6efd);
}

.draft-autosave-status.is-saved {
    color: var(--bs-success, #198754);
}

.draft-autosave-status.is-error {
    color: var(--bs-danger, #dc3545);
}

.draft-autosave-status.is-offline {
    color: var(--bs-warning-text-emphasis, #997404);
}

.activity-context-readonly {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.activity-context-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.65rem;
    background: var(--brand-bg-alt);
    border: 1px solid var(--brand-border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--brand-muted);
    line-height: 1.3;
}

.activity-context-chip strong {
    color: var(--brand-text);
    font-weight: 600;
}

.activity-edit-banner--compact {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.activity-edit-banner--compact .activity-edit-banner-title {
    font-size: 0.8125rem;
}

.activity-edit-banner--compact .activity-edit-banner-text {
    font-size: 0.75rem;
}

.activity-field-label {
    display: none;
}

.activity-line-action-cell {
    width: 3rem;
}

.activity-num-input:focus-visible,
.activity-product-search:focus-visible,
.client-sort-mobile-field:focus-visible,
.client-sort-order-toggle:focus-visible,
.activity-edit-actions .btn:focus-visible,
.activity-card-actions .btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 110, 168, 0.35);
    outline: none;
}

.activity-card.is-editing {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 2px var(--brand-accent-soft), var(--brand-shadow-md);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.activity-card.is-editing .card-header {
    background: linear-gradient(180deg, var(--brand-accent-soft) 0%, var(--brand-surface) 100%);
    border-bottom-color: var(--brand-accent);
}

.activity-card.is-editing .card-body {
    background: var(--brand-bg-alt);
}

.activity-card.is-busy {
    opacity: 0.72;
    pointer-events: none;
}

.activity-card-toolbar {
    gap: var(--space-2);
}

.activity-card-actions .btn {
    min-height: var(--control-min);
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.activity-card-actions .lucide-icon {
    flex-shrink: 0;
}

.activity-status-badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Edit mode banner */
.activity-edit-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    background: var(--brand-accent-soft);
    border: 1px solid rgba(59, 110, 168, 0.25);
    border-radius: var(--brand-radius);
    color: var(--brand-primary);
}

.activity-edit-banner-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: var(--brand-accent);
}

.activity-edit-banner-title {
    display: block;
    font-family: var(--font-display);
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.activity-edit-banner-text {
    display: block;
    font-size: 0.8125rem;
    color: var(--brand-muted);
    line-height: 1.4;
}

/* Lines table */
.activity-lines-table {
    --activity-table-pad-y: 0.5rem;
    --activity-table-pad-x: 0.625rem;
    --activity-col-product-min: 9rem;
    --activity-col-stock-min: 5.5rem;
    --activity-col-patients-min: 5rem;
    --activity-col-dotation-min: 7.25rem;
    margin-bottom: 0;
}

.activity-lines-thead th {
    font-family: var(--font-display);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-primary);
    background: linear-gradient(180deg, var(--brand-bg-alt) 0%, var(--brand-surface) 100%);
    border-bottom: 2px solid var(--brand-accent);
    padding: 0.45rem var(--activity-table-pad-x);
    vertical-align: bottom;
}

.activity-lines-thead .activity-col-product {
    min-width: var(--activity-col-product-min);
    white-space: nowrap;
}

.activity-lines-thead .activity-col-stock {
    min-width: var(--activity-col-stock-min);
    white-space: normal;
    line-height: 1.2;
    word-break: break-word;
}

.activity-lines-thead .activity-col-patients {
    min-width: var(--activity-col-patients-min);
    white-space: normal;
    line-height: 1.2;
}

.activity-lines-thead .activity-col-dotation {
    min-width: var(--activity-col-dotation-min);
    white-space: normal;
    line-height: 1.2;
    word-break: break-word;
}

.activity-lines-mobile-cols {
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(180deg, var(--brand-bg-alt) 0%, var(--brand-surface) 100%);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    border-left: 3px solid var(--brand-accent);
}

.activity-lines-mobile-cols__inner {
    display: grid;
    grid-template-columns: 1fr repeat(3, minmax(3.25rem, 1fr));
    gap: var(--space-2);
    align-items: end;
    font-family: var(--font-display);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-primary);
    line-height: 1.2;
}

.activity-lines-mobile-cols__product {
    grid-column: 1 / -1;
    font-size: 0.6875rem;
    padding-bottom: 0.15rem;
    border-bottom: 1px dashed var(--brand-border);
    margin-bottom: 0.1rem;
}

.activity-lines-mobile-cols__metric {
    text-align: end;
}

@media (min-width: 768px) {
    .activity-lines-mobile-cols {
        display: none !important;
    }

    .activity-lines-table--readonly,
    .activity-lines-table--edit {
        display: table;
        width: 100%;
        min-width: 28rem;
        table-layout: auto;
    }

    .activity-lines-thead {
        display: table-header-group;
    }

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

    .activity-line-product {
        max-width: none;
        width: auto;
    }

    .activity-lines-table .activity-col-stock {
        min-width: var(--activity-col-stock-min);
    }

    .activity-lines-table .activity-col-patients {
        min-width: var(--activity-col-patients-min);
    }

    .activity-lines-table .activity-col-dotation {
        min-width: var(--activity-col-dotation-min);
    }

    .activity-lines-table--readonly .activity-num-cell,
    .activity-lines-table--edit .activity-editable.activity-col-stock,
    .activity-lines-table--edit .activity-editable.activity-col-patients,
    .activity-lines-table--edit .activity-editable.activity-col-dotation {
        white-space: nowrap;
    }
}

.activity-lines-table--readonly tbody tr:nth-child(even) {
    background: var(--brand-bg-alt);
}

.activity-lines-table--readonly tbody tr:hover {
    background: var(--brand-accent-soft);
}

.activity-num-cell {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.activity-lines-table--edit tbody td {
    vertical-align: middle;
    padding: var(--space-2) var(--activity-table-pad-x);
}

.activity-num-input {
    min-width: 4.75rem;
    max-width: 6.5rem;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    border-color: var(--brand-border);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.activity-num-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(59, 110, 168, 0.2);
}

.activity-line-product {
    font-weight: 500;
    max-width: 14rem;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.activity-line-row.is-new {
    animation: activity-row-in 320ms ease;
}

@keyframes activity-row-in {
    from {
        opacity: 0;
        background: var(--brand-success-soft);
    }
    to {
        opacity: 1;
        background: transparent;
    }
}

.activity-line-actions-col {
    width: 3rem;
}

.activity-lines-empty,
.activity-lines-empty-row td {
    font-style: italic;
}

.activity-lines-wrap {
    max-width: 100%;
}

/* Commentaires visite / appel / produit — infobulle discrète */
.activity-card-title {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
}

.activity-line-product-inner {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.2rem;
    max-width: 100%;
}

.activity-line-product-label {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
}

.activity-lines-table--readonly .activity-line-readonly-row td {
    vertical-align: middle;
}

.activity-lines-table--readonly .activity-num-cell {
    vertical-align: middle;
    white-space: nowrap;
}

.activity-comment-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--brand-accent);
    vertical-align: middle;
    cursor: help;
    line-height: 1;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.activity-comment-hint:hover,
.activity-comment-hint:focus-visible {
    color: var(--brand-primary);
    background: var(--brand-bg-alt);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 110, 168, 0.35);
}

.activity-comment-hint-icon {
    display: flex;
    pointer-events: none;
}

.activity-comment-hint--empty {
    color: var(--brand-muted);
    opacity: 0.75;
}

.activity-comment-hint--empty:hover,
.activity-comment-hint--empty:focus-visible {
    color: var(--brand-accent);
    opacity: 1;
}

.activity-comment-hint--editable {
    cursor: pointer;
}

.activity-lines-table--edit .activity-line-product-inner {
    align-items: center;
}

.activity-comment-modal .modal-content {
    border: none;
    box-shadow: var(--brand-shadow-lg);
    border-radius: var(--brand-radius-lg);
}

.activity-comment-modal-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.activity-comment-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--brand-accent-soft);
    color: var(--brand-primary);
    flex-shrink: 0;
}

.activity-comment-modal-text {
    font-size: 16px;
    resize: vertical;
    min-height: 6rem;
}

.activity-comment-modal-footer .btn {
    min-height: var(--control-min, 44px);
}

@media (min-width: 768px) {
    .activity-comment-modal-footer .btn {
        min-height: auto;
    }
}

.activity-comment-tooltip .tooltip-inner {
    max-width: min(90vw, 18rem);
    text-align: left;
    white-space: pre-wrap;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.activity-comment-popover {
    max-width: min(92vw, 20rem);
    border-color: var(--brand-border);
    box-shadow: 0 8px 24px rgba(21, 42, 71, 0.14);
}

.activity-comment-popover .popover-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-muted);
    background: var(--brand-bg-alt);
    border-bottom-color: var(--brand-border);
}

.activity-comment-popover .popover-body {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--brand-text);
    white-space: pre-wrap;
}

@media (max-width: 576px) {
    .activity-comment-hint {
        width: 2rem;
        height: 2rem;
        margin: 0;
        flex-shrink: 0;
    }
}

.activity-table-scroll {
    margin-bottom: var(--space-3);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Product search */
.activity-add-line {
    padding: var(--space-3);
    background: var(--brand-surface);
    border: 1px dashed var(--brand-border);
    border-radius: var(--brand-radius);
}

.activity-product-search-wrap {
    position: relative;
}

.activity-search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.activity-product-search {
    padding-left: 2.25rem;
    min-height: var(--control-min);
}

.activity-product-results {
    z-index: 1050;
    max-height: 12rem;
    overflow-y: auto;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    border-radius: var(--brand-radius);
    border: 1px solid var(--brand-border);
}

.activity-product-results .list-group-item {
    cursor: pointer;
    min-height: var(--control-min);
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    transition: background var(--transition);
}

.activity-product-results .list-group-item:hover,
.activity-product-results .list-group-item:focus {
    background: var(--brand-accent-soft);
    outline: none;
}

.activity-product-results .list-group-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--brand-accent);
}

/* Sticky edit bar */
.activity-edit-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: linear-gradient(180deg, transparent 0%, var(--brand-surface) 20%);
    border-top: 1px solid var(--brand-border);
    border-radius: 0 0 var(--brand-radius) var(--brand-radius);
}

.activity-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.activity-edit-actions .btn {
    min-height: var(--control-min);
    display: inline-flex;
    align-items: center;
    font-weight: 600;
}

.activity-edit-actions .btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.activity-edit-error:empty {
    display: none;
}

/* Delete modal */
.activity-delete-modal .modal-content {
    border: none;
    box-shadow: var(--brand-shadow-lg);
    border-radius: var(--brand-radius-lg);
}

.activity-delete-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.activity-delete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--brand-danger-soft);
    color: var(--brand-danger);
    flex-shrink: 0;
}

.activity-delete-stepper {
    display: flex;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-delete-stepper-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--brand-bg-alt);
    border-radius: var(--brand-radius);
    color: var(--brand-muted);
    font-size: 0.8125rem;
    transition: background var(--transition), color var(--transition);
}

.activity-delete-stepper-item.is-active {
    background: var(--brand-accent-soft);
    color: var(--brand-primary);
    font-weight: 600;
}

.activity-delete-stepper-item.is-done {
    background: var(--brand-success-soft);
    color: var(--brand-success);
}

.activity-delete-stepper-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--brand-surface);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.activity-delete-stepper-item.is-active .activity-delete-stepper-num {
    background: var(--brand-accent);
    color: #fff;
}

.activity-delete-stepper-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toast feedback */
.activity-toast {
    position: fixed;
    bottom: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--brand-primary);
    color: #fff;
    border-radius: var(--brand-radius-lg);
    box-shadow: var(--brand-shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    animation: activity-toast-in 280ms ease;
    max-width: min(90vw, 24rem);
}

.activity-toast.is-success {
    background: var(--brand-success);
}

.activity-toast.is-error {
    background: var(--brand-danger);
}

@keyframes activity-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0.75rem);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 767.98px) {
    html,
    body {
        overflow-x: clip;
    }

    .container {
        max-width: 100%;
        overflow-x: clip;
    }

    .app-main {
        max-width: 100%;
        overflow-x: clip;
    }

    .card-body,
    .card-header {
        overflow-wrap: anywhere;
    }

    .activity-context-chip {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .activity-lines-wrap,
    .activity-card,
    .activity-card .card-body,
    .activity-card .card-header {
        max-width: 100%;
        overflow-x: clip;
    }

    /* No horizontal scroll containers on mobile */
    .activity-table-scroll,
    .activity-lines-table {
        overflow-x: visible;
        max-width: 100%;
        width: 100%;
    }

    .activity-lines-table--edit,
    .activity-lines-table--readonly {
        display: block;
        table-layout: auto;
    }

    .activity-lines-table--edit thead,
    .activity-lines-table--readonly thead {
        display: none;
    }

    .activity-lines-table--edit tbody,
    .activity-lines-table--readonly tbody {
        display: block;
        width: 100%;
    }

    /* Inline edit: table rows → product cards */
    .activity-lines-table--edit .activity-line-row {
        display: block;
        background: var(--brand-surface);
        border: 1px solid var(--brand-border);
        border-radius: var(--brand-radius);
        margin-bottom: var(--space-3);
        padding: var(--space-3);
        box-shadow: var(--brand-shadow);
    }

    .activity-lines-table--edit .activity-line-row td {
        display: block;
        border: none;
        padding: 0;
    }

    .activity-lines-table--edit .activity-line-product {
        font-weight: 600;
        font-size: 0.9375rem;
        margin-bottom: var(--space-3);
        padding-bottom: var(--space-2);
        border-bottom: 1px solid var(--brand-border);
        max-width: none;
    }

    .activity-lines-table--edit .activity-editable {
        display: block;
        margin-bottom: var(--space-2);
    }

    .activity-field-label {
        display: block;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--brand-muted);
        margin-bottom: 0.25rem;
    }

    .activity-num-input {
        font-size: 16px;
        min-height: var(--control-lg);
        max-width: none;
        width: 100%;
        margin-left: 0;
        text-align: left;
    }

    .activity-lines-table--edit .activity-line-action-cell {
        width: auto;
        margin-top: var(--space-2);
        padding-top: var(--space-2);
        border-top: 1px dashed var(--brand-border);
    }

    .activity-lines-table--edit .btn-remove-activity-line {
        min-height: var(--control-min);
        width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Readonly lines as cards on mobile */
    .activity-lines-table--readonly thead {
        display: none;
    }

    .activity-lines-table--readonly tbody {
        display: block;
    }

    .activity-lines-table--readonly .activity-line-readonly-row {
        display: block;
        background: var(--brand-surface);
        border: 1px solid var(--brand-border);
        border-radius: var(--brand-radius);
        margin-bottom: var(--space-2);
        padding: var(--space-3);
    }

    .activity-lines-table--readonly .activity-line-readonly-row td {
        display: flex;
        justify-content: space-between;
        gap: var(--space-2);
        border: none;
        padding: 0.2rem 0;
    }

    .activity-lines-table--readonly .activity-line-product {
        display: block;
        font-weight: 600;
        margin-bottom: var(--space-2);
        padding-bottom: var(--space-2);
        border-bottom: 1px solid var(--brand-border);
    }

    .activity-lines-table--readonly .activity-line-product-inner {
        display: inline-flex;
        flex-wrap: nowrap;
        align-items: flex-start;
        width: 100%;
    }

    .activity-lines-table--readonly .activity-line-readonly-row td[data-label]::before {
        content: attr(data-label);
        color: var(--brand-primary);
        font-family: var(--font-display);
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .activity-lines-table--readonly .activity-num-cell {
        font-weight: 600;
    }

    /* Fixed save bar above bottom nav */
    body.activity-inline-editing .app-main {
        padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
    }

    .activity-card.is-editing .activity-edit-bar {
        position: fixed;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        z-index: 45;
        margin: 0;
        padding: var(--space-3);
        background: var(--brand-surface);
        border-top: 1px solid var(--brand-border);
        box-shadow: 0 -4px 20px rgba(30, 58, 95, 0.12);
        border-radius: 0;
    }

    .activity-card-actions {
        width: 100%;
    }

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

    .activity-card .card-header {
        flex-direction: column;
        align-items: stretch !important;
    }

    .activity-card-title {
        flex: 1 1 100%;
        word-break: break-word;
    }

    .activity-card-toolbar {
        width: 100%;
    }

    .activity-edit-actions {
        width: 100%;
    }

    .activity-edit-actions .activity-save-btn,
    .activity-edit-actions .activity-cancel-btn {
        flex: 1;
        justify-content: center;
        min-height: var(--control-lg);
        font-size: 1rem;
    }

    .activity-edit-error {
        flex: 1 1 100%;
        width: 100%;
    }

    /* Client detail: stack assignment history instead of horizontal scroll */
    .assignment-history-scroll {
        overflow-x: visible;
    }

    .assignment-history-scroll .table {
        display: block;
        width: 100%;
    }

    .assignment-history-scroll thead {
        display: none;
    }

    .assignment-history-scroll tbody {
        display: block;
    }

    .assignment-history-scroll tbody tr {
        display: block;
        border: 1px solid var(--brand-border);
        border-radius: var(--brand-radius);
        margin-bottom: var(--space-2);
        padding: var(--space-3);
        background: var(--brand-surface);
    }

    .assignment-history-scroll tbody td {
        display: flex;
        justify-content: space-between;
        gap: var(--space-2);
        border: none;
        padding: 0.2rem 0;
        word-break: break-word;
    }

    .assignment-history-scroll tbody td::before {
        content: attr(data-label);
        color: var(--brand-muted);
        font-size: 0.8125rem;
        flex-shrink: 0;
    }

    .activity-delete-stepper-label {
        display: none;
    }

    .activity-delete-footer {
        flex-direction: column;
        gap: var(--space-2);
    }

    .activity-delete-footer .btn {
        width: 100%;
        min-height: var(--control-lg);
        margin: 0;
    }

    .activity-toast {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px) + var(--space-3));
    }

    /* Client list mobile sort */
    .client-list-sort-bar {
        position: sticky;
        top: 56px;
        z-index: 10;
        background: var(--brand-bg);
        padding: var(--space-2) 0;
        margin-top: calc(-1 * var(--space-2));
    }

    .client-list-sort-controls {
        display: flex;
        gap: var(--space-2);
    }

    .client-sort-mobile-field {
        flex: 1;
        min-height: var(--control-min);
        font-size: 16px;
    }

    .client-sort-order-toggle {
        min-width: var(--control-min);
        min-height: var(--control-min);
        font-size: 1.125rem;
        font-weight: 700;
        flex-shrink: 0;
    }
}

@media (min-width: 768px) {
    .modal-dialog-bottom-md {
        margin: 1.75rem auto;
        max-width: 500px;
    }
}

@media (max-width: 767.98px) {
    .modal-dialog-bottom-md {
        margin: 0;
        max-width: none;
        align-items: flex-end;
        min-height: calc(100% - env(safe-area-inset-bottom, 0));
        display: flex;
    }

    .modal-dialog-bottom-md .modal-content {
        border-radius: 18px 18px 0 0;
        box-shadow: var(--brand-shadow-lg);
        max-height: 90vh;
        width: 100%;
    }
}

#product-lines-container:not(:empty) + #no-lines-msg {
    display: none !important;
}

/* Login page */
.page-login {
    background: linear-gradient(160deg, var(--brand-bg) 0%, var(--brand-accent-soft) 45%, var(--brand-bg) 100%);
    min-height: 100vh;
}

.login-wrapper {
    min-height: calc(100vh - 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.login-card {
    max-width: 420px;
    width: 100%;
    border: none;
    box-shadow: var(--brand-shadow-md);
}

.login-card .card-body {
    padding: 2rem 1.75rem;
}

.login-logo {
    display: block;
    margin: 0 auto 1.25rem;
    height: 4.5rem;
    width: auto;
    object-fit: contain;
}

.login-title {
    font-family: "Figtree", sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-align: center;
    margin-bottom: 0.35rem;
}

.login-subtitle {
    text-align: center;
    color: var(--brand-muted);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

/* Alerts */
.alert {
    border-radius: var(--brand-radius);
    border: none;
}

/* Section titles on dashboard */
.section-title {
    font-size: 1.1rem;
    color: var(--brand-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-accent-soft);
}

/* Stat cards on exports */
.stat-card .display-6 {
    font-family: "Figtree", sans-serif;
    font-weight: 700;
    color: var(--brand-primary);
}

/* Visit form — product search */
.product-search-wrap {
    position: relative;
}

.product-search-wrap.is-searching .product-search-input {
    background-image: linear-gradient(
        90deg,
        var(--brand-accent-soft) 0%,
        var(--brand-surface) 50%,
        var(--brand-accent-soft) 100%
    );
    background-size: 200% 100%;
    animation: product-search-shimmer 1s ease infinite;
}

@keyframes product-search-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.product-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 0.25rem;
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow-md);
}

.product-search-results .product-search-item {
    cursor: pointer;
}

.product-search-results .product-search-item:hover,
.product-search-results .product-search-item:focus {
    background-color: var(--brand-accent-soft);
}

/* Client list live search */
.client-list-results {
    transition: opacity 150ms ease;
}

.client-list-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

#client-filters-form .form-text {
    font-size: 0.8rem;
    color: var(--brand-muted);
}

/* Pagination */
.app-pagination .page-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
}

.app-pagination .page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Responsive */
@media (max-width: 576px) {
    .app-main {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .kpi-card .kpi-value {
        font-size: 1.65rem;
    }

    .brand-name {
        font-size: 0.95rem;
    }

    .brand-logo {
        height: 2rem;
    }

    .form-control,
    .form-select,
    .btn:not(.btn-sm):not(.btn-close) {
        min-height: var(--control-lg);
    }

    .row.g-3 > .col-6.col-md-4.col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 992px) {
    .page-header h1 {
        font-size: 1.75rem;
    }
}

.lucide-icon {
    display: inline-block;
    vertical-align: -2px;
    stroke-width: 1.75;
}

/* === Mobile chrome === */
@media (max-width: 991.98px) {
    .app-navbar {
        display: none;
    }
}

@media (min-width: 992px) {
    .app-topbar,
    .app-bottom-nav,
    .fab {
        display: none !important;
    }
}

.app-topbar {
    background: linear-gradient(
        135deg,
        var(--brand-primary-dark) 0%,
        var(--brand-primary) 55%,
        var(--brand-primary-light) 100%
    );
    color: #fff;
    box-shadow: 0 2px 12px rgba(21, 42, 71, 0.25);
    padding: 0.6rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 56px;
}

.app-topbar-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
    padding: 0 0.25rem;
}

.app-topbar-title small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.82;
    margin-top: 1px;
}

.app-topbar .icon-btn,
.app-bottom-nav .icon-btn {
    background: transparent;
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.app-topbar .icon-btn:hover,
.app-topbar .icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.app-topbar-logo {
    height: 28px;
    width: auto;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--brand-surface);
    border-top: 1px solid var(--brand-border);
    display: flex;
    z-index: 40;
    box-shadow: 0 -2px 12px rgba(21, 42, 71, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-bottom-nav .tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--brand-muted);
    padding: 0.6rem 0.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: color var(--transition);
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.1;
    min-height: 60px;
    text-decoration: none;
}

.app-bottom-nav .tab-btn .tab-label {
    letter-spacing: 0.01em;
    text-align: center;
}

.app-bottom-nav .tab-btn.active {
    color: var(--brand-primary);
    font-weight: 600;
}

.app-bottom-nav .tab-btn.active .tab-icon-wrap {
    background: var(--brand-accent-soft);
}

.tab-icon-wrap {
    width: 56px;
    height: 30px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition);
}

.has-bottom-nav .app-main {
    padding-bottom: 5.5rem;
}

.app-bottom-nav .tab-btn--more {
    font: inherit;
}

.app-nav-more-panel.offcanvas-bottom {
    height: auto;
    max-height: min(70vh, 420px);
    border-radius: var(--brand-radius) var(--brand-radius) 0 0;
}

.app-nav-more-list .list-group-item.active {
    background: var(--brand-accent-soft);
    border-color: var(--brand-border);
    color: var(--brand-primary);
    font-weight: 600;
}

.app-nav-more-icon {
    color: var(--brand-accent);
    flex-shrink: 0;
}

.app-nav-admin-dropdown .dropdown-menu {
    border: 1px solid var(--brand-border);
    box-shadow: var(--brand-shadow-md);
    border-radius: var(--brand-radius);
    padding: var(--space-2);
    min-width: 12rem;
}

.app-nav-admin-dropdown .dropdown-item.active {
    background: var(--brand-accent-soft);
    color: var(--brand-primary);
}

.app-navbar .navbar-text small {
    font-weight: 500;
}

.has-bottom-nav .sticky-save-bar {
    bottom: auto;
}

.fab {
    position: fixed;
    right: 1rem;
    bottom: calc(72px + env(safe-area-inset-bottom, 0) + 0.5rem);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    box-shadow: var(--brand-shadow-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 35;
    transition: transform var(--transition), background-color var(--transition);
    text-decoration: none;
}

.fab:hover,
.fab:focus-visible {
    background: var(--brand-primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

/* === Bottom sheet filters === */
.modal-dialog-bottom {
    margin: 0;
    max-width: none;
    align-items: flex-end;
    min-height: calc(100% - env(safe-area-inset-bottom, 0));
    display: flex;
}

.modal-dialog-bottom .modal-content {
    border-radius: 18px 18px 0 0;
    box-shadow: var(--brand-shadow-lg);
    max-height: 85vh;
    width: 100%;
}

.sheet-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem 0.85rem;
    border-bottom: 1px solid var(--brand-border);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: var(--brand-border);
    margin: 0 auto 0.5rem;
    flex: 0 0 100%;
}

.sheet-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--brand-primary);
    margin: 0;
}

.sheet-body {
    overflow-y: auto;
}

.sheet-foot {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--brand-border);
    display: flex;
    gap: 0.5rem;
}

.sheet-foot .btn {
    flex: 1;
}

.segmented {
    display: inline-flex;
    background: var(--brand-bg-alt);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    padding: 3px;
    gap: 2px;
    width: 100%;
}

.segmented .seg {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--brand-muted);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.45rem 0.5rem;
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 38px;
}

.segmented .seg.active {
    background: var(--brand-surface);
    color: var(--brand-primary);
    box-shadow: var(--brand-shadow);
    font-weight: 600;
}

.client-filters-mobile .input-group .btn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* Activity feed (Mes visites / Mes appels) */
.activity-feed-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}

.activity-feed-list {
    max-width: 100%;
    overflow-x: clip;
}

.activity-feed-item {
    margin-bottom: var(--space-2);
}

.activity-feed-client-link {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.75rem;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    background: var(--brand-accent-soft);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    text-decoration: none;
    color: var(--brand-primary);
    font-size: 0.875rem;
    transition: background var(--transition), border-color var(--transition);
}

.activity-feed-client-link:hover,
.activity-feed-client-link:focus-visible {
    background: var(--brand-surface);
    border-color: var(--brand-accent);
    color: var(--brand-primary-dark);
}

.activity-feed-client-name {
    font-weight: 600;
    font-family: var(--font-display);
    word-break: break-word;
}

.activity-feed-client-meta {
    color: var(--brand-muted);
    font-size: 0.8125rem;
}

.activity-feed-client-cta {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-accent);
}

.activity-feed-empty .card-body {
    max-width: 22rem;
    margin: 0 auto;
}

@media (max-width: 767.98px) {
    .activity-feed-filters-mobile {
        position: sticky;
        top: 56px;
        z-index: 9;
        background: var(--brand-bg);
        padding: var(--space-2) 0;
        margin-top: calc(-1 * var(--space-2));
    }

    .activity-feed-item .activity-card {
        margin-bottom: 0;
    }

    .app-bottom-nav .tab-btn .tab-label {
        font-size: 0.62rem;
    }
}

/* === Fiche utilisateur admin === */
.user-detail-hero .h3 {
    font-family: var(--font-display);
}

.user-status-badges .badge {
    font-weight: 600;
    font-size: 0.75rem;
}

.user-badge-active {
    background-color: var(--brand-success-soft);
    color: var(--brand-success);
}

.user-badge-inactive {
    background-color: var(--brand-danger-soft);
    color: var(--brand-danger);
}

.user-badge-onboarding--success {
    background-color: var(--brand-success-soft);
    color: var(--brand-success);
}

.user-badge-onboarding--warning {
    background-color: var(--brand-warning-soft);
    color: var(--brand-warning);
}

.user-badge-onboarding--secondary {
    background-color: var(--brand-bg-alt);
    color: var(--brand-muted);
}

.user-action-card .user-action-btn {
    min-height: var(--control-min);
}

@media (max-width: 575.98px) {
    .user-list-actions .btn {
        display: block;
        width: 100%;
        margin-bottom: var(--space-2);
    }
}
