@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --bg:#ffffff;
--surface:#ffffff;
--surface-2:#ffffff;
--surface-3:#f7f7f7;

  --border:#e5e5e5;
  --text:#222222;
  --text-muted:#666666;
  --text-faint:#999999;

  --accent:#229ED9;
  --accent-soft:rgba(34,158,217,0.10);

  --teal:#168ACB;
  --teal-soft:rgba(22,138,203,0.10);
  --rust:#e35d6a;
}
*{box-sizing:border-box;}
html,body{margin:0;height:100%;background:var(--bg);}
body{font-family:'Inter',sans-serif;color:var(--text);font-size:14px;}
.display{font-family:'Fraunces',serif;font-weight:500;}
.mono{font-family:'IBM Plex Mono',monospace;}
button{font-family:inherit;cursor:pointer;}
input,textarea{font-family:inherit;color:var(--text);}
::-webkit-scrollbar{width:8px;} ::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:4px;}

.btn{background:var(--accent);color:#ffffff;border:none;padding:9px 14px;border-radius:10px;font-weight:600;font-size:13px;}
.btn:hover{filter:brightness(1.08);}
.btn.small{padding:6px 10px;font-size:12px;}
.btn.ghost{background:none;border:1px solid var(--border);color:var(--text-muted);}
.btn.ghost:hover{border-color:var(--accent);color:var(--accent);}
.btn.teal{background:var(--teal);color:#ffffff;}

input[type=text],input[type=password],textarea{
  background:var(--surface-2);border:1px solid var(--border);color:var(--text);
  padding:9px 10px;border-radius:2px;font-size:13px;outline:none;width:100%;
}
input:focus,textarea:focus{border-color:var(--accent);}
label{display:block;font-size:11px;color:var(--text-faint);margin-bottom:4px;text-transform:uppercase;letter-spacing:0.5px;}
.field{margin-bottom:14px;}

/* ---- Auth pages ---- */
.auth-page{display:flex;align-items:center;justify-content:center;height:100vh;}
.auth-card{background:var(--surface);border:1px solid var(--border);border-radius:4px;padding:32px;width:360px;max-width:90vw;}
.auth-card h1{font-size:22px;margin:0 0 18px;}
.auth-error{background:rgba(162,70,52,0.1);border:1px solid var(--rust);color:#7a2e1f;padding:9px 12px;border-radius:3px;font-size:12.5px;margin-bottom:14px;}
.auth-success{background:rgba(61,122,112,0.1);border:1px solid var(--teal);color:#1f5048;padding:9px 12px;border-radius:3px;font-size:12.5px;margin-bottom:14px;}
.auth-switch{font-size:12.5px;color:var(--text-faint);margin-top:14px;}
.auth-switch a{color:var(--accent);}

/* ---- App layout ---- */
.shell{display:flex;height:100vh;overflow:hidden;}
.rail{width:84px;flex-shrink:0;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;align-items:center;padding:18px 0;}
.rail-brand{font-family:'Fraunces',serif;font-size:20px;color:var(--accent);margin-bottom:22px;writing-mode:vertical-rl;letter-spacing:2px;}
.rail nav{display:flex;flex-direction:column;gap:6px;width:100%;align-items:center;flex:1;}
.rail-btn{width:64px;background:none;border:1px solid transparent;border-radius:2px;color:var(--text-faint);padding:10px 4px;display:flex;flex-direction:column;align-items:center;gap:5px;font-size:10.5px;letter-spacing:0.3px;position:relative;}
.rail-btn span{text-transform:uppercase;}
.nav-badge{position:absolute;top:2px;right:6px;background:var(--rust);color:#fff;font-size:9.5px;font-weight:700;min-width:16px;height:16px;border-radius:8px;display:flex;align-items:center;justify-content:center;padding:0 4px;text-transform:none;letter-spacing:0;font-family:'IBM Plex Mono',monospace;}
.nav-badge.teal{background:var(--teal);}
.contact-item{position:relative;}
.contact-item .unread-badge{margin-left:auto;background:var(--rust);color:#fff;font-size:10px;font-weight:700;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 5px;font-family:'IBM Plex Mono',monospace;flex-shrink:0;}
.admin-link-badge{background:var(--rust);color:#fff;font-size:9px;font-weight:700;min-width:14px;height:14px;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;padding:0 3px;margin-left:4px;vertical-align:middle;}

.toast-stack{position:fixed;top:18px;right:18px;z-index:60;display:flex;flex-direction:column;gap:10px;}
.toast{background:var(--surface);border:1px solid var(--teal);border-left:3px solid var(--teal);border-radius:3px;padding:12px 14px;width:260px;box-shadow:0 6px 20px rgba(0,0,0,0.12);animation:toast-in 0.25s ease;}
.toast .ttitle{font-size:12px;font-weight:700;color:var(--teal);margin-bottom:3px;}
.toast .tbody{font-size:12.5px;color:var(--text);}
.toast .tclose{position:absolute;top:6px;right:8px;background:none;border:none;color:var(--text-faint);font-size:13px;cursor:pointer;}
.toast{position:relative;}
@keyframes toast-in{from{opacity:0;transform:translateX(20px);}to{opacity:1;transform:translateX(0);}}
.rail-btn.active{color:var(--accent);background:var(--accent-soft);}
.rail-btn.active::before{content:'';position:absolute;left:-10px;top:50%;transform:translateY(-50%);width:3px;height:22px;background:var(--accent);}
.rail-btn:hover:not(.active){color:var(--text-muted);}
.rail-profile{width:68px;padding-top:14px;border-top:1px solid var(--border);text-align:center;}
.rail-profile .av{width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;margin:0 auto 6px;font-size:12px;font-weight:600;}
.rail-profile .rp-name{font-size:10px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.rail-profile .rp-user{font-size:9px;color:var(--text-faint);margin-bottom:6px;}
.rail-profile a{font-size:9.5px;color:var(--text-faint);text-decoration:underline;text-underline-offset:2px;}
.rail-profile a:hover{color:var(--accent);}
.rail-profile a{display:block;margin-top:3px;}

.view{flex:1;display:none;min-width:0;overflow:hidden;}
.view.active{display:flex;}

.colhead{padding:16px;border-bottom:1px solid var(--border);}
.colhead .sub{color:var(--text-faint);font-size:11px;margin-bottom:10px;letter-spacing:0.4px;}

@media (max-width:820px){
  .shell{flex-direction:column;}
  .rail{width:100%;flex-direction:row;padding:8px 12px;order:2;}
  .rail-brand,.rail-profile{display:none;}
  .rail nav{flex-direction:row;flex:1;}
  .rail-btn{width:auto;flex:1;}
  main,.view{order:1;}
  .contacts-col,.folders-col{width:130px;}
  .agenda-side{width:220px;}
}

/* ---- Contacts / chat (déjà stylés plus haut, colonnes réutilisées) ---- */
.contacts-col{width:280px;flex-shrink:0;border-right:1px solid var(--border);display:flex;flex-direction:column;background:var(--surface);}
.contacts-list{flex:1;overflow-y:auto;}
.contact-item{padding:12px 16px;border-bottom:1px solid var(--border);cursor:pointer;display:flex;gap:10px;align-items:center;}
.contact-item:hover{background:var(--surface-2);}
.contact-item.active{background:var(--accent-soft);}
.contact-item .av{width:28px;height:28px;border-radius:50%;background:var(--surface-3);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;color:var(--accent);flex-shrink:0;}
.contact-item .name{font-size:13px;font-weight:500;}
.contact-item .user{font-size:10.5px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;}

.add-panel{padding:14px;border-bottom:1px solid var(--border);background:var(--surface-2);}
.add-panel .err{color:var(--rust);font-size:11.5px;margin-bottom:8px;}

/* ---- Agenda ---- */
#view-agenda{flex-direction:row;}
.cal-main{flex:1;padding:24px 30px;overflow-y:auto;}
.cal-nav{display:flex;align-items:center;justify-content:center;gap:18px;margin-bottom:18px;}
.cal-nav button{background:none;border:1px solid var(--border);color:var(--text-muted);width:30px;height:30px;border-radius:2px;}
.cal-nav button:hover{border-color:var(--accent);color:var(--accent);}
.cal-nav .label{font-family:'Fraunces',serif;font-size:18px;min-width:190px;text-align:center;text-transform:capitalize;}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;background:var(--border);border:1px solid var(--border);}
.cal-dow{background:var(--surface-2);padding:8px;text-align:center;font-size:10.5px;color:var(--text-faint);text-transform:uppercase;letter-spacing:0.5px;}
.cal-cell{background:var(--surface);min-height:78px;padding:8px;cursor:pointer;position:relative;}
.cal-cell:hover{background:var(--surface-2);}
.cal-cell.out{opacity:0.3;}
.cal-cell.today .num{color:var(--accent);font-weight:700;}
.cal-cell.selected{outline:1.5px solid var(--accent);outline-offset:-1.5px;}
.cal-cell .num{font-size:12.5px;color:var(--text-muted);}
.cal-cell .dots{display:flex;gap:3px;flex-wrap:wrap;margin-top:6px;}
.cal-cell .dots span{width:5px;height:5px;border-radius:50%;background:var(--teal);}

.agenda-side{width:340px;border-left:1px solid var(--border);padding:22px;overflow-y:auto;flex-shrink:0;}
.agenda-side h3{font-size:14px;margin:0 0 4px;text-transform:capitalize;}
.agenda-side .day-sub{color:var(--text-faint);font-size:11.5px;margin-bottom:16px;}
.rdv-item{background:var(--surface-2);border:1px solid var(--border);border-left:2px solid var(--teal);border-radius:2px;padding:10px 12px;margin-bottom:8px;}
.rdv-item .time{font-family:'IBM Plex Mono',monospace;font-size:11px;color:var(--teal);}
.rdv-item .title{font-size:13px;font-weight:600;margin:2px 0 3px;}
.rdv-item .desc{font-size:11.5px;color:var(--text-muted);white-space:pre-wrap;line-height:1.5;}
.rdv-item .row-actions{display:flex;gap:8px;margin-top:8px;}
.rdv-item .row-actions button{background:none;border:none;font-size:10.5px;color:var(--text-faint);padding:0;text-decoration:underline;text-underline-offset:2px;}
.rdv-item .row-actions button:hover{color:var(--accent);}

/* ---- Dossiers ---- */
#view-dossiers{flex-direction:row;}
.folders-col{width:240px;border-right:1px solid var(--border);flex-shrink:0;display:flex;flex-direction:column;}
.folders-list{flex:1;overflow-y:auto;}
.folder-item{padding:11px 16px;border-bottom:1px solid var(--border);cursor:pointer;font-size:13px;}
.folder-item:hover{background:var(--surface-2);}
.folder-item.active{background:var(--accent-soft);color:var(--accent);}
.folder-item .fmeta{font-size:10px;color:var(--text-faint);margin-top:2px;}
.folder-item .fmeta .shared-tag{color:var(--teal);}

.items-main{flex:1;display:flex;flex-direction:column;min-width:0;}
.items-head{padding:16px 24px;border-bottom:1px solid var(--border);display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.items-head input[type=text]{flex:1;min-width:140px;}
.items-scroll{flex:1;overflow-y:auto;padding:20px 24px;}
.item-card{background:var(--surface-2);border:1px solid var(--border);border-radius:3px;padding:14px 16px;margin-bottom:12px;}
.item-card .ihead{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:8px;}
.item-card .ititle{font-size:14px;font-weight:600;}
.item-card .itag{font-size:9.5px;text-transform:uppercase;letter-spacing:0.5px;padding:2px 6px;border-radius:2px;font-family:'IBM Plex Mono',monospace;flex-shrink:0;}
.item-card .itag.note{background:var(--accent-soft);color:var(--accent);}
.item-card .itag.file{background:var(--teal-soft);color:var(--teal);}
.item-card .content{font-size:13px;color:var(--text-muted);white-space:pre-wrap;line-height:1.5;max-height:160px;overflow-y:auto;}
.item-card .iactions{display:flex;gap:12px;margin-top:10px;}
.item-card .iactions button{background:none;border:none;font-size:11px;color:var(--text-faint);padding:0;text-decoration:underline;text-underline-offset:2px;}
.item-card .iactions button:hover{color:var(--accent);}
.item-card .imeta{font-size:10px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;margin-top:6px;}
.perm-badge{font-size:10px;padding:3px 8px;border-radius:10px;border:1px solid var(--border);color:var(--text-faint);}
.perm-badge.view{color:var(--text-muted);}
.perm-badge.edit{color:var(--teal);border-color:var(--teal);}

.share-row{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid var(--border);font-size:12.5px;}
.share-row:last-child{border-bottom:none;}
.share-row .who{flex:1;}
.share-row .who .u{color:var(--text-faint);font-size:11px;}
.share-row button{background:none;border:none;color:var(--rust);font-size:11px;text-decoration:underline;text-underline-offset:2px;}

/* ---- Modal ---- */
.modal-back{position:fixed;inset:0;background:rgba(10,12,16,0.6);display:none;align-items:center;justify-content:center;z-index:50;}
.modal-back.active{display:flex;}
.modal{background:var(--surface);border:1px solid var(--border);border-radius:4px;width:420px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:22px;}
.modal h3{margin:0 0 16px;font-size:16px;}
.modal .actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px;}

/* ---- Admin ---- */
.admin-page{min-height:100vh;padding:32px;}
.admin-wrap{max-width:720px;margin:0 auto;}
.admin-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;}
.admin-head h1{font-size:24px;margin:0;}
.admin-sub{font-size:14px;color:var(--text-muted);margin:0 0 12px;font-weight:600;}
.admin-table{border:1px solid var(--border);border-radius:4px;overflow:hidden;}
.admin-row{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--border);background:var(--surface);}
.admin-row:last-child{border-bottom:none;}
.admin-row .name{font-size:13.5px;font-weight:600;}
.admin-row .u{font-size:11px;color:var(--text-faint);margin-top:2px;}
.admin-actions{display:flex;gap:8px;flex-shrink:0;}

.profile-section{border:1px solid var(--border);border-radius:4px;padding:18px 20px;margin-bottom:18px;background:var(--surface);}
.profile-section.danger{border-color:var(--rust);}
.profile-section input[disabled]{opacity:0.6;}

.chat-col{flex:1;display:flex;flex-direction:column;min-width:0;}
.chat-head{padding:14px 22px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;}
.chat-head .name{font-size:15px;font-weight:600;}
.chat-head .tag{font-size:10.5px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;}

.messages-scroll{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:10px;}
.bubble-row{display:flex;}
.bubble-row.me{justify-content:flex-end;}
.bubble{max-width:62%;padding:9px 12px;border-radius:8px;font-size:13.5px;line-height:1.45;}
.bubble-row.me .bubble{background:var(--accent-soft);border:1px solid rgba(169,116,38,0.35);border-bottom-right-radius:2px;}
.bubble-row.them .bubble{background:var(--surface-2);border:1px solid var(--border);border-bottom-left-radius:2px;}
.bubble .meta{font-size:9.5px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;margin-top:4px;}
.bubble{position:relative;}
.bubble .edited-tag{font-style:italic;}
.bubble-actions{position:absolute;top:-10px;right:6px;background:var(--surface);border:1px solid var(--border);border-radius:3px;display:flex;gap:0;opacity:0;transition:opacity 0.12s;overflow:hidden;}
.bubble:hover .bubble-actions{opacity:1;}
.bubble-actions button{background:none;border:none;font-size:10px;color:var(--text-faint);padding:4px 8px;border-right:1px solid var(--border);}
.bubble-actions button:last-child{border-right:none;}
.bubble-actions button:hover{color:var(--accent);background:var(--accent-soft);}
.edit-box{width:100%;min-width:220px;background:var(--surface);border:1px solid var(--accent);color:var(--text);padding:8px;border-radius:3px;font-family:inherit;font-size:13.5px;resize:vertical;min-height:60px;}

/* ---- Réponse à un message ---- */
.reply-quote{border-left:2px solid var(--teal);background:rgba(61,122,112,0.08);border-radius:2px;padding:5px 8px;margin-bottom:6px;cursor:pointer;}
.reply-quote .rq-who{font-size:10.5px;color:var(--teal);font-weight:700;}
.reply-quote .rq-text{font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px;}
.reply-bar{display:flex;align-items:center;gap:10px;padding:8px 22px;border-top:1px solid var(--border);background:var(--surface-2);}
.reply-bar-inner{flex:1;border-left:2px solid var(--teal);padding-left:8px;min-width:0;}
.reply-bar .rb-label{font-size:10.5px;color:var(--teal);font-weight:700;}
.reply-bar .rb-text{font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.reply-bar button{background:none;border:none;color:var(--text-faint);font-size:14px;flex-shrink:0;}
.reply-bar button:hover{color:var(--rust);}
.flash-highlight{animation:flash-bg 1.2s ease;}
@keyframes flash-bg{0%{background:var(--accent-soft);}100%{background:transparent;}}

/* ---- Menu contextuel (clic droit) ---- */
.ctx-menu{position:fixed;z-index:70;background:var(--surface);border:1px solid var(--border);border-radius:4px;box-shadow:0 8px 24px rgba(0,0,0,0.15);min-width:150px;overflow:hidden;}
.ctx-menu button{display:block;width:100%;text-align:left;background:none;border:none;padding:9px 14px;font-size:12.5px;color:var(--text);border-bottom:1px solid var(--border);}
.ctx-menu button:last-child{border-bottom:none;}
.ctx-menu button:hover{background:var(--accent-soft);}

/* ---- Glisser-déposer un fichier ---- */
.chat-col{position:relative;}
.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px;
  z-index: 30;

  background: rgba(169,116,38,0.10);
  border: 2px dashed var(--accent);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 15px;
  font-weight: 600;
  color: var(--accent);

  pointer-events: none;
}

/* ---- Présence en ligne ---- */
.av-wrap{position:relative;flex-shrink:0;}
.online-dot{position:absolute;bottom:-1px;right:-1px;width:9px;height:9px;border-radius:50%;background:#3d9a55;border:2px solid var(--surface);}

/* ---- En-tête de chat ---- */
.chat-head-left{display:flex;align-items:center;gap:10px;}
.chat-head-actions{display:flex;gap:6px;}

/* ---- Recherche dans une conversation ---- */
.search-bar{display:flex;gap:8px;padding:8px 22px;border-bottom:1px solid var(--border);background:var(--surface-2);align-items:center;}
.search-bar input{flex:1;}
.search-bar button{background:none;border:none;color:var(--text-faint);font-size:14px;}

/* ---- Pagination ---- */
.load-more-wrap{text-align:center;padding:8px;border-bottom:1px solid var(--border);}

/* ---- Messages chiffrés ---- */
.locked-msg{font-size:12.5px;color:var(--text-faint);}
.locked-msg button{background:none;border:none;color:var(--teal);text-decoration:underline;text-underline-offset:2px;font-size:12.5px;padding:0;}

/* ---- Vu / envoyé ---- */
.seen-indicator{color:var(--text-faint);}

/* ---- Réactions ---- */
.reactions-row{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px;}
.react-pill{background:var(--surface);border:1px solid var(--border);border-radius:10px;font-size:11px;padding:1px 7px;color:var(--text-muted);}
.react-pill.mine{border-color:var(--accent);color:var(--accent);background:var(--accent-soft);}
.ctx-react-row{display:flex;gap:2px;padding:6px 10px;border-bottom:1px solid var(--border);}
.ctx-react-row button{background:none;border:none;font-size:16px;padding:2px 4px;border-radius:3px;}
.ctx-react-row button:hover{background:var(--accent-soft);}
.date-sep{text-align:center;margin:14px 0 6px;position:relative;}
.date-sep span{background:var(--bg);padding:0 10px;font-size:10.5px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;text-transform:capitalize;position:relative;z-index:1;}
.date-sep::before{content:'';position:absolute;left:0;right:0;top:50%;height:1px;background:var(--border);}

.file-card{display:flex;align-items:center;gap:10px;min-width:180px;}
.file-card .ficon{width:32px;height:32px;border-radius:3px;background:var(--surface-3);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.file-card .fname{font-size:12.5px;font-weight:600;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.file-card .fsize{font-size:10.5px;color:var(--text-faint);}
.file-card a{color:var(--teal);text-decoration:underline;text-underline-offset:2px;}
.bubble img.fthumb{max-width:220px;max-height:220px;border-radius:4px;display:block;margin-bottom:4px;}

.typing-line{height:20px;padding:0 24px;font-size:11.5px;color:var(--text-faint);font-style:italic;}
.composer{padding:14px 22px;border-top:1px solid var(--border);display:flex;gap:10px;align-items:flex-end;}
.composer textarea{flex:1;min-height:40px;max-height:120px;resize:vertical;}
.attach-btn{background:none;border:1px solid var(--border);color:var(--text-muted);width:40px;height:40px;border-radius:2px;font-size:16px;flex-shrink:0;}
.attach-btn:hover{border-color:var(--accent);color:var(--accent);}

.empty{padding:40px 20px;text-align:center;color:var(--text-faint);font-size:13px;border:1px dashed var(--border);border-radius:4px;margin:20px;}
.empty .display{color:var(--text-muted);font-size:16px;margin-bottom:6px;}

@media (max-width:820px){
  .contacts-col{width:100%;position:absolute;inset:0;z-index:2;}
  .contacts-col.hide-mobile{display:none;}
  .chat-col{width:100%;}
}

html,
body {
  background: #fff !important;
  color: #222 !important;
}

.shell,
.view,
.rail,
.contacts-col,
.chat-col,
.folders-col,
.items-main,
.cal-main,
.agenda-side,
.auth-page,
.auth-card,
.modal,
.profile-section,
.admin-row {
  background: #fff !important;
}

.colhead,
.add-panel,
.items-head,
.search-bar,
.reply-bar,
.composer,
.cal-dow,
.item-card,
.rdv-item,
.contact-item:hover,
.folder-item:hover {
  background: #fff !important;
}

/* Inputs */
input,
textarea,
input[type="text"],
input[type="password"] {
  background: #fff !important;
}

/* Supprime les anciens gris/beiges */
:root {
  --bg: #fff;
  --surface: #fff;
  --surface-2: #fff;
  --surface-3: #f7f7f7;

  --border: #e5e5e5;
  --text: #222;
  --text-muted: #666;
  --text-faint: #999;

  --accent: #229ED9;
  --accent-soft: rgba(34,158,217,.12);

  --teal: #229ED9;
  --teal-soft: rgba(34,158,217,.10);
  --rust: #e35d6a;
}
.chat-col {
  position: relative;
  background: #fff !important;
}

.messages-scroll {
  background: #fff !important;
}

/* ===== OVERLAY DRAG & DROP ===== */

.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px; /* ne recouvre PAS le champ de saisie */

  z-index: 30;

  /* IMPORTANT : transparent */
  background: transparent !important;

  border: 2px dashed var(--accent);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 15px;
  font-weight: 600;
  color: var(--accent);

  pointer-events: none;
}


/* Recherche globale + éditeurs collaboratifs */
.global-search-results{max-height:320px;overflow:auto;background:var(--surface);border:1px solid var(--border);border-radius:3px;margin:6px 14px;box-shadow:0 8px 25px rgba(0,0,0,.15);z-index:20;position:relative}
.gs-title{font-size:10px;letter-spacing:.12em;color:var(--text-faint);padding:9px 11px;border-bottom:1px solid var(--border)}
.gs-row{display:flex;width:100%;gap:10px;align-items:center;text-align:left;background:transparent;border:0;border-bottom:1px solid var(--border);color:var(--text);padding:9px 11px;cursor:pointer}.gs-row:hover{background:var(--surface-2)}.gs-row span:last-child{min-width:0}.gs-row b,.gs-row small{display:block}.gs-row small{color:var(--text-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}.gs-empty{padding:14px;color:var(--text-faint);font-size:12px}
.rich-doc{line-height:1.6}.rich-doc a,.mtext a{color:var(--teal);text-decoration:underline}.editor-tools{display:flex;gap:5px;margin-bottom:7px}.editor-tools button{border:1px solid var(--border);background:var(--surface-2);color:var(--text);padding:5px 9px;border-radius:2px;cursor:pointer}.doc-editor{min-height:280px;max-height:55vh;overflow:auto;border:1px solid var(--border);background:var(--surface-2);padding:12px;line-height:1.6;outline:none}.sheet-wrap{overflow:auto;max-height:55vh;border:1px solid var(--border)}.sheet-table{border-collapse:collapse;min-width:700px;width:100%;background:var(--surface-2)}.sheet-table th,.sheet-table td{border:1px solid var(--border);min-width:78px;height:28px;padding:4px 6px;font-size:12px}.sheet-table th{background:var(--surface);color:var(--text-faint);font-weight:600;text-align:center}.sheet-table td:focus{outline:2px solid var(--teal);outline-offset:-2px}.sheet-table.preview{min-width:420px}.sheet-table.preview td{height:24px}.sheet-preview{overflow:auto;max-width:100%}

/* Editeurs enrichis */
.editor-tools,.sheet-toolbar{display:flex;gap:5px;align-items:center;flex-wrap:wrap;margin-bottom:8px;padding:6px;background:var(--surface);border:1px solid var(--border);border-radius:3px}
.editor-tools button,.sheet-toolbar button{border:1px solid var(--border);background:var(--surface-2);color:var(--text);padding:5px 9px;border-radius:2px;cursor:pointer;min-height:30px}
.editor-tools button:hover,.sheet-toolbar button:hover{background:var(--accent-soft)}
.editor-tools select{height:30px;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:2px;padding:0 7px}
.color-tool,.sheet-toolbar label{display:inline-flex;align-items:center;gap:4px;height:30px;padding:0 6px;border:1px solid var(--border);background:var(--surface-2);font-weight:700;cursor:pointer}
.color-tool input,.sheet-toolbar input[type=color]{width:24px;height:24px;padding:0;border:0;background:transparent;cursor:pointer}
.doc-editor{min-height:320px;max-height:55vh;overflow:auto;border:1px solid var(--border);background:var(--surface-2);padding:16px;line-height:1.65;outline:none;border-radius:2px}
.doc-editor:focus{box-shadow:0 0 0 2px var(--accent-soft)}
.doc-editor h1,.doc-editor h2,.doc-editor h3{margin:8px 0}.doc-editor blockquote{border-left:3px solid var(--accent);padding-left:12px;color:var(--text-muted)}
.sheet-table.editable td{cursor:text}.sheet-table.editable td:focus{outline:2px solid var(--teal);outline-offset:-2px}

/* Mode édition directe — style grand écran type Google Docs / Sheets */
.item-card.item-document,.item-card.item-sheet{padding:18px 20px;min-height:560px;background:var(--surface);}
.item-card.item-document .inline-title,.item-card.item-sheet .inline-title{font-size:20px;min-height:30px;padding:3px 5px;border:1px solid transparent;outline:none;flex:1;}
.item-card.item-document .inline-title:focus,.item-card.item-sheet .inline-title:focus{border-color:var(--border);background:var(--surface-2);}
.inline-editor-toolbar,.inline-sheet-toolbar{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:9px;background:var(--surface-2);border:1px solid var(--border);position:sticky;top:0;z-index:3;}
.inline-editor-toolbar button,.inline-sheet-toolbar button{min-width:34px;height:34px;border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:3px;cursor:pointer;font-size:13px;}
.inline-editor-toolbar button:hover,.inline-sheet-toolbar button:hover{background:var(--accent-soft);}
.inline-editor-toolbar select{height:34px;border:1px solid var(--border);background:var(--surface);color:var(--text);padding:0 8px;}
.inline-editor-toolbar label,.inline-sheet-toolbar label{height:34px;display:flex;align-items:center;gap:5px;padding:0 7px;border:1px solid var(--border);background:var(--surface);font-weight:700;}
.inline-editor-toolbar input[type=color],.inline-sheet-toolbar input[type=color]{width:28px;height:28px;padding:0;border:0;cursor:pointer;background:transparent;}
.inline-doc{min-height:480px;margin-top:10px;padding:28px 34px;background:var(--surface);border:1px solid var(--border);outline:none;font-size:16px;line-height:1.75;box-shadow:0 1px 2px rgba(0,0,0,.05);}
.inline-doc:focus{box-shadow:0 0 0 2px var(--accent-soft);}
.inline-doc h1{font-size:30px}.inline-doc h2{font-size:24px}.inline-doc h3{font-size:20px}
.inline-sheet-wrap{overflow:auto;max-height:calc(100vh - 210px);min-height:calc(100vh - 300px);margin-top:10px;border:1px solid var(--border);background:var(--surface);}
.inline-sheet{min-width:1100px;width:max-content;background:var(--surface);}
.inline-sheet th,.inline-sheet td{min-width:110px;height:38px;padding:7px 9px;font-size:13px;}
.inline-sheet th{position:sticky;top:0;background:var(--surface-2);z-index:2;}
.inline-sheet tbody th{left:0;position:sticky;z-index:1;min-width:46px;width:46px;}
.inline-sheet td:focus{outline:2px solid var(--teal);outline-offset:-2px;}
.inline-note{width:100%;min-height:180px;padding:14px;border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;resize:vertical;outline:none;}
.inline-note:focus{box-shadow:0 0 0 2px var(--accent-soft);}
.delete-inline{margin-left:12px;border:0;background:none;color:var(--text-faint);text-decoration:underline;cursor:pointer;font-size:10px;}
[data-save-status]{margin-left:8px;color:var(--teal);font-family:'IBM Plex Mono',monospace;font-size:10px;}
/* v8 spreadsheet enhancements */
.sheet-table th[data-col]{position:relative;cursor:col-resize;user-select:none;min-width:78px}
.sheet-table th[data-col]:hover{background:var(--accent-soft)}
.sheet-table tbody th[data-row]{cursor:pointer;user-select:none;position:sticky;left:0;z-index:2}
.sheet-table tr.row-selected td,.sheet-table tr.row-selected th[data-row]{box-shadow:inset 0 0 0 9999px rgba(0,0,0,.04)}
.sheet-table td.cell-active{outline:2px solid var(--teal)!important;outline-offset:-2px}
.sheet-table td{vertical-align:middle;white-space:normal;overflow:hidden;word-break:break-word}
.sheet-table td[contenteditable="true"]{min-height:28px}
.inline-sheet-wrap,.sheet-wrap{width:100%;overflow:auto}
.item-sheet{width:100%}

/* v9 - colonne redimensionnables fiables, style Google Sheets */
.sheet-table th[data-col]{position:relative;cursor:default;}
.sheet-table th[data-col] .sheet-resize-handle{position:absolute;top:0;right:-3px;width:8px;height:100%;cursor:col-resize;z-index:10;touch-action:none;}
.sheet-table th[data-col] .sheet-resize-handle::after{content:"";position:absolute;top:25%;bottom:25%;left:3px;width:2px;background:transparent;}
.sheet-table th[data-col]:hover .sheet-resize-handle::after,.sheet-table th[data-col] .sheet-resize-handle:hover::after{background:var(--accent);}
.sheet-table th[data-col] .sheet-resize-handle:active::after{background:var(--teal);}
/* v10 - collage multi-cellules depuis le presse-papiers */
.sheet-resize-handle{position:absolute;right:-4px;top:0;width:9px;height:100%;cursor:col-resize;z-index:5}
.sheet-resize-handle:hover{background:var(--accent-soft)}
.sheet-table tr.row-selected td{outline:1px solid var(--accent-soft)}
.sheet-table th[data-col].col-selected{background:var(--accent-soft)}

/* v11 - upload sans saut de page */
#folderFileInput{position:fixed!important;left:-10000px!important;top:0!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;}
#addFileBtn:disabled{opacity:.65;cursor:wait;}

/* v12 - tableur grand écran, redimensionnement libre et liens cliquables */
.sheet-fullscreen{width:calc(100vw - 24px)!important;max-width:none!important;height:calc(100vh - 24px)!important;max-height:none!important;padding:18px!important;overflow:hidden!important;}
.sheet-fullscreen #sheetEditor{height:calc(100vh - 150px);display:flex;flex-direction:column;min-height:0;}
.sheet-fullscreen .sheet-toolbar{flex:0 0 auto;position:sticky;top:0;z-index:20;}
.sheet-fullscreen .sheet-wrap{flex:1 1 auto;min-height:0;max-height:none;height:100%;overflow:auto;overscroll-behavior:contain;}
.sheet-table.editable{table-layout:fixed;min-width:900px;width:max-content;}
.sheet-table.editable th[data-col],.sheet-table.editable td{min-width:24px;}
.sheet-table.editable td{max-width:none;overflow:hidden;text-overflow:clip;word-break:break-word;}
.sheet-table.editable td[contenteditable="true"]{white-space:normal;}
.sheet-table.editable td a.sheet-link,.inline-sheet td a.sheet-link{color:var(--teal);text-decoration:underline;cursor:pointer;position:relative;z-index:4;}
.sheet-resize-handle{right:-5px!important;width:11px!important;z-index:30!important;}
.sheet-resize-handle:hover{background:var(--accent-soft);}
body.sheet-resizing,body.sheet-resizing *{user-select:none!important;cursor:col-resize!important;}
.sheet-wrap,.inline-sheet-wrap{scrollbar-width:auto;}

/* v13 - tableur : liens visibles immédiatement + défilement horizontal toujours accessible */
.sheet-wrap,.inline-sheet-wrap{
  overflow-x:auto!important;
  overflow-y:auto!important;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.sheet-wrap::-webkit-scrollbar,.inline-sheet-wrap::-webkit-scrollbar{height:20px;width:16px;}
.sheet-wrap::-webkit-scrollbar-thumb,.inline-sheet-wrap::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:7px;border:3px solid transparent;background-clip:padding-box;}
.sheet-wrap::-webkit-scrollbar-track,.inline-sheet-wrap::-webkit-scrollbar-track{background:var(--surface-2);}
.sheet-table.editable{width:max-content!important;min-width:1200px!important;table-layout:fixed!important;}
.sheet-table.editable th[data-col],.sheet-table.editable td{min-width:24px!important;}
.sheet-table.editable td{white-space:normal!important;overflow:hidden!important;word-break:break-word!important;overflow-wrap:anywhere!important;}
.sheet-table.editable th[data-col] .sheet-resize-handle{right:-7px!important;width:15px!important;cursor:col-resize!important;}
.sheet-table.editable th[data-col]{padding-right:10px;}
.sheet-table.editable td a.sheet-link,.inline-sheet td a.sheet-link{pointer-events:auto!important;}

/* v14 - tableur : vrai grand espace de travail, défilement horizontal et redimensionnement fiables */
.sheet-fullscreen .sheet-wrap {
  width:100% !important;
  max-width:none !important;
  overflow-x:scroll !important;
  overflow-y:auto !important;
  scrollbar-gutter:stable both-edges;
}
.sheet-fullscreen .sheet-table.editable {
  width:max-content !important;
  min-width:1600px !important;
  table-layout:fixed !important;
}
.inline-sheet-wrap {
  width:100% !important;
  overflow-x:scroll !important;
  overflow-y:auto !important;
  scrollbar-gutter:stable;
}
.inline-sheet {
  width:max-content !important;
  min-width:2600px !important;
  table-layout:fixed !important;
}
.sheet-table th[data-col] { overflow:visible !important; }
.sheet-table th[data-col] .sheet-resize-handle {
  right:-8px !important; width:17px !important; min-width:17px !important;
  top:0 !important; bottom:0 !important; height:100% !important;
  display:block !important; cursor:col-resize !important; z-index:100 !important;
}
.sheet-table th[data-col] .sheet-resize-handle::after {
  left:7px !important; width:3px !important; top:18% !important; bottom:18% !important;
}
.sheet-table th[data-col]:hover .sheet-resize-handle::after,
.sheet-table th[data-col] .sheet-resize-handle:hover::after,
.sheet-table th[data-col] .sheet-resize-handle:active::after {
  background:var(--accent) !important;
}
.sheet-table td {
  overflow:hidden !important; text-overflow:clip !important; overflow-wrap:anywhere !important; word-break:break-word !important;
}
.sheet-table td a.sheet-link, .inline-sheet td a.sheet-link {
  pointer-events:auto !important; cursor:pointer !important; position:relative !important; z-index:999 !important;
}

/* v15 - grand tableur + recherche par mot-clé + liens vraiment cliquables */
.item-card.item-sheet{width:100%;min-height:calc(100vh - 190px);padding:12px 14px;}
.item-card.item-sheet .inline-sheet-wrap{max-height:calc(100vh - 235px);min-height:calc(100vh - 300px);overflow-x:scroll!important;overflow-y:scroll!important;}
.item-card.item-sheet .inline-sheet{min-width:2600px!important;}
.sheet-fullscreen .sheet-table.editable{min-width:2600px!important;}
.sheet-fullscreen .sheet-wrap{overflow-x:scroll!important;overflow-y:scroll!important;}
.sheet-link{pointer-events:auto!important;user-select:text!important;}

/* v16 - feuille de calcul en plein écran façon Google Sheets */
.item-card.item-sheet{
  margin:-20px -24px !important;
  width:calc(100% + 48px) !important;
  min-height:calc(100vh - 120px) !important;
  padding:8px !important;
  border:0 !important;
  border-radius:0 !important;
}
.item-card.item-sheet .inline-sheet-toolbar{
  position:sticky !important;
  top:0 !important;
  z-index:50 !important;
}
.item-card.item-sheet .inline-sheet-wrap{
  height:calc(100vh - 175px) !important;
  min-height:0 !important;
  max-height:none !important;
  width:100% !important;
  overflow-x:scroll !important;
  overflow-y:scroll !important;
  border-left:0 !important;
  border-right:0 !important;
}
.item-card.item-sheet .inline-sheet{
  min-width:3200px !important;
  width:max-content !important;
}
/* Colonne des numéros de lignes : la plus étroite possible */
.sheet-table tbody th[data-row],
.inline-sheet tbody th[data-row]{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  padding:2px 3px !important;
  font-size:11px !important;
  text-align:center !important;
}
.sheet-table thead th:first-child,
.inline-sheet thead th:first-child{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  padding:2px !important;
}
.sheet-table th[data-col],
.inline-sheet th[data-col]{min-width:70px !important;}
.sheet-table td,.inline-sheet td{min-width:70px !important;}
/* Lien : aucun élément de la feuille ne doit intercepter le clic */
.sheet-table td a.sheet-link,.inline-sheet td a.sheet-link{
  pointer-events:auto !important;
  position:relative !important;
  z-index:1000 !important;
  cursor:pointer !important;
}

/* v17 - liens réellement cliquables dans les cellules contenteditable */
.sheet-table td a.sheet-link,
.inline-sheet td a.sheet-link{
  display:inline !important;
  pointer-events:auto !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  cursor:pointer !important;
  color:#06c !important;
  text-decoration:underline !important;
  position:relative !important;
  z-index:2147483647 !important;
}
.sheet-table td a.sheet-link:hover,
.inline-sheet td a.sheet-link:hover{ text-decoration:underline !important; }

/* v17 - zone tableur vraiment plein écran */
.item-card.item-sheet{
  position:relative !important;
  min-height:calc(100vh - 90px) !important;
}
.item-card.item-sheet .inline-sheet-wrap{
  height:calc(100vh - 145px) !important;
  min-height:500px !important;
  max-height:none !important;
  overflow-x:scroll !important;
  overflow-y:scroll !important;
}
.item-card.item-sheet .inline-sheet{
  min-width:3600px !important;
}
/* numéros de lignes ultra-compacts */
.inline-sheet tbody th[data-row],
.sheet-table tbody th[data-row]{
  width:24px !important;
  min-width:24px !important;
  max-width:24px !important;
  padding:1px 2px !important;
}
.inline-sheet thead th:first-child,
.sheet-table thead th:first-child{
  width:24px !important;
  min-width:24px !important;
  max-width:24px !important;
}

/* v19 - tableur : plein écran réel + grille manipulable */
.sheet-fullscreen{left:0!important;top:0!important;transform:none!important;width:100vw!important;height:100vh!important;max-width:none!important;max-height:none!important;border-radius:0!important;padding:8px!important;}
.sheet-fullscreen #sheetEditor{height:calc(100vh - 92px)!important;}
.sheet-fullscreen .sheet-wrap{height:100%!important;width:100%!important;overflow:scroll!important;border:1px solid var(--border)!important;}
.sheet-fullscreen .sheet-table.editable{min-width:3000px!important;width:max-content!important;table-layout:fixed!important;}
.sheet-fullscreen .sheet-table.editable th[data-col],.sheet-fullscreen .sheet-table.editable td{min-width:24px!important;width:auto;}
.sheet-fullscreen .sheet-table.editable thead th:first-child,.sheet-fullscreen .sheet-table.editable tbody th[data-row]{width:20px!important;min-width:20px!important;max-width:20px!important;padding:0!important;}
.sheet-fullscreen .sheet-table.editable tbody th[data-row]{font-size:10px!important;}
.sheet-fullscreen .sheet-table.editable td{height:30px!important;padding:3px 5px!important;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar{width:18px;height:18px;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar-thumb{background:#888;border-radius:8px;border:3px solid #eee;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar-track{background:#eee;}
.sheet-table.editable td.cell-active{outline:2px solid var(--teal)!important;outline-offset:-2px!important;}

/* v20 - réouverture du tableur en plein écran */
.item-card.item-sheet{cursor:pointer;}
.item-card.item-sheet td,.item-card.item-sheet [contenteditable="true"],.item-card.item-sheet button,.item-card.item-sheet input,.item-card.item-sheet a{cursor:auto;}
.item-card.item-sheet .itag.sheet{cursor:pointer;}
.modal-back.active .modal.sheet-fullscreen{position:fixed!important;left:0!important;top:0!important;transform:none!important;width:100vw!important;height:100vh!important;max-width:none!important;max-height:none!important;box-sizing:border-box!important;border-radius:0!important;margin:0!important;}

/* v21 - redimensionnement fiable des cellules */
body.sheet-resizing, body.sheet-resizing * { cursor: col-resize !important; user-select:none !important; }
.sheet-fullscreen .sheet-wrap { position:relative; }
.sheet-fullscreen .sheet-table.editable { table-layout:fixed !important; border-collapse:separate !important; border-spacing:0 !important; }
.sheet-fullscreen .sheet-table.editable th[data-col],
.sheet-fullscreen .sheet-table.editable td { box-sizing:border-box !important; }
.sheet-fullscreen .sheet-table.editable th[data-col] { min-width:24px !important; width:auto; }
.sheet-fullscreen .sheet-table.editable td { min-width:24px !important; width:auto; }
.sheet-fullscreen .sheet-table.editable th[data-col] .sheet-resize-handle { right:-9px !important; width:19px !important; }

/* Prévisualisation des fichiers envoyés dans les conversations */
.file-preview-btn{display:block;padding:0;border:0;background:transparent;cursor:pointer;max-width:100%;}
.file-preview-btn .fthumb{display:block;}
.file-card-clickable{cursor:pointer;}
.file-card-clickable:hover{filter:brightness(.98);}
.linklike{border:0;background:none;padding:0;margin:0;font:inherit;color:var(--accent,#2563eb);cursor:pointer;text-decoration:underline;}
.file-preview-modal{width:min(1100px,96vw)!important;height:min(850px,94vh);max-height:94vh;display:flex;flex-direction:column;}
.file-preview-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;border-bottom:1px solid var(--line,#ddd);flex:0 0 auto;}
.file-preview-frame{width:100%;height:100%;border:0;background:#fff;flex:1;min-height:0;}
.file-preview-media{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;padding:14px;overflow:auto;}
.file-preview-media img{max-width:100%;max-height:100%;object-fit:contain;}
.file-preview-media video{max-width:100%;max-height:100%;}
.file-preview-audio{padding:50px 20px;display:flex;justify-content:center;}
.file-preview-text{flex:1;min-height:0;overflow:auto;margin:0;padding:20px;white-space:pre-wrap;word-break:break-word;font:13px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;background:var(--panel,#fafafa);}
.file-preview-unsupported{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px;}

/* v24 - colonne des numéros ultra-fine en plein écran */
.sheet-fullscreen .sheet-table.editable thead th:first-child,
.sheet-fullscreen .sheet-table.editable tbody th[data-row],
.sheet-fullscreen .sheet-table.editable tr > th:first-child {
  width: 14px !important;
  min-width: 14px !important;
  max-width: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  font-size: 8px !important;
  line-height: 1 !important;
  text-align: center !important;
}
.sheet-fullscreen .sheet-table.editable tr > th:first-child {
  overflow: hidden !important;
}
.sheet-fullscreen .sheet-table.editable thead th:first-child .sheet-resize-handle {
  display: none !important;
}

/* v25 - sélection de cellules type tableur + barres de défilement toujours accessibles */
.sheet-fullscreen{box-sizing:border-box!important;}
.sheet-fullscreen .sheet-wrap{
  overflow-x:scroll!important;
  overflow-y:scroll!important;
  scrollbar-width:auto!important;
  scrollbar-color:var(--surface-3) var(--surface-2)!important;
  scrollbar-gutter:stable both-edges!important;
}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar{width:18px!important;height:18px!important;display:block!important;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar-track{background:var(--surface-2)!important;border:1px solid var(--border)!important;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar-thumb{background:var(--surface-3)!important;border:3px solid var(--surface-2)!important;border-radius:6px!important;}
.sheet-fullscreen .sheet-wrap::-webkit-scrollbar-thumb:hover{background:var(--text-faint)!important;}
.sheet-fullscreen .sheet-table.editable th:first-child,
.sheet-fullscreen .sheet-table.editable tbody th[data-row]{
  width:18px!important;min-width:18px!important;max-width:18px!important;padding:0!important;font-size:9px!important;
}
.sheet-table.editable td.cell-selected{box-shadow:inset 0 0 0 9999px rgba(61,122,112,.12)!important;}
.sheet-table.editable td.cell-selected.cell-active{outline:2px solid var(--teal)!important;}
.sheet-table.editable td.cell-selecting{cursor:crosshair!important;}
.sheet-selection-info{margin-left:8px;font-size:10px;color:var(--text-faint);font-family:'IBM Plex Mono',monospace;}

/* v27 — interface plus douce, arrondie, esprit messagerie moderne */
.rail{border-right:0;margin:10px 0 10px 10px;border-radius:18px;box-shadow:0 4px 18px rgba(0,0,0,.05);padding-top:14px;padding-bottom:14px;}
.rail-btn{border-radius:14px;width:68px;}
.rail-btn.active::before{left:-6px;border-radius:3px;}
.contacts-col,.folders-col{margin:10px 0;border:1px solid var(--border);border-radius:18px;overflow:hidden;box-shadow:0 4px 18px rgba(0,0,0,.04);}
.contact-item,.folder-item{margin:4px 7px;border-radius:12px;border-bottom:0;}
.contact-item.active{border-radius:12px;}
.view{padding-right:10px;}
.colhead{border-radius:18px 18px 0 0;}
.item-card{border-radius:16px!important;box-shadow:0 4px 18px rgba(0,0,0,.05);margin-bottom:12px;}
.btn{border-radius:10px;}
.btn.small{border-radius:9px;}
input[type=text],input[type=password],textarea{border-radius:10px;}
.inline-editor-toolbar,.inline-sheet-toolbar{border-radius:12px;}
.inline-editor-toolbar button,.inline-sheet-toolbar button{border-radius:9px;}
.sheet-fullscreen{border-radius:16px!important;}
.sheet-fullscreen .sheet-toolbar{border-radius:12px;}
.sheet-fullscreen .sheet-wrap{border-radius:12px;}
.sheet-table th,.sheet-table td{border-radius:2px;}
#sheetUndo:disabled,#sheetRedo:disabled{opacity:.4;cursor:not-allowed;}
.sheet-selection-info{padding:6px 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);font-size:11px;}

/* v28 — commande de suppression de ligne toujours visible */
.sheet-actionbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:7px 10px;margin:4px 0 8px;border:1px solid var(--border);border-radius:12px;background:var(--surface-2);position:sticky;top:0;z-index:20;}
.sheet-danger-action{border:1px solid rgba(190,60,60,.35)!important;color:var(--rust,#b83b3b)!important;background:rgba(190,60,60,.08)!important;font-weight:600!important;}
.sheet-danger-action:hover{background:rgba(190,60,60,.15)!important;}
.sheet-action-help{font-size:11px;color:var(--text-faint);}
.sheet-fullscreen .sheet-toolbar{display:flex;flex-wrap:wrap;gap:5px;overflow:visible!important;}
.sheet-fullscreen .sheet-toolbar button,.sheet-fullscreen .sheet-toolbar label{flex:0 0 auto;}


/* v29 — bouton de sortie du tableur toujours visible */
.sheet-footer-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.sheet-fullscreen .sheet-footer-actions{position:sticky;bottom:0;z-index:30;background:var(--surface);border-top:1px solid var(--border);padding:6px 0 2px;}

/* Recherche globale dans l'agenda */
.agenda-search{margin-bottom:10px;border:1px solid var(--border);border-radius:10px;padding:7px 10px;}
.agenda-search input{background:transparent;border:0;outline:none;min-width:0;}
#agendaSearchResults{margin:0 0 12px 0;max-height:260px;}
.agenda-search .search-clear{cursor:pointer;}

/* Telegram-inspired blue theme */
.rail,.contacts-col,.folders-col{background:#f4f8fb;}
.rail-btn.active{background:rgba(34,158,217,.12);color:var(--accent);}
.contact-item.active,.folder-item.active{background:rgba(34,158,217,.13);}
.contact-item:hover,.folder-item:hover,.cal-cell:hover{background:#eef7fc;}
.btn{box-shadow:0 2px 7px rgba(34,158,217,.16);}
.cal-nav button:hover{border-color:var(--accent);color:var(--accent);}
.rdv-item{border-left-color:var(--accent);}


/* v41 — vrai thème bleu Telegram, prioritaire sur les anciens styles */
:root{
  --bg:#eef4f8 !important;
  --surface:#ffffff !important;
  --surface-2:#f7fbfe !important;
  --surface-3:#e8f2f8 !important;
  --border:#d5e4ee !important;
  --text:#17212b !important;
  --text-muted:#61727f !important;
  --text-faint:#8a9aa6 !important;
  --accent:#229ED9 !important;
  --accent-soft:rgba(34,158,217,.14) !important;
  --teal:#229ED9 !important;
  --teal-soft:rgba(34,158,217,.10) !important;
}
body{background:var(--bg)!important;}
.rail{background:#e7f3fa!important;border:1px solid #cfe4f0!important;border-radius:20px!important;}
.contacts-col,.folders-col{background:#fff!important;border:1px solid #d5e4ee!important;border-radius:20px!important;}
.contact-item,.folder-item{border-radius:14px!important;}
.contact-item.active,.folder-item.active,.rail-btn.active{background:rgba(34,158,217,.16)!important;color:#1687bd!important;}
.rail-btn{border-radius:14px!important;}
.btn{background:#229ED9!important;border-radius:11px!important;box-shadow:0 3px 10px rgba(34,158,217,.22)!important;}
.btn.ghost{background:#fff!important;border-color:#cfe0ea!important;color:#4d6675!important;}
.btn.ghost:hover{background:#eef8fd!important;border-color:#229ED9!important;color:#1687bd!important;}
input[type=text],input[type=password],textarea,select{border-radius:11px!important;border-color:#d2e2ec!important;}
input:focus,textarea:focus,select:focus{border-color:#229ED9!important;box-shadow:0 0 0 2px rgba(34,158,217,.12)!important;}
.colhead{background:#fff!important;border-radius:20px 20px 0 0!important;}
.item-card{background:#fff!important;border:1px solid #d5e4ee!important;border-radius:16px!important;box-shadow:0 5px 18px rgba(27,91,120,.07)!important;}
.bubble-row.me .bubble{background:#dff3ff!important;border-color:#b8e2f7!important;}
.bubble{border-radius:14px!important;}
.attach-btn{border-radius:11px!important;background:#fff!important;}
.cal-nav button{border-radius:9px!important;background:#fff!important;}
.cal-cell.selected{background:rgba(34,158,217,.10)!important;}
.rdv-item{border-left:3px solid #229ED9!important;border-radius:12px!important;background:#f8fcff!important;}
.modal{border-radius:16px!important;box-shadow:0 12px 35px rgba(30,80,105,.16)!important;}
.editor-tools,.sheet-toolbar,.inline-editor-toolbar,.inline-sheet-toolbar{border-radius:12px!important;background:#f7fbfe!important;}
.editor-tools button,.sheet-toolbar button,.inline-editor-toolbar button,.inline-sheet-toolbar button{border-radius:9px!important;}
.global-search-results,#agendaSearchResults{border-radius:12px!important;box-shadow:0 8px 25px rgba(30,80,105,.14)!important;}
.file-card{border-radius:13px!important;}
.toast{border-radius:13px!important;border-left-color:#229ED9!important;}

/* v42 — arrière-plan de conversation style Telegram + texte plus lisible */
.chat-col{background:#e9f3f8!important;}
.messages-scroll{
  background-color:#e9f3f8!important;
  background-image:
    radial-gradient(circle at 15px 15px, rgba(34,158,217,.055) 1.2px, transparent 1.4px),
    radial-gradient(circle at 45px 35px, rgba(34,158,217,.04) 1px, transparent 1.2px);
  background-size:60px 60px,60px 60px;
  padding:24px 28px!important;
  gap:8px!important;
}
.bubble-row{width:100%;}
.bubble{
  max-width:min(72%,760px)!important;
  padding:10px 13px 8px!important;
  border-radius:15px!important;
  font-size:14.5px!important;
  line-height:1.55!important;
  font-weight:450!important;
  color:#17212b!important;
  letter-spacing:.05px;
  box-shadow:0 1px 2px rgba(28,67,88,.08)!important;
}
.bubble-row.them .bubble{
  background:#fff!important;
  border:1px solid rgba(195,216,227,.75)!important;
  border-bottom-left-radius:5px!important;
}
.bubble-row.me .bubble{
  background:#d9f2ff!important;
  border:1px solid #b5e0f5!important;
  border-bottom-right-radius:5px!important;
}
.bubble .meta{
  font-size:10px!important;
  line-height:1.2!important;
  margin-top:5px!important;
  color:#718692!important;
}
.bubble .edited-tag{color:#718692!important;}
.bubble a{color:#1687bd!important;font-weight:500!important;text-decoration:underline!important;text-decoration-thickness:1px;}
.bubble-row.me .bubble a{color:#0879ad!important;}
.bubble img.fthumb{border-radius:10px!important;}
.chat-head{background:#fff!important;}
.chat-col .message-form,.chat-col form{background:#e9f3f8;}

/* v43 — véritable fond doodle inspiré de Telegram, visible mais discret */
.messages-scroll{
  position:relative!important;
  isolation:isolate!important;
  background-color:#dfeef5!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' viewBox='0 0 360 360'%3E%3Cg fill='none' stroke='%23229ed9' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' opacity='.105'%3E%3Cpath d='M38 54l18-7-7 18-4-8-7-3z'/%3E%3Cpath d='M104 25c6-9 20-5 20 5 0 10-20 20-20 20S84 40 84 30c0-10 14-14 20-5z'/%3E%3Cpath d='M184 48c8-5 18-1 18 8 0 10-18 16-18 16s-18-6-18-16c0-9 10-13 18-8z'/%3E%3Cpath d='M282 34l8 16 18 3-13 12 3 18-16-8-16 8 3-18-13-12 18-3z'/%3E%3Cpath d='M45 155c0-9 7-16 16-16h27c9 0 16 7 16 16v15c0 9-7 16-16 16H70l-10 9 2-9h-1c-9 0-16-7-16-16z'/%3E%3Cpath d='M181 135c7 0 13 6 13 13v18c0 7-6 13-13 13h-9l-8 8 2-8h-1c-7 0-13-6-13-13v-18c0-7 6-13 13-13z'/%3E%3Cpath d='M288 150l16-7-6 17-5-6-5-4z'/%3E%3Cpath d='M68 268c0-12 9-21 21-21h19c12 0 21 9 21 21s-9 21-21 21H89c-12 0-21-9-21-21z'/%3E%3Cpath d='M193 245l7 14 15 2-11 11 3 15-14-7-14 7 3-15-11-11 15-2z'/%3E%3Cpath d='M294 278c6-9 20-5 20 5 0 10-20 20-20 20s-20-10-20-20c0-10 14-14 20-5z'/%3E%3Cpath d='M20 325l17-7-6 17-4-6-7-4z'/%3E%3C/g%3E%3Cg fill='%23229ed9' opacity='.07'%3E%3Ccircle cx='145' cy='102' r='3'/%3E%3Ccircle cx='335' cy='112' r='2.5'/%3E%3Ccircle cx='42' cy='224' r='2.5'/%3E%3Ccircle cx='245' cy='320' r='3'/%3E%3C/g%3E%3C/svg%3E")!important;
  background-repeat:repeat!important;
  background-size:360px 360px!important;
}
.messages-scroll::before{content:none!important;}

/* v44 — fond vert clair type messagerie, avec motif doodle */
.messages-scroll,
.chat-col .messages-scroll{
  background-color:#dff3e7!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' viewBox='0 0 360 360'%3E%3Cg fill='none' stroke='%232b9b63' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' opacity='.13'%3E%3Cpath d='M38 54l18-7-7 18-4-8-7-3z'/%3E%3Cpath d='M104 25c6-9 20-5 20 5 0 10-20 20-20 20S84 40 84 30c0-10 14-14 20-5z'/%3E%3Cpath d='M184 48c8-5 18-1 18 8 0 10-18 16-18 16s-18-6-18-16c0-9 10-13 18-8z'/%3E%3Cpath d='M282 34l8 16 18 3-13 12 3 18-16-8-16 8 3-18-13-12 18-3z'/%3E%3Cpath d='M45 155c0-9 7-16 16-16h27c9 0 16 7 16 16v15c0 9-7 16-16 16H70l-10 9 2-9h-1c-9 0-16-7-16-16z'/%3E%3Cpath d='M181 135c7 0 13 6 13 13v18c0 7-6 13-13 13h-9l-8 8 2-8h-1c-7 0-13-6-13-13v-18c0-7 6-13 13-13z'/%3E%3Cpath d='M288 150l16-7-6 17-5-6-5-4z'/%3E%3Cpath d='M68 268c0-12 9-21 21-21h19c12 0 21 9 21 21s-9 21-21 21H89c-12 0-21-9-21-21z'/%3E%3Cpath d='M193 245l7 14 15 2-11 11 3 15-14-7-14 7 3-15-11-11 15-2z'/%3E%3Cpath d='M294 278c6-9 20-5 20 5 0 10-20 20-20 20s-20-10-20-20c0-10 14-14 20-5z'/%3E%3Cpath d='M20 325l17-7-6 17-4-6-7-4z'/%3E%3C/g%3E%3Cg fill='%232b9b63' opacity='.09'%3E%3Ccircle cx='145' cy='102' r='3'/%3E%3Ccircle cx='335' cy='112' r='2.5'/%3E%3Ccircle cx='42' cy='224' r='2.5'/%3E%3Ccircle cx='245' cy='320' r='3'/%3E%3C/g%3E%3C/svg%3E")!important;
  background-repeat:repeat!important;
  background-size:360px 360px!important;
}
.chat-col .message-form,.chat-col form{background:#dff3e7!important;}


/* v45 — recherche instantanée dans la conversation */
.chat-search-row{cursor:pointer!important;}
.chat-search-row:hover{background:rgba(42,151,214,.12)!important;}
.bubble-row.search-hit .bubble{box-shadow:0 0 0 3px rgba(42,151,214,.45),0 8px 24px rgba(42,151,214,.18)!important;transform:scale(1.01);transition:box-shadow .2s,transform .2s;}

/* v48 — tableur type Google Sheets : grille longue + barre horizontale toujours visible */
.sheet-fullscreen .sheet-wrap{
  flex:1 1 auto !important;
  min-height:0 !important;
  overflow-x:scroll !important;
  overflow-y:scroll !important;
}
.sheet-fullscreen .sheet-x-scroll{
  display:block !important;
  flex:0 0 18px !important;
  width:100% !important;
  height:18px !important;
  overflow-x:scroll !important;
  overflow-y:hidden !important;
  background:var(--surface-2) !important;
  border:1px solid var(--border) !important;
  border-radius:8px !important;
  scrollbar-width:auto !important;
}
.sheet-fullscreen .sheet-x-scroll > div{height:1px;min-width:3000px;}
.sheet-fullscreen .sheet-x-scroll::-webkit-scrollbar{height:16px !important;display:block !important;}
.sheet-fullscreen .sheet-x-scroll::-webkit-scrollbar-track{background:var(--surface-2) !important;}
.sheet-fullscreen .sheet-x-scroll::-webkit-scrollbar-thumb{background:var(--surface-3) !important;border:2px solid var(--surface-2) !important;border-radius:7px !important;}
.sheet-fullscreen .sheet-table.editable{min-width:3000px !important;width:max-content !important;}
.share-success{margin:8px 0;padding:10px 12px;border-radius:10px;border:1px solid rgba(40,150,80,.3);background:rgba(40,150,80,.1);color:#16733a;font-weight:600;font-size:12px;}
#shareBody #doShare:disabled{opacity:.7;cursor:default;}
/* v51 - liens du tableur vraiment cliquables malgré contenteditable */
.sheet-table.editable td a.sheet-link,
.inline-sheet td a.sheet-link{
  pointer-events:auto!important;
  cursor:pointer!important;
  user-select:text!important;
  -webkit-user-select:text!important;
  position:relative!important;
  z-index:9999!important;
}
.sheet-table.editable td a.sheet-link:hover,
.inline-sheet td a.sheet-link:hover{cursor:pointer!important;text-decoration:underline!important;}
.item-card.item-sheet td a.sheet-link{cursor:pointer!important;pointer-events:auto!important;}

/* v52 — recherche intégrée au tableur, progressive comme l'agenda */
.sheet-search-box{display:flex;align-items:center;gap:5px;min-width:300px;padding:3px 6px;border:1px solid var(--border);background:var(--surface-2);border-radius:8px;}
.sheet-search-box input{width:220px;min-width:160px;border:0;outline:0;background:transparent;color:var(--text);font-size:13px;padding:6px;}
.sheet-search-box button{min-width:28px!important;height:28px!important;padding:2px 6px!important;border-radius:6px!important;}
.sheet-search-count{font-size:11px;color:var(--text-faint);white-space:nowrap;min-width:42px;text-align:center;}
.sheet-table td.sheet-search-hit{box-shadow:inset 0 0 0 2px rgba(42,151,214,.35)!important;}
.sheet-table td.sheet-search-current{box-shadow:inset 0 0 0 3px var(--accent)!important;background:rgba(42,151,214,.12)!important;}
/* v52 — priorité absolue aux liens dans les cellules */
.sheet-table.editable td a.sheet-link,.inline-sheet td a.sheet-link{cursor:pointer!important;pointer-events:auto!important;-webkit-user-drag:none!important;position:relative!important;z-index:10000!important;}
/* v54 — recherche visible et liens réellement prioritaires dans le tableur */
.sheet-toolbar{position:sticky!important;top:0!important;z-index:200!important;display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:wrap!important;overflow:visible!important;}
.sheet-search-box{order:-1!important;flex:0 0 auto!important;display:flex!important;visibility:visible!important;opacity:1!important;z-index:500!important;background:#fff!important;border:2px solid var(--accent)!important;box-shadow:0 2px 8px rgba(0,0,0,.12)!important;}
.sheet-search-box input{display:block!important;visibility:visible!important;opacity:1!important;min-width:240px!important;width:280px!important;pointer-events:auto!important;}
.sheet-table.editable td a.sheet-link,.inline-sheet td a.sheet-link{display:inline!important;color:#1264d8!important;text-decoration:underline!important;cursor:pointer!important;pointer-events:auto!important;position:relative!important;z-index:999999!important;}
.sheet-table.editable td a.sheet-link:hover,.inline-sheet td a.sheet-link:hover{cursor:pointer!important;background:rgba(18,100,216,.08)!important;}
.sheet-table.editable td:has(a.sheet-link){cursor:default!important;}

/* v59 — stabilité du grand format du tableur : le contenu d'une cellule reste toujours dans sa cellule */
.sheet-fullscreen .sheet-table.editable{
  table-layout:fixed!important;
  width:max-content!important;
  min-width:1600px!important;
  border-collapse:collapse!important;
  border-spacing:0!important;
}
.sheet-fullscreen .sheet-table.editable th[data-col],
.sheet-fullscreen .sheet-table.editable td{
  box-sizing:border-box!important;
  min-width:90px!important;
  width:120px;
  max-width:none!important;
  vertical-align:top!important;
}
.sheet-fullscreen .sheet-table.editable td{
  height:30px!important;
  min-height:30px!important;
  padding:5px 7px!important;
  white-space:normal!important;
  overflow:hidden!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}
.sheet-fullscreen .sheet-table.editable td a.sheet-link{
  display:inline-block!important;
  max-width:100%!important;
  overflow-wrap:anywhere!important;
  word-break:break-all!important;
  white-space:normal!important;
  vertical-align:top!important;
  box-sizing:border-box!important;
}
.sheet-fullscreen .sheet-table.editable td *{max-width:100%!important;box-sizing:border-box!important;}
.sheet-fullscreen .sheet-table.editable tr{height:30px!important;}
.sheet-fullscreen .sheet-table.editable tbody th[data-row]{height:30px!important;vertical-align:top!important;}
/* Tableur moteur Excel libre (Jspreadsheet CE) */
.excel-grid{width:100%;height:calc(100vh - 220px);min-height:420px;overflow:hidden;background:#fff;border:1px solid var(--border);border-radius:12px}
.excel-grid .jexcel_container{height:100%!important;max-height:none!important}
.excel-grid .jexcel_content{height:100%!important;max-height:none!important;overflow:auto!important}
.excel-grid .jexcel{min-width:1200px;font-size:13px}
.excel-grid .jexcel td,.excel-grid .jexcel thead td{white-space:nowrap}
.excel-grid .excel-link-cell{color:#1683d8!important;text-decoration:underline!important;cursor:pointer!important}
.excel-grid .excel-link-cell::after{content:' 🔗';font-size:11px}
.sheet-excel-toolbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:8px 0;padding:8px;border:1px solid var(--border);border-radius:12px;background:var(--card)}
.sheet-excel-toolbar button{border:1px solid var(--border);background:var(--surface);border-radius:8px;padding:6px 9px;cursor:pointer}
.sheet-excel-toolbar .sheet-search-box{display:flex;align-items:center;gap:5px;margin-right:auto}
.sheet-excel-toolbar .sheet-search-box input{width:280px;padding:8px 10px;border:1px solid var(--border);border-radius:9px}
/* v64 — véritable interface tableur */
.sheet-excel-toolbar{background:#f8fafc!important;border:1px solid #cbd5e1!important;gap:4px!important;padding:6px!important;position:sticky;top:0;z-index:50}
.sheet-excel-toolbar button,.sheet-excel-toolbar select{height:32px!important;border:1px solid #cbd5e1!important;background:#fff!important;border-radius:5px!important;padding:4px 9px!important;font-size:13px!important}
.sheet-excel-toolbar button:hover{background:#e8f1ff!important;border-color:#94a3b8!important}
.sheet-excel-toolbar .sheet-sep{width:1px;height:24px;background:#cbd5e1;margin:0 4px}
.sheet-color{height:32px;min-width:32px;display:flex;align-items:center;justify-content:center;position:relative;background:#fff;border:1px solid #cbd5e1;border-radius:5px;font-weight:700;cursor:pointer}
.sheet-color input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.excel-grid{border-radius:4px!important;background:#fff!important}
.excel-grid .jexcel_container{border:1px solid #cbd5e1!important}
.excel-grid .jexcel_content{background:#fff!important}
.excel-grid .jexcel thead td{background:#f1f5f9!important;color:#334155!important;font-weight:600!important;border-color:#cbd5e1!important}
.excel-grid .jexcel tbody td{border-color:#e2e8f0!important;height:26px!important;padding:4px 6px!important}
.excel-grid .jexcel tbody tr:nth-child(even) td{background:#fcfdff}
.excel-grid .jexcel .highlight{background:#dbeafe!important}
.excel-grid .jexcel .selection{border:2px solid #2563eb!important}
.sheet-engine-error{padding:30px;text-align:center;color:#64748b;background:#f8fafc;border:1px solid #cbd5e1;border-radius:8px;margin:20px}

/* Menu clic droit du tableur */
.sheet-context-menu{position:fixed;z-index:100000;min-width:220px;padding:5px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 10px 28px rgba(15,23,42,.18)}
.sheet-context-menu button{display:block;width:100%;padding:8px 10px;border:0;background:transparent;text-align:left;border-radius:5px;cursor:pointer;font-size:13px;color:#1f2937}
.sheet-context-menu button:hover{background:#eef4ff}
.sheet-context-menu button.danger{color:#b42318}
.sheet-context-menu button.danger:hover{background:#fff1f0}
.sheet-context-sep{height:1px;background:#e2e8f0;margin:4px 0}
.excel-grid .jexcel tbody td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
\n\n/* v36 — Dossiers stable + tableur réellement intégré */\n#view-dossiers{flex-direction:row;min-width:0;}\n#view-dossiers .folders-col{width:var(--folders-width,240px);flex:0 0 var(--folders-width,240px);min-width:0;}\n#view-dossiers .items-main{flex:1 1 auto;min-width:0;}\n.folders-resizer{width:6px;flex:0 0 6px;cursor:col-resize;position:relative;z-index:5;}\n.folders-resizer::after{content:"";position:absolute;top:0;bottom:0;left:2px;width:2px;background:transparent;}\n.folders-resizer:hover::after,.folders-resizer.dragging::after{background:var(--accent);}\n#view-dossiers.folders-collapsed .folders-col{width:0!important;flex-basis:0!important;min-width:0!important;overflow:hidden!important;border:0!important;}\n#view-dossiers.folders-collapsed .folders-resizer{display:none!important;}\n#view-dossiers.folders-collapsed .folders-collapse-btn{position:fixed;left:10px;top:74px;z-index:100;}\n#view-dossiers.folders-collapsed .folders-head-row{display:none!important;}\n#view-dossiers.folders-collapsed .items-main{width:100%;}\n\n/* Le tableur reste dans sa carte à droite : aucune taille plein écran/modal. */\n.item-card.item-sheet{width:100%;max-width:none;box-sizing:border-box;}\n.item-card.item-sheet .inline-sheet-wrap{width:100%;max-width:100%;overflow:auto;}\n.item-card.item-sheet .inline-sheet{min-width:900px;width:max-content;}\n
/* Final: inline sheet stays in the normal page layout; explicit save control */
.inline-sheet-toolbar{position:relative;z-index:20;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.inline-sheet-toolbar [data-inline-sheet-save]{font-weight:700;cursor:pointer}
.folders-collapse-btn{cursor:pointer;min-width:34px;height:34px}
#view-dossiers.folders-collapsed .folders-col{display:none!important}
#view-dossiers.folders-collapsed .folders-resizer{display:none!important}
#view-dossiers.folders-collapsed .items-main{width:100%!important}

.inline-sheet a[href]{cursor:pointer!important;text-decoration:underline!important}
.inline-sheet a[href]:hover{opacity:.8}

/* Final range selection: no layout change, no widening of row-number column */
.inline-sheet .bureau-range-selected{
  box-shadow:inset 0 0 0 2px currentColor!important;
}
.inline-sheet td[data-r][data-c]{user-select:text}
.inline-sheet thead th:first-child,
.inline-sheet tbody th[data-row]{min-width:32px!important;width:32px!important;max-width:32px!important}

.inline-sheet td.bureau-range-selected{
  background-clip:padding-box!important;
  box-shadow:inset 0 0 0 2px currentColor!important;
}


/* Stable spreadsheet columns: natural initial width, persistent after resize */
.item-card.item-sheet .inline-sheet-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:auto!important;
}
.item-card.item-sheet .inline-sheet{
  table-layout:fixed!important;
  width:max-content!important;
  min-width:0!important;
}
.item-card.item-sheet .inline-sheet thead th:first-child,
.item-card.item-sheet .inline-sheet tbody th[data-row]{
  width:32px!important;
  min-width:32px!important;
  max-width:32px!important;
  padding-left:2px!important;
  padding-right:2px!important;
  box-sizing:border-box!important;
}
.item-card.item-sheet .inline-sheet td[data-r][data-c],
.item-card.item-sheet .inline-sheet th[data-col]{
  box-sizing:border-box!important;
}
.item-card.item-sheet .inline-sheet td[data-r][data-c]{
  white-space:normal!important;
  overflow:hidden!important;
  overflow-wrap:anywhere!important;
}

/* FINAL v2 — the row-number column is independent from spreadsheet column A */
.item-card.item-sheet .inline-sheet > thead > tr > th:first-child,
.item-card.item-sheet .inline-sheet > tbody > tr > th[data-row]{
  width:32px!important;
  min-width:32px!important;
  max-width:32px!important;
  box-sizing:border-box!important;
}
.item-card.item-sheet .inline-sheet > tbody > tr > td[data-c][data-c="0"]{
  /* Column A is the first editable TD; it must never resize the row-number TH. */
  min-width:70px!important;
}

/* v8 — progression réelle des uploads (conversation + dossiers) */
#bureauUploadProgress{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:100000;
  width:min(430px,calc(100vw - 32px));padding:14px 16px;
  background:var(--surface,#fff);border:1px solid var(--border,#d8dee8);
  border-radius:10px;box-shadow:0 10px 35px rgba(0,0,0,.18);
}
#bureauUploadProgress .bp-title{font-weight:700;font-size:13px;margin-bottom:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bureauUploadProgress .bp-track{height:9px;border-radius:999px;background:#e7ebf1;overflow:hidden}
#bureauUploadProgress .bp-bar{height:100%;width:0%;border-radius:999px;background:var(--accent,#2563eb);transition:width .12s linear}
#bureauUploadProgress .bp-text{text-align:right;margin-top:6px;font-size:12px;font-weight:700;color:var(--muted,#64748b)}

/* v8 — progression réelle des uploads */
#bureauUploadProgress{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:100000;width:min(430px,calc(100vw - 32px));padding:14px 16px;background:var(--surface,#fff);border:1px solid var(--border,#d8dee8);border-radius:10px;box-shadow:0 10px 35px rgba(0,0,0,.18)}
#bureauUploadProgress .bp-title{font-weight:700;font-size:13px;margin-bottom:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bureauUploadProgress .bp-track{height:9px;border-radius:999px;background:#e7ebf1;overflow:hidden}
#bureauUploadProgress .bp-bar{height:100%;width:0%;border-radius:999px;background:var(--accent,#2563eb);transition:width .12s linear}
#bureauUploadProgress .bp-text{text-align:right;margin-top:6px;font-size:12px;font-weight:700;color:var(--muted,#64748b)}

/* Correcteur d'orthographe + édition type messagerie */
.composer textarea[spellcheck="true"], .edit-box[spellcheck="true"]{
  -webkit-user-modify: read-write;
}
.edit-box{line-height:1.45;}
.edit-box:focus{outline:2px solid var(--accent);outline-offset:-2px;}


/* v14.4 — bouton pour descendre immédiatement en bas de la conversation */
.chat-col{position:relative!important;}
.chat-scroll-bottom{
  position:absolute!important;
  right:22px!important;
  bottom:86px!important;
  width:42px!important;
  height:42px!important;
  border:1px solid rgba(43,155,99,.28)!important;
  border-radius:50%!important;
  background:#ffffff!important;
  color:#2b9b63!important;
  font-size:24px!important;
  line-height:40px!important;
  padding:0!important;
  cursor:pointer!important;
  box-shadow:0 4px 14px rgba(30,80,55,.18)!important;
  z-index:30!important;
}
.chat-scroll-bottom:hover{transform:translateY(1px);background:#f4fff8!important;}
.search-cell-hit{
  outline:3px solid rgba(43,155,99,.45)!important;
  outline-offset:-3px!important;
  background:#fff8b8!important;
}
