/* =========================================================
   AXA Catala et Associés - Gestion Entreprise
   Charte : bleu nuit #00008F + rouge #FF1721
   ========================================================= */

:root {
    --axa-blue: #00008F;
    --axa-blue-dark: #00005a;
    --axa-blue-light: #1a1aaf;
    --axa-red: #FF1721;
    --axa-red-dark: #c8111a;
    --bg: #f4f6fb;
    --bg-white: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
    --radius: 6px;
    --radius-lg: 10px;
    --sidebar-width: 240px;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* ============ Layout général ============ */
.app {
    display: flex;
    min-height: 100vh;
    visibility: hidden; /* Affiché par auth après login */
}

/* ============ Sidebar ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--axa-blue);
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    background: white;
    color: var(--axa-blue);
    font-weight: 900;
    font-size: 18px;
    padding: 8px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    position: relative;
}

.logo-badge::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--axa-red);
    border-radius: 0 0 4px 4px;
}

.logo-text {
    line-height: 1.2;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
}

.logo-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    border-left: 4px solid transparent;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-left-color: var(--axa-red);
    font-weight: 600;
}

/* Sous-onglet (indenté sous BtoBiz Client) */
.nav-item.sub-item {
    padding-left: 46px;
    font-size: 13px;
    position: relative;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
}

.nav-item.sub-item::before {
    content: "↳";
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    font-size: 14px;
}

.nav-item.sub-item .nav-icon {
    font-size: 15px;
}

.nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.counter {
    padding: 4px 0;
}

.counter span {
    color: white;
    font-weight: 700;
}

/* ============ Main ============ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    background: var(--bg-white);
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.header-title h1 {
    font-size: 24px;
    color: var(--axa-blue);
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.header-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrap input {
    width: 280px;
    padding: 9px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-white);
    transition: border-color 0.15s;
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.toolbar-select {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--axa-blue);
}

/* ============ Boutons ============ */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--axa-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--axa-blue-dark);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--axa-blue);
    border: 1px solid var(--axa-blue);
}

.btn-secondary:hover {
    background: var(--axa-blue);
    color: white;
}

.btn-danger {
    background: var(--axa-red);
    color: white;
}

.btn-danger:hover {
    background: var(--axa-red-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-small {
    padding: 7px 12px;
    font-size: 12px;
}

/* ============ Barre bulk ============ */
.bulk-bar {
    background: var(--axa-blue);
    color: white;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 2px solid var(--axa-red);
    flex-wrap: wrap;
}

.bulk-count {
    font-weight: 600;
    font-size: 13px;
}

.bulk-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-bar .toolbar-select {
    color: var(--text);
    min-width: 180px;
}

/* ============ Tableau ============ */
.table-wrap {
    flex: 1;
    padding: 20px 28px;
    overflow-x: auto;
}

.entreprises-table {
    width: 100%;
    background: var(--bg-white);
    border-collapse: collapse;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 13px;
}

.entreprises-table thead {
    background: var(--axa-blue);
    color: white;
}

.entreprises-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--axa-red);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.entreprises-table th:hover {
    background: var(--axa-blue-light);
}

.entreprises-table th.col-check,
.entreprises-table th.col-actions {
    cursor: default;
}

.entreprises-table th.col-check:hover,
.entreprises-table th.col-actions:hover {
    background: var(--axa-blue);
}

.sort-ind {
    display: inline-block;
    width: 10px;
    font-size: 10px;
    opacity: 0.7;
}

.entreprises-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.entreprises-table tbody tr:hover {
    background: #fafbfd;
}

.entreprises-table tbody tr.selected {
    background: #eef0ff;
}

.entreprises-table td {
    padding: 11px 10px;
    vertical-align: middle;
}

.col-check {
    width: 36px;
    text-align: center;
}

.col-actions {
    width: 90px;
    text-align: center;
    white-space: nowrap;
}

.action-btn {
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: background 0.15s;
}

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

.action-btn.btn-view {
    color: var(--axa-blue);
}

.action-btn.btn-del {
    color: var(--axa-red);
}

.editable-cell {
    cursor: pointer;
    min-height: 20px;
}

.editable-cell:hover {
    background: #fffbe6;
    outline: 1px dashed var(--axa-blue);
    outline-offset: -3px;
}

.cell-input, .cell-select {
    width: 100%;
    padding: 5px 8px;
    border: 2px solid var(--axa-blue);
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.cell-input:focus, .cell-select:focus {
    outline: none;
}

/* ============ Badges de statut ============ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-grey   { background: #e5e7eb; color: #374151; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ============ Empty state ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin: 6px 0;
}

.empty-state .hint {
    font-size: 13px;
}

/* ============ Modal ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 30, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: var(--axa-blue);
    color: white;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--axa-red);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    color: white;
    font-size: 28px;
    line-height: 1;
    padding: 0 8px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-form {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px 18px;
    margin-bottom: 16px;
}

.form-section legend {
    font-weight: 700;
    color: var(--axa-blue);
    padding: 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-grid label.full-width {
    grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    font-weight: 400;
    background: white;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.form-grid textarea {
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    align-items: center;
}

.modal-actions .spacer {
    flex: 1;
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--axa-blue);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    font-size: 13px;
    z-index: 200;
    animation: toastIn 0.25s ease-out;
    border-left: 4px solid var(--axa-red);
}

.toast.toast-error {
    background: var(--axa-red);
    border-left-color: white;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ Vue Notes / Bloc-notes ============ */
.enterprise-view { display: block; }
.notes-view      { display: none; }

.main.view-notes .enterprise-view { display: none; }
.main.view-notes .header-toolbar  { display: none; }
.main.view-notes .notes-view      { display: block; }

.notes-view {
    padding: 20px 28px;
    flex: 1;
    overflow-y: auto;
    max-width: 900px;
    width: 100%;
}

.notes-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.note-composer {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--axa-red);
}

.note-composer-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--axa-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.note-composer textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.note-composer textarea:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.note-composer-actions {
    display: flex;
    justify-content: flex-end;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card {
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: relative;
    border: 1px solid;
}

.note-card:nth-child(3n+1) { background: #fff8c4; border-color: #f0d97a; }
.note-card:nth-child(3n+2) { background: #d4ecff; border-color: #8ec7ff; }
.note-card:nth-child(3n+3) { background: #d4f5d4; border-color: #8ed48e; }

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.note-date em {
    font-style: italic;
    opacity: 0.7;
    margin-left: 4px;
}

.note-delete {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--axa-red);
    transition: background 0.15s;
}

.note-delete:hover {
    background: rgba(255, 23, 33, 0.12);
}

.note-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 4px 2px 10px;
    border-radius: 4px;
    min-height: 24px;
}

.note-card.editing {
    background: #fffaec;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.note-edit-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
    background: white;
    margin-bottom: 10px;
}

.note-edit-input:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.note-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

/* ============ Modal mapping colonnes ============ */
.modal-wide {
    max-width: 900px;
}

.mapping-info {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.mapping-table-wrap {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mapping-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mapping-table th {
    background: var(--axa-blue);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mapping-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.mapping-table tbody tr:hover {
    background: #fafbfd;
}

.mapping-table .col-csv-header {
    font-weight: 700;
    color: var(--axa-blue);
    white-space: nowrap;
}

.mapping-table .col-preview {
    color: var(--text-muted);
    font-size: 12px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mapping-table .col-target select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
}

.mapping-table .col-target select:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.1);
}

.mapping-table .col-target select.mapped {
    border-color: #22c55e;
    background: #f0fdf4;
}

/* ============ Écran de connexion ============ */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--axa-blue) 0%, var(--axa-blue-dark) 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 32px 36px;
    width: 100%;
    max-width: 420px;
    border-top: 4px solid var(--axa-red);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header .logo {
    justify-content: center;
    margin-bottom: 18px;
}

.login-header .logo-title,
.login-header .logo-subtitle {
    color: var(--axa-blue);
}

.login-header h2 {
    color: var(--axa-blue);
    font-size: 22px;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 13px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.login-form input {
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
}

.login-form input:focus {
    outline: none;
    border-color: var(--axa-blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 143, 0.12);
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border-left: 3px solid var(--axa-red);
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    margin-top: 4px;
}

.login-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

.login-footer code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--axa-blue);
    font-weight: 600;
}

/* ============ Sidebar user + logout ============ */
.sidebar-user {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 16px;
    transition: background 0.15s;
}

.btn-logout:hover {
    background: var(--axa-red);
}

/* ============ Vue Administration ============ */
.admin-view {
    display: none;
    padding: 20px 28px;
    flex: 1;
    overflow-y: auto;
}

.main.view-admin .enterprise-view { display: none; }
.main.view-admin .notes-view      { display: none; }
.main.view-admin .header-toolbar  { display: none; }
.main.view-admin .admin-view      { display: block; }

.admin-toolbar {
    margin-bottom: 16px;
    display: flex;
    justify-content: flex-end;
}

.tag-me {
    color: var(--axa-red);
    font-style: italic;
    font-weight: 600;
    margin-left: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin: 0;
    padding: 0 8px;
}

/* ============ Responsive ============ */

/* Tablette : sidebar compacte (icônes seules) */
@media (max-width: 1100px) {
    .sidebar {
        width: 72px;
    }
    .logo-text, .nav-label, .sidebar-footer {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 14px;
        border-left-width: 3px;
    }
    .nav-item.sub-item {
        padding-left: 14px;
    }
    .nav-item.sub-item::before {
        display: none;
    }
    .nav-icon {
        font-size: 22px;
    }
    .sidebar-header {
        padding: 16px 8px;
    }
    .logo-badge {
        margin: 0 auto;
    }
    .main-header {
        padding: 16px 20px;
    }
    .table-wrap {
        padding: 16px 12px;
    }
    .bulk-bar {
        padding: 10px 20px;
    }
    .notes-view {
        padding: 16px 12px;
    }
}

/* Tablette portrait / grand mobile : toolbar en colonne */
@media (max-width: 900px) {
    .main-header {
        flex-direction: column;
        gap: 12px;
    }
    .header-toolbar {
        width: 100%;
        flex-wrap: wrap;
    }
    .search-wrap {
        flex: 1 1 100%;
    }
    .search-wrap input {
        width: 100%;
    }
    .toolbar-select {
        flex: 1 1 auto;
        min-width: 140px;
    }
    .btn {
        flex: 0 0 auto;
    }
    .bulk-bar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .bulk-actions {
        width: 100%;
    }
}

/* Mobile : sidebar en barre du bas + adaptations */
@media (max-width: 640px) {
    .app {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 90;
        flex-direction: row;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    }
    .sidebar-header {
        display: none;
    }
    .sidebar-nav {
        flex-direction: row;
        padding: 0;
        overflow-x: auto;
        flex: 1;
    }
    .nav-item {
        flex: 1;
        padding: 10px 6px;
        border-left: none;
        border-top: 3px solid transparent;
        justify-content: center;
        min-width: 56px;
    }
    .nav-item.active {
        border-left: none;
        border-top-color: var(--axa-red);
    }
    .nav-item.sub-item {
        padding-left: 6px;
    }
    .nav-item.sub-item::before {
        display: none;
    }
    .nav-icon {
        font-size: 20px;
    }
    .sidebar-footer, .logo-text, .nav-label {
        display: none;
    }
    .main {
        padding-bottom: 64px;
    }
    .main-header {
        padding: 14px 12px;
    }
    .header-title h1 {
        font-size: 18px;
    }
    .table-wrap {
        padding: 10px 8px;
    }
    .notes-view {
        padding: 12px 10px;
    }
    .entreprises-table {
        font-size: 12px;
    }
    .entreprises-table th,
    .entreprises-table td {
        padding: 8px 6px;
    }
    /* Modal plein écran */
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }
    .modal {
        max-height: 100vh;
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid label.full-width {
        grid-column: 1;
    }
    /* Mapping modal */
    .modal-wide {
        max-width: 100%;
    }
    .mapping-table .col-preview {
        display: none;
    }
    /* Notes */
    .note-composer-actions {
        flex-direction: column;
    }
    .note-actions {
        flex-wrap: wrap;
    }
}

/* Petits écrans : ajustements fins */
@media (max-width: 400px) {
    .header-toolbar {
        gap: 6px;
    }
    .btn {
        font-size: 12px;
        padding: 7px 10px;
    }
    .toolbar-select {
        font-size: 12px;
        padding: 7px 8px;
    }
}
