:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --dark: #133a57;
    --dark-2: #1d4a6a;
    --text: #163042;
    --muted: #6d7f8d;
    --line: #dde5eb;
    --primary: #2e8fff;
    --primary-dark: #1673dd;
    --left-w: 220px;
    --right-w: 380px;
    --topbar-h: 56px;
}

* {
    box-sizing: border-box;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

/* --- Topbar --- */

.topbar {
    background: var(--dark);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    border-bottom: 1px solid #9cb8cc3d;
    height: var(--topbar-h);
    flex-shrink: 0;
}

.topbar-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    padding: 0 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

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

.brand h1 { margin: 0; font-size: 20px; }
.brand p  { margin: 0; font-size: 12px; opacity: 0.8; }

.brand-logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.topbar .actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Boutons sur fond sombre de la topbar (lien ou <button>) */
.topbar-back,
.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

button.topbar-btn {
    appearance: none;
}

.topbar-back:hover,
.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}

.topbar .btn-light {
    /* Ne pas utiliser btn-light dans la topbar — style incohérent */
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.topbar .btn-light:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}

/* --- Layout --- */

.page {
    max-width: none;
    width: 100%;
    margin: 24px auto;
    padding: 0 20px 24px;
    box-sizing: border-box;
}

.content-grid {
    display: grid;
    grid-template-columns: var(--index-left-w, 300px) 20px minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

.content-grid .panel {
    min-width: 0;
}

#index-runs-panel.collapsed,
#projet-context-aside.collapsed {
    overflow: hidden;
    padding: 0;
    border: none;
    opacity: 0;
    pointer-events: none;
}

.content-grid.has-projet-context {
    grid-template-columns: var(--index-left-w, 300px) 20px minmax(0, 1fr) 20px var(--index-right-w, 300px);
}

.content-grid:not(.has-projet-context) .index-panel-handle--right,
.content-grid:not(.has-projet-context) #projet-context-aside {
    display: none !important;
}

/* Volet contexte projet (index) */

.projet-context-aside {
    position: sticky;
    top: calc(var(--topbar-h, 64px) + 16px);
    max-height: calc(100vh - var(--topbar-h, 64px) - 48px);
    display: flex;
    flex-direction: column;
}

.projet-context-aside[hidden] {
    display: none !important;
}

.projet-context-aside .panel-header {
    flex-shrink: 0;
}

.projet-context-aside .drawer-close-btn {
    display: none;
}

.projet-context-aside .projet-context-body {
    flex: 1;
    padding: 8px 14px 14px;
    font-size: 13px;
    line-height: 1.45;
    overflow-y: auto;
    max-height: none;
}

.projet-context-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 8px;
}

.projet-context-aside .detail-section {
    border-bottom: 1px solid var(--line, #dde5eb);
}

.projet-context-aside .detail-section summary {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
}

.projet-context-aside .detail-section summary::-webkit-details-marker { display: none; }

.index-plan-body { padding: 0 8px 8px; }
.index-plan-lots { max-height: 220px; overflow-y: auto; }
.index-plan-total { margin: 4px 8px 0; font-size: 12px; }

.ag-row.is-index-selected .ag-cell {
    background-color: rgba(46, 143, 255, 0.07) !important;
}
.ag-row.is-index-selected .ag-cell:first-child {
    box-shadow: inset 3px 0 0 #2e8fff;
}
.ag-row.is-lot.is-index-selected .ag-cell {
    background-color: rgba(126, 200, 255, 0.12) !important;
}
.ag-row.is-lot.is-index-selected .ag-cell:first-child {
    box-shadow: inset 3px 0 0 #7ec8ff;
}
.ag-row.assistant-modified .ag-cell {
    animation: assistant-modified-fade 20s ease-out forwards;
}
@keyframes assistant-modified-fade {
    0%   { background-color: #bbf7d0 !important; }
    70%  { background-color: #dcfce7 !important; }
    100% { background-color: transparent !important; }
}

/* --- Panels --- */

.panel {
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 4px 16px #1c425e0f;
    border: 1px solid var(--line);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    gap: 8px;
}

.panel-header h3 { margin: 0; }

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.panel-header-left h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-title-actions { display: flex; flex-shrink: 0; }

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

a.btn {
    appearance: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #fff; color: var(--text); border-color: #c6d6e2; }
.btn-light:hover { background: var(--bg); }
.btn-cancel { background: #fff; color: #cc2222; border: 1px solid #f5c0c0; }
.btn-cancel:hover { background: #fde8e8; border-color: #cc2222; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-active { background: #eaf4ff !important; border-color: #98c4ee !important; color: var(--primary) !important; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.btn-export-wrap { position: relative; }
.export-menu {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    padding: 4px;
    z-index: 200;
    min-width: 100px;
}
.export-menu.open { display: block; }
.export-menu button {
    display: block; width: 100%; text-align: left;
    padding: 6px 14px; border: none; background: none;
    cursor: pointer; font-size: 13px; border-radius: 5px;
    color: var(--text); font-weight: 600;
}
.export-menu button:hover { background: var(--bg); }

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}

/* --- Liste des chiffrages --- */

.runs-list {
    padding: 8px;
    max-height: 600px;
    overflow: auto;
}

.run-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fbfdff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.run-item:hover { background: #f0f7ff; }

.run-item.active {
    border-color: #98c4ee;
    background: #eaf4ff;
}

.run-item p { margin: 3px 0; }

.run-item.nouveau-chiffrage {
    border-style: dashed;
    border-color: #a8cadf;
    background: #f6fbff;
}

.run-item.nouveau-chiffrage:hover {
    border-color: var(--primary);
    background: #eaf4ff;
}

.run-item.nouveau-chiffrage.active {
    border-color: var(--primary);
    background: #ddefff;
}

.run-item.nouveau-chiffrage p {
    color: var(--primary);
    margin: 0;
}

.run-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.run-actions {
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.run-item:hover .run-actions { display: flex; }

.run-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}

.run-action-btn:hover { background: var(--line); color: var(--text); }
.run-action-btn.delete-btn:hover { background: #fde8e8; color: #cc2222; }

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

.statut-processing { color: #e07b00 !important; }
.statut-done       { color: #1a8f4a !important; }
.statut-failed     { color: #cc2222 !important; }
.statut-cancelled  { color: #999    !important; }

.progress-bar-wrap {
    background: #c6d6e2;
    border-radius: 4px;
    height: 5px;
    margin: 6px 0 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.progress-pct { font-size: 11px; margin: 0; }

/* --- Actions export --- */

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

/* --- Vue upload --- */

#view-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 520px;
    padding: 40px;
}

.upload-zone-wrap {
    width: 100%;
    max-width: 520px;
}

#drop-zone {
    border: 2px dashed var(--line);
    border-radius: 12px;
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    background: var(--bg);
    transition: background 0.2s, border-color 0.2s;
}

#drop-zone:hover,
#drop-zone.drag-over {
    background: #eaf4ff;
    border-color: var(--primary);
}

.drop-icon { font-size: 40px; margin-bottom: 8px; }
.drop-label { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.drop-sub   { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
}

.launch-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 12px;
}

input {
    height: 40px;
    border: 1px solid #c6d6e2;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    width: 100%;
    font-size: 14px;
}

.upload-status-msg {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    min-height: 18px;
}

/* --- Vue chargement (metro) --- */

#view-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 520px;
}

.metro-wrap {
    width: 100%;
    padding: 0 48px;
}

.metro-track {
    display: flex;
    align-items: flex-start;
    margin-bottom: 48px;
}

.metro-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    width: 80px;
}

.metro-connector {
    flex: 1;
    height: 3px;
    background: var(--line);
    margin-top: 11px;
    border-radius: 2px;
    transition: background 0.5s ease;
}

.metro-connector.filled { background: var(--primary); }

.metro-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid var(--line);
    background: var(--panel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: transparent;
    transition: border-color 0.4s, background 0.4s;
    position: relative;
    z-index: 1;
}

.metro-step.done .metro-node {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.metro-step.active .metro-node {
    border-color: var(--primary);
    background: var(--panel);
    animation: metro-pulse 2s ease-in-out infinite;
}

@keyframes metro-pulse {
    0%, 100% { box-shadow: 0 0 0 0 #2e8fff44; }
    50%       { box-shadow: 0 0 0 7px transparent; }
}

.metro-label {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    line-height: 1.3;
}

.metro-step.done .metro-label   { color: var(--primary); }
.metro-step.active .metro-label { color: var(--text); font-weight: 600; }

/* Panneau contexte projet (vue chargement pipeline) */

.projet-context-panel {
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.projet-context-panel summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 14px;
    list-style: none;
}

.projet-context-panel summary::-webkit-details-marker { display: none; }

.projet-context-panel .projet-context-body {
    padding: 0 14px 12px;
    font-size: 13px;
    line-height: 1.45;
    max-height: 220px;
    overflow-y: auto;
}

.projet-context-body section { margin-top: 10px; }
.projet-context-body h4 {
    margin: 0 0 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.projet-context-placeholder { font-style: italic; margin: 0; }

.projet-presentation-chiffrage {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.projet-presentation-chiffrage h4 {
    margin: 0 0 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
}

.projet-presentation-text p {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

.projet-presentation-text p:last-child { margin-bottom: 0; }

/* Notes de marge (grille) */

.cell-margin-note {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.margin-note-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e8f2fc;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.margin-note-btn:hover {
    background: var(--primary);
    color: #fff;
}

.margin-note-popup {
    position: fixed;
    z-index: 2500;
    max-width: 360px;
    pointer-events: auto;
}

.margin-note-popup-inner {
    background: #fff;
    border: 1px solid #c5daf5;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    padding: 12px 36px 12px 14px;
    position: relative;
}

.margin-note-popup-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.margin-diff-old {
    color: #c0392b;
    text-decoration: line-through;
}

.margin-diff-new {
    color: #1a7a3a;
    font-weight: 600;
}

.margin-diff-sep {
    color: var(--muted);
}

.margin-note-popup-close {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

/* Barre de progression de l'étape courante */

.step-progress { }

.step-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.step-label-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.step-pct-text {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.step-progress-bar-wrap {
    background: #dde5eb;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.step-progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    background: repeating-linear-gradient(
        -55deg,
        var(--primary)      0px,
        var(--primary)      12px,
        var(--primary-dark) 12px,
        var(--primary-dark) 24px
    );
    background-size: 34px 100%;
    animation: bar-stripes 0.7s linear infinite;
}

@keyframes bar-stripes {
    from { background-position: 0 0; }
    to   { background-position: 34px 0; }
}

.step-progress-msg {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    min-height: 18px;
}

.loading-phase-hint {
    font-size: 13px;
    color: var(--text);
    margin: 14px 0 0;
    padding: 12px 14px;
    background: #eef6ff;
    border: 1px solid #c5daf5;
    border-radius: 8px;
    line-height: 1.45;
}

/* --- Vue table (AG Grid) --- */

#view-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#estimation-grid,
#edit-grid {
    width: 100%;
}

#estimation-grid {
    height: 580px;
    --ag-font-family: "Inter", "Segoe UI", Arial, sans-serif;
    --ag-font-size: 13px;
    --ag-header-background-color: #f4f6f8;
    --ag-header-foreground-color: #163042;
    --ag-border-color: #dde5eb;
    --ag-row-border-color: #dde5eb;
    --ag-selected-row-background-color: #eaf4ff;
    --ag-range-selection-border-color: #2e8fff;
    --ag-input-focus-border-color: #2e8fff;
}

/* Désactive toutes les transitions/animations AG Grid (transactions, apparition, thème Quartz) */
.ag-row, .ag-cell, .ag-row-animation,
.ag-center-cols-container, .ag-full-width-container,
.ag-row-highlight-above, .ag-row-highlight-below,
.ag-animate-next, .ag-after-created {
    transition: none !important;
    animation: none !important;
}
.ag-body-viewport { overflow-anchor: none; }

.ag-row.is-lot .ag-cell                      { background-color: #133a57 !important; color: #fff !important; font-weight: 700 !important; }
.ag-row.is-lot.ag-row-selected .ag-cell     { background-color: #0a2236 !important; color: #fff !important; }
.ag-row.is-titre .ag-cell                   { background-color: #dde5eb !important; color: #163042 !important; font-weight: 600 !important; }
.ag-row.is-titre.ag-row-selected .ag-cell   { background-color: #b8ccd8 !important; color: #163042 !important; }

/* Source Ctrl+C formule : pointillés (outline = pas de reflow, une seule cellule) */
#edit-grid .ag-cell.cell-formula-copy-source {
    outline: 2px dashed #1a8f4a !important;
    outline-offset: -4px;
}

#edit-grid .ag-cell.cell-formula-copy-source.ag-cell-focus {
    outline: 3px dashed #0d6e3a !important;
    outline-offset: -5px;
}

/* --- Spinner compression/upload --- */

.spinner-ring {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.compression-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 13px;
    color: var(--muted);
}

/* --- Statut réseau (retry countdown) --- */

#network-status {
    display: none;
    background: #fff8e6;
    border-bottom: 1px solid #f0c808;
    color: #7a5900;
    font-size: 12px;
    padding: 6px 16px;
    text-align: center;
}

/* --- Barre de progression terminée (vert fixe) --- */

.step-progress-bar-fill.done {
    background: #1a8f4a;
    animation: none;
}

/* --- Onglets --- */

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    background: var(--panel);
}

.tab-btn {
    height: 38px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    padding: 0 16px;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- Explorateur de fichiers --- */

.file-explorer {
    padding: 8px 0;
}

.fe-folder {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.fe-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.fe-file:last-child { border-bottom: none; }
.fe-file-indent { padding-left: 36px; }
.fe-file-name { flex: 1; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fe-file-size { font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.fe-file-actions { display: flex; gap: 4px; flex-shrink: 0; }

.fe-del {
    background: #fde8e8;
    border: 1px solid #f5c0c0;
    color: #cc2222;
    border-radius: 6px;
    cursor: pointer;
}

.fe-del:hover { background: #f8c0c0; }

/* --- Réutiliser dossier --- */

.reutiliser-link-row {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--muted);
}

.reutiliser-select-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.run-select {
    flex: 1;
    height: 36px;
    border: 1px solid #c6d6e2;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

/* --- FAB édition --- */

.fab-edit {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 14px #2e8fff55;
    z-index: 100;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    line-height: 1;
}

.fab-edit:hover { background: var(--primary-dark); transform: scale(1.07); }

/* --- Responsive --- */

@media (max-width: 900px) {
    .content-grid,
    .content-grid.has-projet-context { grid-template-columns: 1fr !important; }

    .content-grid .index-panel-handle { display: none !important; }

    .projet-context-aside {
        position: fixed;
        right: 0;
        top: var(--topbar-h);
        bottom: 0;
        width: min(100vw, 360px);
        z-index: 300;
        max-height: none;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        border-radius: 0 !important;
    }

    .projet-context-aside.drawer-open {
        transform: translateX(0);
    }

    .projet-context-aside .drawer-close-btn {
        display: inline-flex;
    }

    .mobile-drawer-btn--right {
        left: auto;
        right: 12px;
    }
    #view-upload  { min-height: 420px; padding: 24px; }
    .metro-wrap   { padding: 0 24px; }

    /* Volet projets (index) : drawer plein écran, fermé par défaut */
    #index-runs-panel {
        position: fixed;
        left: 0;
        top: var(--topbar-h);
        bottom: 0;
        width: 100vw;
        z-index: 300;
        background: var(--panel);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    #index-runs-panel.drawer-open { transform: translateX(0); }
    #index-runs-panel .runs-list { max-height: none; flex: 1; overflow-y: auto; }

    /* Boutons panel-header sur 2 lignes (index) */
    #detail-panel .panel-header { flex-wrap: wrap; row-gap: 4px; padding-bottom: 8px; }
    #detail-panel .panel-header-left { flex: 1 1 100%; }
    #detail-panel .actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
}

/* ================================================
   PAGE ÉDITION
   ================================================ */

/* Barre d'outils */

.edit-toolbar-bar {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 7px 16px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--line);
    margin: 0 2px;
    flex-shrink: 0;
}

.toolbar-btn-group {
    display: inline-flex;
    align-items: stretch;
}

.toolbar-btn-group > .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -1px;
}

.toolbar-btn-group > .btn.toolbar-btn-attached {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.toolbar-btn-group--split {
    gap: 0;
}

.toolbar-btn-group--split > .btn:first-child {
    margin-right: 0;
}

.toolbar-btn-sep {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    min-height: 24px;
    margin: 2px 6px;
    background: var(--line);
    flex-shrink: 0;
}

.assistant-preview-warn {
    color: #b45309;
    font-weight: 600;
}

.admin-users-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    margin-top: 12px;
    max-height: 360px;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.admin-users-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.admin-users-table th,
.admin-users-table td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.admin-users-table td.admin-users-email {
    white-space: normal;
    word-break: break-word;
    max-width: 200px;
    min-width: 140px;
}

.admin-users-table th {
    position: sticky;
    top: 0;
    background: var(--panel-bg, #fff);
    font-weight: 600;
}

.uo-editor-header-actions .toolbar-btn-group > .btn.toolbar-btn-attached {
    width: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toolbar-select-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
}

/* --- Preview d'insertion --- */

#insert-preview-line {
    position: fixed;
    height: 3px;
    border-radius: 2px;
    background: #2e8fff;
    pointer-events: none;
    z-index: 2000;
    display: none;
}

#insert-preview-line.visible {
    display: block;
    animation: insert-preview-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes insert-preview-pulse {
    from { opacity: 1;    box-shadow: 0 0 10px 3px rgba(46, 143, 255, 0.75); }
    to   { opacity: 0.35; box-shadow: 0 0 4px  1px rgba(46, 143, 255, 0.2);  }
}

/* Layout 3 colonnes — plein viewport */

body.edit-mode {
    overflow: hidden;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.edit-page {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    max-width: none;
}

.edit-run-header { display: none; }

.edit-layout {
    flex: 1;
    display: grid;
    grid-template-columns: var(--left-w, 220px) 20px 1fr 20px var(--right-w, 380px);
    gap: 0;
    align-items: stretch;
    overflow: hidden;
    min-height: 0;
}

/* Poignées de redimensionnement / repliage */

.panel-handle {
    position: relative;
    align-self: stretch;
    width: 20px;
    background: transparent;
    border: none;
    cursor: col-resize;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.panel-handle::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: var(--line);
    z-index: 0;
    transition: background 0.15s;
}

.panel-handle:hover::before { background: var(--primary); }

.handle-arrow {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 9px;
    color: transparent;
    background: transparent;
    border: 1px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.panel-handle:hover .handle-arrow {
    color: var(--primary);
    background: #eaf4ff;
    border-color: #98c4ee;
}

/* Plan des lots */

.plan-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.plan-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.plan-lot-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    transition: background 0.12s;
}

.plan-lot-item:hover  { background: #f0f7ff; }
.plan-lot-item.active { background: #eaf4ff; color: var(--primary); }
.plan-lot-num  { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.plan-lot-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-lot-total { font-weight: 600; white-space: nowrap; color: #1d4a6a; }

.plan-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 2px solid #98c4ee;
    background: #eaf4ff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.plan-total-val { color: var(--primary); }

/* Total général */

.total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 2px solid #98c4ee;
    background: #eaf4ff;
}

.total-label   { font-size: 13px; font-weight: 700; color: var(--text); }
.total-montant { font-size: 16px; font-weight: 700; color: var(--primary); }

/* Panneau droit */

.edit-right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.right-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 8px 12px;
}

.detail-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.detail-section > summary {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
}

.detail-section > summary::after        { content: "▾"; color: var(--muted); font-size: 11px; }
.detail-section[open] > summary::after  { content: "▴"; }

.detail-body {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.detail-field { margin-bottom: 10px; }
.detail-field:last-child { margin-bottom: 0; }

.detail-field-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.detail-field-value { color: var(--text); word-break: break-word; line-height: 1.4; }
.detail-field-value.mono {
    font-family: monospace;
    font-size: 12px;
    background: #f4f6f8;
    padding: 3px 7px;
    border-radius: 4px;
    display: inline-block;
}

.detail-article {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
}

.detail-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-top: 12px;
    margin-bottom: 6px;
}

.detail-section-title:first-child {
    margin-top: 0;
}

.detail-titre {
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.35;
}

.detail-ligne {
    margin-bottom: 6px;
}

.detail-eq {
    margin-bottom: 6px;
    word-break: break-word;
}

.detail-formule {
    font-family: monospace;
    font-size: 12px;
    background: #f4f6f8;
    padding: 1px 5px;
    border-radius: 3px;
}

.detail-valeur {
    font-weight: 600;
}

.detail-erreur {
    color: #cc2222;
    font-size: 12px;
    margin-top: 4px;
}

.detail-montant {
    font-weight: 700;
    margin-top: 4px;
    margin-bottom: 8px;
}

.detail-desc-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-top: 8px;
    margin-bottom: 4px;
}

/* Cellules grille : texte tronqué (justification / sources) */
.ag-cell.cell-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sources-cell-empty { color: var(--muted); }
.sources-cell-text { color: #3d5a73; }

.ligne-sources-panel {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f0f5f9;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 140px;
    overflow-y: auto;
}

.ligne-sources-heading {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--dark-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ligne-sources-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.sources-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 13px;
    line-height: 1.45;
}

.sources-item { margin-bottom: 4px; }
.sources-doc { font-weight: 500; color: var(--text); }
.sources-page { color: var(--muted); font-size: 12px; }
.sources-empty { margin: 0; font-size: 13px; }

.detail-desc {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
    color: var(--text);
}

.detail-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Centre : flex colonne pour que la grille prenne toute la hauteur */

.edit-center {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.edit-center .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.edit-grid-wrap {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.total-bar { flex-shrink: 0; }

/* AG Grid édition */

#edit-grid {
    height: 100%;
    --ag-font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    --ag-font-size: 13px;
    --ag-header-background-color: #f4f6f8;
    --ag-header-foreground-color: #163042;
    --ag-border-color: #dde5eb;
    --ag-row-border-color: #dde5eb;
    --ag-selected-row-background-color: #eaf4ff;
    --ag-range-selection-border-color: #2e8fff;
    --ag-input-focus-border-color: #2e8fff;
}

/* --- Variables panel --- */

.var-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.var-row--read { opacity: 0.75; }

.var-key {
    font-family: monospace;
    font-weight: 600;
    min-width: 40px;
    color: var(--text);
}

.var-val {
    color: #1d4a6a;
}

.var-input {
    height: 28px;
    border: 1px solid #c6d6e2;
    border-radius: 6px;
    padding: 0 6px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
}

.var-del-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 3px;
    flex-shrink: 0;
}

.var-del-btn:hover { color: #cc2222; }

.var-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

/* --- Bouton de fermeture volet (mobile uniquement) --- */

.drawer-close-btn {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 20px;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.drawer-close-row {
    display: none;
    justify-content: flex-end;
    padding: 8px 12px 0;
    flex-shrink: 0;
}

/* --- Drawers mobiles --- */

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 299;
    top: var(--topbar-h);
}

.drawer-overlay.active { display: block; }

@media (max-width: 900px) {
    .edit-layout {
        grid-template-columns: 1fr !important;
    }

    .panel-handle { display: none !important; }

    .plan-panel {
        position: fixed !important;
        left: 0;
        top: var(--topbar-h);
        bottom: 0;
        width: 100vw !important;
        z-index: 300;
        background: var(--panel);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-radius: 0 !important;
    }

    .plan-panel.drawer-open { transform: translateX(0); }

    .edit-right-panel {
        position: fixed !important;
        right: 0;
        top: var(--topbar-h);
        bottom: 0;
        width: 100vw !important;
        z-index: 300;
        background: var(--panel);
        transform: translateX(100%);
        transition: transform 0.25s ease;
        border-radius: 0 !important;
    }

    .edit-right-panel.drawer-open { transform: translateX(0); }

    /* Bouton d'ouverture du volet (visible quand volet fermé, masqué derrière quand ouvert) */
    .mobile-drawer-btn {
        display: flex !important;
        position: fixed;
        top: 66vh;
        z-index: 290;
        width: 28px;
        height: 48px;
        align-items: center;
        justify-content: center;
        background: var(--dark);
        color: #fff;
        border: none;
        cursor: pointer;
        font-size: 10px;
        opacity: 0.7;
        border-radius: 0 6px 6px 0;
    }

    .mobile-drawer-btn.right {
        right: 0;
        border-radius: 6px 0 0 6px;
    }

    .mobile-drawer-btn:hover { opacity: 1; }

    /* Bouton de fermeture à l'intérieur d'un volet plein écran */
    .drawer-close-btn { display: flex !important; }
    .drawer-close-row { display: flex !important; }
}

/* --- Vue erreur --- */

.error-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 16px;
}

.error-cone-img {
    width: 80px;
    height: auto;
    display: block;
}

.error-title {
    margin: 0;
    font-size: 17px;
    color: var(--text);
    font-weight: 600;
}

.error-msg {
    margin: 0;
    max-width: 420px;
    text-align: center;
    line-height: 1.5;
}

/* --- Popup recherche prix --- */

.prix-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(10, 25, 40, 0.65);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.prix-popup-inner {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
}

.prix-popup-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.prix-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    flex-wrap: wrap;
}

.prix-popup-source-tabs {
    display: flex;
    gap: 4px;
}

.source-tab {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}

.source-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.perso-badge {
    display: inline-block;
    background: #1a8f4a;
    color: #fff;
    font-size: 11px;
    border-radius: 8px;
    padding: 1px 6px;
    margin-left: 4px;
    vertical-align: middle;
}

.prix-popup-search-wrap {
    flex: 1;
    min-width: 200px;
}

.prix-popup-search-wrap input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    background: var(--panel);
    color: var(--text);
}

.prix-popup-search-wrap input:focus {
    border-color: var(--primary);
}

.prix-popup-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.prix-popup-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Arborescence */

.prix-arbo {
    width: 230px;
    min-width: 160px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    padding: 8px 0;
    background: var(--bg);
    flex-shrink: 0;
}

.prix-arbo-all {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
}

.prix-arbo-famille {
    padding: 6px 14px 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.prix-arbo-famille:hover,
.prix-arbo-all:hover {
    background: var(--line);
}

.prix-arbo-famille.active,
.prix-arbo-all.active {
    background: #dbeafe;
    color: var(--primary-dark);
}

.prix-arbo-sous-famille {
    padding: 5px 14px 5px 26px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text);
}

.prix-arbo-sous-famille:hover {
    background: var(--line);
}

.prix-arbo-sous-famille.active {
    background: #dbeafe;
    color: var(--primary-dark);
    font-weight: 600;
}

.prix-arbo-chevron {
    font-size: 10px;
    display: inline-block;
    transition: transform .15s;
    margin-right: 2px;
}

.prix-arbo-chevron.open {
    transform: rotate(90deg);
}

/* Résultats */

.prix-results-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.prix-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.prix-hint {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin-top: 40px;
}

.prix-loading {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 24px;
}

.prix-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: background .12s;
}

.prix-result-item:hover,
.prix-result-item.active {
    background: #f0f7ff;
    border-color: var(--primary);
}

.prix-result-indice,
.uo-search-result-indice {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    flex-shrink: 0;
}

.prix-result-desc {
    flex: 1;
    font-size: 13px;
}

.prix-result-unite {
    font-size: 12px;
    color: var(--muted);
    min-width: 40px;
    text-align: right;
}

.prix-result-prix {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    min-width: 80px;
    text-align: right;
}

/* Vue base perso */

.prix-perso-content {
    display: flex;
    gap: 32px;
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.prix-perso-explications {
    flex: 1;
    max-width: 520px;
}

.prix-perso-explications h3 {
    margin-top: 0;
    font-size: 15px;
}

.prix-perso-explications ol,
.prix-perso-explications ul {
    margin: 8px 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.7;
}

.prix-perso-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
    max-width: 360px;
}

.prix-upload-zone {
    border: 2px dashed var(--line);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    background: var(--bg);
    cursor: pointer;
    transition: border-color .15s;
}

.prix-upload-zone.dragover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.prix-upload-zone p {
    margin: 0 0 8px;
}

.prix-import-status {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.prix-import-status.ok {
    background: #d1fae5;
    color: #065f46;
}

.prix-import-status.err {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 640px) {
    .prix-arbo { width: 120px; }
    .prix-result-indice { display: none; }
    .prix-perso-content { flex-direction: column; }
    .prix-perso-actions { max-width: 100%; }
}

/* ========== Footer accueil + modale administration ========== */

.index-footer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 16px 24px;
    border-top: 1px solid var(--line);
}

.index-admin-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.index-admin-modal-inner {
    background: #fff;
    border-radius: 10px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.index-admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.index-admin-modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.index-admin-modal .admin-actions-content {
    overflow-y: auto;
}

.gemini-key-modal-inner {
    max-width: 480px;
}

.gemini-key-modal-body {
    padding: 20px;
}

.gemini-key-modal-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.gemini-key-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

/* ========== Vue administration (import Grist / indices BT) ========== */

.admin-actions-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.admin-action-card {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
}

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

.admin-action-card:has(#admin-users-stats-wrap) {
    flex-direction: column;
    align-items: stretch;
}

.admin-action-card:has(#admin-users-stats-wrap) .admin-action-controls {
    flex-direction: row;
    min-width: 0;
    width: 100%;
    justify-content: flex-end;
}

.admin-action-info strong {
    font-size: 14px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.admin-action-info p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.admin-action-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    align-items: flex-end;
}

/* ========== Tableau UO compact (panneau détail) ========== */

.uo-table-wrap {
    margin-top: 12px;
}

.uo-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.uo-table-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #b45309;
}

.btn-edit-uo {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #d97706;
    background: #fff7ed;
    color: #b45309;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    font-family: inherit;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}

.btn-edit-uo:hover {
    background: #fed7aa;
}

.uo-compact-table {
    width: 100%;
    font-size: 11px;
    border-collapse: collapse;
}

.uo-compact-table thead tr {
    background: #fff7ed;
}

.uo-compact-table th {
    padding: 4px 6px;
    font-weight: 600;
    color: #92400e;
    border-bottom: 1px solid #fed7aa;
}

.uo-compact-table th:last-child,
.uo-compact-table td:last-child {
    text-align: right;
}

.uo-compact-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #fef3c7;
    color: var(--text);
}

.uo-compact-table tr:last-child td {
    border-bottom: none;
}

.uo-compact-total {
    background: #fff7ed;
    font-weight: 600;
}

.uo-compact-total td {
    padding: 4px 6px;
    color: #92400e;
    border-top: 1px solid #fed7aa;
    border-bottom: none !important;
}

/* ========== Modale éditeur UO plein écran ========== */

.uo-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1200;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.uo-editor-inner {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.uo-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fff7ed;
    border-bottom: 2px solid #fed7aa;
    flex-shrink: 0;
}

.uo-editor-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.uo-editor-label {
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.uo-editor-ligne-name {
    font-size: 14px;
    color: var(--text);
    font-style: italic;
}

.uo-editor-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.uo-search-panel {
    background: #fffbf5;
    border-bottom: 1px solid #fed7aa;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 300px;
}

.uo-search-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 8px;
}

.uo-search-input {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #d97706;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
}

.uo-search-input:focus {
    border-color: #b45309;
    box-shadow: 0 0 0 2px rgba(180, 83, 9, .15);
}

.uo-search-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 16px 10px;
    gap: 12px;
}

.uo-search-results {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fff;
    min-width: 0;
}

.uo-search-result-item {
    display: grid;
    grid-template-columns: 90px 1fr 50px 80px;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #fef3c7;
    transition: background .1s;
}

.uo-search-result-item:hover,
.uo-search-result-item.active {
    background: #fff7ed;
}

.uo-search-result-item:last-child {
    border-bottom: none;
}

.uo-search-result-indice {
    color: #92400e;
}

.uo-search-result-prix {
    text-align: right;
    font-weight: 600;
    color: #b45309;
}

.uo-search-preview {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fff;
    padding: 10px;
}

.uo-editor-grid {
    flex: 1;
    min-height: 0;
}

/* ========== Fiche preview partagée (UO + articles) ========== */

.fiche-hint {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin: 16px 0;
}

.fiche-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fiche-indice {
    font-size: 11px;
    color: #92400e;
    background: #fff7ed;
    border-radius: 3px;
    padding: 2px 6px;
    display: inline-block;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.fiche-categorie {
    display: none;
    margin-left: 4px;
    margin-bottom: 4px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.fiche-designation {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.fiche-famille {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.fiche-sep {
    border: none;
    border-top: 1px solid var(--line);
    margin: 6px 0;
}

.fiche-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    gap: 8px;
}

.fiche-row-label {
    color: var(--muted);
    flex-shrink: 0;
}

.fiche-row-value {
    font-weight: 500;
    text-align: right;
}

.fiche-row-value.prix {
    color: #b45309;
    font-weight: 700;
}

.fiche-description {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.5;
    background: var(--bg-alt, #f8fafc);
    border-radius: 4px;
    padding: 6px 8px;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.fiche-btn-insert {
    margin-top: 10px;
    width: 100%;
    padding: 7px;
    background: #d97706;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s;
}

.fiche-btn-insert:hover {
    background: #b45309;
}

/* Preview colonne dans la popup article */

.prix-popup-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.prix-preview {
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid var(--line);
    padding: 12px;
    overflow-y: auto;
    background: var(--bg);
}

/* ============================= */

.uo-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #fff7ed;
    border-top: 1px solid #fed7aa;
    flex-shrink: 0;
    gap: 12px;
}

.uo-footer-coefs {
    display: flex;
    align-items: center;
    gap: 16px;
}

.uo-coef-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
}

.uo-coef-input {
    width: 72px;
    padding: 3px 6px;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    color: #1e1e1e;
    text-align: right;
}

.uo-coef-input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.uo-coef-readonly {
    opacity: 0.75;
}

.uo-coef-display {
    display: inline-block;
    width: 72px;
    padding: 3px 6px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-size: 12px;
    color: #92400e;
    text-align: right;
    font-family: monospace;
}

.uo-editor-total {
    font-size: 16px;
    font-weight: 700;
    color: #92400e;
    margin-left: auto;
}

/* --- Auth / compte --- */

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

.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(10, 25, 40, 0.08);
}

.auth-card-wide {
    max-width: 560px;
}

.auth-brand {
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}

.auth-tab {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.auth-tab + .auth-tab {
    border-left: 1px solid var(--line);
}

.auth-tab.active {
    background: var(--primary);
    color: #fff;
}

.auth-tab:not(.active):hover {
    background: #eaf4ff;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 4px;
}

.auth-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
}

.auth-submit {
    width: 100%;
    margin-top: 20px;
}

.auth-error {
    color: #cc2222;
    font-size: 13px;
    margin-top: 12px;
}

.auth-hint {
    font-size: 12px;
    margin-top: 8px;
}

.tutoriel-steps {
    margin: 16px 0 24px 20px;
    line-height: 1.6;
}

.gemini-billing-notice {
    margin: 16px 0 20px;
    padding: 14px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.55;
    color: #065f46;
}

.gemini-billing-notice strong {
    color: #047857;
}

.gemini-billing-notice ul {
    margin: 10px 0 0 1.1em;
    padding: 0;
}

.gemini-billing-notice li {
    margin-bottom: 6px;
}

.gemini-billing-notice li:last-child {
    margin-bottom: 0;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-user-menu {
    position: relative;
    margin-left: 4px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 1;
    min-width: 0;
}

.topbar-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(260px, 34vw);
    padding: 6px 10px;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.topbar-user-trigger:hover,
.topbar-user-menu.is-open .topbar-user-trigger {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.topbar-user-icon {
    display: inline-flex;
    flex-shrink: 0;
    opacity: 0.9;
}

.topbar-user-icon svg {
    width: 18px;
    height: 18px;
}

.topbar-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.topbar-user-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.75;
    transition: transform 0.15s;
}

.topbar-user-menu.is-open .topbar-user-chevron {
    transform: rotate(180deg);
}

.topbar-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border, #d4dde5);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 40, 60, 0.18);
    z-index: 1200;
}

.topbar-user-menu.is-open .topbar-user-dropdown {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    text-decoration: none;
    color: var(--text, #1d4a6a);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
}

.topbar-user-dropdown-item:hover {
    background: #eef4f9;
}

.topbar-user-dropdown-item--danger {
    color: #cc2222;
}

.topbar-user-dropdown-item--danger:hover {
    background: #fde8e8;
}

.quota-banner {
    font-size: 12px;
    max-width: 280px;
    color: rgba(255, 255, 255, 0.85);
}

.gemini-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #fff8e6;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 14px;
}

/* --- Page Mon compte --- */

.compte-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.compte-page {
    flex: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 16px 40px;
    box-sizing: border-box;
}

.compte-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 4px 16px #1c425e0f;
    padding: 28px 32px 32px;
}

.compte-section + .compte-section {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.compte-section-title {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.compte-dl {
    margin: 0 0 8px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    font-size: 14px;
}

.compte-dl dt {
    margin: 0;
    font-weight: 600;
    color: var(--muted);
}

.compte-dl dd {
    margin: 0;
    font-weight: 600;
    color: var(--text);
}

.compte-quota {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.5;
}

.compte-lead {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
}

.compte-lead a {
    color: var(--primary);
    font-weight: 600;
}

.compte-status {
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--bg);
    border: 1px solid var(--line);
}

.compte-status.is-ok {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.compte-status.is-missing {
    background: #fff8e6;
    border-color: #fde68a;
    color: #92400e;
}

.compte-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text);
}

.compte-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}

.compte-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 143, 255, 0.2);
}

.compte-form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.compte-form-actions .btn {
    width: 100%;
}

.compte-feedback {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.compte-feedback.is-error {
    background: #fde8e8;
    color: #cc2222;
    border: 1px solid #f5c0c0;
}

.compte-feedback.is-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* --- Assistant chiffrage (bulle flottante index) --- */
.assistant-fab-wrap {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 200;
}
.assistant-fab-wrap[hidden] {
    display: none !important;
}
.assistant-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary, #2e8fff);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(46, 143, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
}
.assistant-fab:hover {
    background: var(--primary-dark, #1a6fd4);
    transform: scale(1.06);
}
.assistant-float-panel {
    position: fixed;
    bottom: 92px;
    right: 28px;
    width: min(400px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 120px));
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line, #dde5eb);
}
.assistant-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 2;
    opacity: 0.35;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    border-top-left-radius: 12px;
}
.assistant-resize-handle:hover { opacity: 0.7; }
.assistant-float-panel[hidden] {
    display: none !important;
}
.assistant-float-panel.open {
    animation: assistant-slide-up 0.2s ease-out;
}
@keyframes assistant-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.assistant-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line, #dde5eb);
    font-weight: 600;
    font-size: 14px;
    background: #f8fafc;
}
.assistant-messages {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
}
.assistant-msg.user .assistant-msg-body {
    background: #e8f0fe;
    border-radius: 8px;
    padding: 8px 10px;
    margin-left: 16px;
}
.assistant-msg.bot .assistant-msg-body {
    background: #f4f5f7;
    border-radius: 8px;
    padding: 8px 10px;
    margin-right: 16px;
}
.assistant-msg--reveal .assistant-reveal-line {
    animation: assistant-line-reveal 0.38s ease-out backwards;
}
@keyframes assistant-line-reveal {
    from {
        opacity: 0.2;
        filter: blur(3px);
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .assistant-msg--reveal .assistant-reveal-line {
        animation: none;
    }
}
.assistant-msg-body p { margin: 0 0 6px; }
.assistant-msg-body p:last-child { margin-bottom: 0; }
.assistant-md-list { margin: 4px 0 8px; padding-left: 18px; }
.assistant-md-list li { margin-bottom: 4px; }
.assistant-msg-body code {
    font-size: 12px;
    background: rgba(0,0,0,0.06);
    padding: 1px 4px;
    border-radius: 3px;
}
.assistant-line-ref {
    display: inline;
    border: none;
    background: #dbeafe;
    color: #1d4a6a;
    font: inherit;
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.assistant-line-ref:hover { background: #bfdbfe; }
.assistant-msg-system .assistant-msg-body {
    background: #ecfdf5;
    color: #065f46;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    text-align: left;
    margin: 4px 8px;
}
.assistant-msg-system.reject .assistant-msg-body {
    background: #fef2f2;
    color: #991b1b;
}
.assistant-msg-tools {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}
.assistant-tool-hint {
    font-size: 11px;
    color: #475569;
    padding: 4px 10px;
    margin: 0 16px 4px 0;
    background: #f1f5f9;
    border-radius: 4px;
    border-left: 3px solid #94a3b8;
}
.assistant-msg-tools .assistant-tool-hint {
    margin: 0;
}
.assistant-msg-applying .assistant-msg-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 48px;
    background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 50%, #eff6ff 100%);
    background-size: 200% 100%;
    animation: assistant-applying-bg 2s ease-in-out infinite;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 12px;
}
.assistant-applying-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #93c5fd;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: assistant-spin 0.8s linear infinite;
}
.assistant-applying-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}
.assistant-applying-hint {
    font-size: 11px;
}
@keyframes assistant-applying-bg {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes assistant-spin {
    to { transform: rotate(360deg); }
}
.assistant-system-refs {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
}
.assistant-system-refs .assistant-line-ref {
    display: block;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    overflow: visible;
}
.assistant-line-ref--mod {
    background: #dbeafe;
    color: #1d4a6a;
}
.assistant-line-ref--mod:hover { background: #bfdbfe; }
.assistant-line-ref--sm {
    font-size: 11px;
    padding: 2px 8px;
}
.assistant-line-ref--del {
    background: #fee2e2;
    color: #991b1b;
}
.assistant-line-ref--del:hover { background: #fecaca; }
.assistant-line-ref--add {
    background: #dcfce7;
    color: #166534;
}
.assistant-line-ref--add:hover { background: #bbf7d0; }
.assistant-preview-del { color: #991b1b; }
.assistant-preview-add { color: #166534; }
.assistant-tool-hint-live {
    color: #2e8fff;
    animation: assistant-pulse 1.2s ease-in-out infinite;
}
@keyframes assistant-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}
.assistant-msg-typing .assistant-msg-body {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}
.assistant-typing-dots {
    display: inline-flex;
    gap: 4px;
}
.assistant-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: assistant-dot 1.2s ease-in-out infinite;
}
.assistant-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.assistant-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes assistant-dot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
.assistant-typing-label { font-size: 12px; color: #64748b; }
.assistant-hint, .assistant-mode-hint { font-size: 12px; margin: 0 0 6px; }
.assistant-compose {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line, #dde5eb);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.assistant-input {
    width: 100%;
    resize: vertical;
    min-height: 48px;
    font-family: inherit;
    font-size: 13px;
    padding: 8px;
    border: 1px solid var(--line, #dde5eb);
    border-radius: 6px;
    box-sizing: border-box;
}
.assistant-compose-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.assistant-status { font-size: 12px; flex: 1; }
.assistant-preview {
    margin: 0 12px 8px;
    border: 1px solid #f0c040;
    background: #fffbeb;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
}
.assistant-preview-title { font-weight: 600; margin: 0 0 6px; }
.assistant-preview-list { margin: 0 0 8px; padding-left: 18px; }
.assistant-preview-actions { display: flex; gap: 8px; }

@media (max-width: 600px) {
    .assistant-float-panel {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
    }
    .assistant-fab-wrap { right: 16px; bottom: 16px; }
}

