/* En-tête applicatif — IHS-DENTAL */
.topbar.tb{
  --tb-accent:#168174;--tb-accent-soft:#e8f5f2;--tb-ink:#14232c;--tb-muted:#6b7b85;--tb-line:#e4eaee;--tb-hover:#f3f6f8;--tb-danger:#d92d20;
  position:sticky;top:0;z-index:40;height:68px;display:flex;align-items:center;gap:16px;padding:0 28px;
  background:rgba(255,255,255,.88);backdrop-filter:saturate(180%) blur(12px);-webkit-backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--tb-line)
}
.topbar.tb div{flex-direction:initial}
.topbar.tb svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* Titre + fil d'Ariane */
.topbar.tb .tb-title{display:flex;flex-direction:column;justify-content:center;min-width:0;flex:1}
.tb-crumbs{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--tb-muted);line-height:1.2;margin-bottom:3px}
.tb-crumbs svg{width:12px;height:12px;opacity:.6}
.tb-crumbs a{color:var(--tb-muted)}
.tb-crumbs a:hover{color:var(--tb-accent)}
.tb-title strong{font-size:16px;font-weight:700;letter-spacing:-.01em;color:var(--tb-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Actions */
.topbar.tb .tb-actions{display:flex;flex-direction:row;align-items:center;gap:8px;flex:none}
.tb-date{display:inline-flex;align-items:center;gap:8px;height:38px;padding:0 12px;border:1px solid var(--tb-line);border-radius:10px;font-size:13px;font-weight:500;color:var(--tb-muted);background:#fff;margin-right:4px;text-transform:capitalize}
.tb-date svg{width:16px;height:16px;color:var(--tb-accent)}
.tb-sep{width:1px;height:28px;background:var(--tb-line);margin:0 6px}

.tb-icon-btn{position:relative;width:40px;height:40px;display:grid;place-items:center;border:1px solid transparent;border-radius:11px;background:transparent;color:var(--tb-ink);cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.tb-icon-btn svg{width:21px;height:21px}
.tb-icon-btn:hover,.tb-icon-btn[aria-expanded=true]{background:var(--tb-hover);border-color:var(--tb-line)}
.tb-icon-btn:focus-visible,.tb-user:focus-visible{outline:2px solid var(--tb-accent);outline-offset:2px}
.topbar.tb .tb-menu{display:none;margin:0 0 0 -8px;font-size:0}

/* Cloche */
.tb-bell.has-unread svg{animation:tb-ring 1.6s ease 1 .6s;transform-origin:50% 10%}
.tb-badge{position:absolute;top:3px;right:2px;min-width:18px;height:18px;padding:0 5px;border-radius:99px;background:var(--tb-danger);color:#fff;font-size:10.5px;font-weight:700;line-height:18px;text-align:center;box-shadow:0 0 0 2px #fff;font-variant-numeric:tabular-nums}
@keyframes tb-ring{0%,100%{transform:rotate(0)}15%{transform:rotate(14deg)}30%{transform:rotate(-12deg)}45%{transform:rotate(8deg)}60%{transform:rotate(-5deg)}75%{transform:rotate(2deg)}}

/* Utilisateur */
.tb-user{display:flex;align-items:center;gap:10px;height:44px;padding:0 10px 0 4px;border:1px solid transparent;border-radius:12px;background:transparent;cursor:pointer;font:inherit;color:var(--tb-ink);transition:.15s}
.tb-user:hover,.tb-user[aria-expanded=true]{background:var(--tb-hover);border-color:var(--tb-line)}
.tb-avatar{flex:none;width:36px;height:36px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:700;letter-spacing:.02em;color:#fff;background:linear-gradient(135deg,#1f9a8a,#0c5260);box-shadow:0 0 0 2px #fff,0 0 0 3px #cfe6e2}
.tb-avatar.lg{width:42px;height:42px;font-size:14px}
.tb-user-text{display:flex;flex-direction:column;align-items:flex-start;line-height:1.25;text-align:left;max-width:180px}
.tb-user-text strong{font-size:13px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tb-user-text small{font-size:11.5px;color:var(--tb-muted)}
.tb-caret{width:14px;height:14px;color:var(--tb-muted);transition:transform .2s}
.tb-user[aria-expanded=true] .tb-caret{transform:rotate(180deg)}

/* Panneaux déroulants */
.topbar.tb .tb-dd{position:relative;display:block}
.tb-panel{position:absolute;right:0;top:calc(100% + 10px);z-index:50;background:#fff;border:1px solid var(--tb-line);border-radius:14px;box-shadow:0 18px 40px -12px rgba(20,35,44,.25),0 4px 10px rgba(20,35,44,.06);overflow:hidden;animation:tb-pop .16s ease-out}
.topbar.tb .tb-panel{display:block}
.topbar.tb .tb-panel[hidden]{display:none}
@keyframes tb-pop{from{opacity:0;transform:translateY(-6px) scale(.98)}to{opacity:1;transform:none}}
.topbar.tb .tb-panel-head{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--tb-line)}
.tb-panel-head strong{font-size:14px;color:var(--tb-ink)}
.tb-chip{font-size:11.5px;font-weight:600;color:var(--tb-accent);background:var(--tb-accent-soft);padding:3px 9px;border-radius:99px}
.tb-panel-foot{display:block;text-align:center;padding:12px;font-size:13px;font-weight:600;color:var(--tb-accent);border-top:1px solid var(--tb-line);background:#fafcfc}
.tb-panel-foot:hover{background:var(--tb-accent-soft)}

/* Notifications */
.tb-notif{width:380px}
.tb-notif-list{list-style:none;margin:0;padding:6px;max-height:360px;overflow-y:auto}
.tb-notif-list li{display:flex;align-items:flex-start;gap:12px;padding:10px;border-radius:10px;position:relative}
.tb-notif-list li:hover{background:var(--tb-hover)}
.tb-notif-list li.unread{background:#f5fbfa}
.tb-notif-list li.unread:hover{background:var(--tb-accent-soft)}
.tb-notif-icon{flex:none;width:34px;height:34px;border-radius:10px;display:grid;place-items:center}
.tb-notif-icon svg{width:17px;height:17px}
.tb-notif-icon.rdv{background:#eaf0fb;color:#3b5bab}
.tb-notif-icon.patient{background:var(--tb-accent-soft);color:var(--tb-accent)}
.topbar.tb .tb-notif-list li>div{display:block;flex:1;min-width:0}
.tb-notif-list p{margin:0;font-size:13px;line-height:1.4;color:var(--tb-ink)}
.tb-notif-list li.unread p{font-weight:600}
.tb-notif-list small{display:block;margin-top:3px;font-size:11.5px;color:var(--tb-muted)}
.tb-notif-list form{margin:0;flex:none}
.tb-notif-list form button{width:24px;height:24px;display:grid;place-items:center;border:0;border-radius:50%;background:transparent;cursor:pointer}
.tb-notif-list form button i{width:9px;height:9px;border-radius:50%;background:var(--tb-accent);box-shadow:0 0 0 3px rgba(22,129,116,.15)}
.tb-notif-list form button:hover{background:#fff}
.tb-notif-list form button:hover i{background:transparent;border:2px solid var(--tb-accent);width:11px;height:11px}
.topbar.tb .tb-empty{display:flex;flex-direction:column;align-items:center;gap:4px;padding:30px 20px;text-align:center}
.tb-empty svg{width:34px;height:34px;color:#b6c4ca;margin-bottom:6px}
.tb-empty strong{font-size:14px;color:var(--tb-ink)}
.tb-empty small{font-size:12.5px;color:var(--tb-muted)}

/* Menu utilisateur */
.tb-user-menu{width:260px;padding:6px}
.topbar.tb .tb-user-head{display:flex;flex-direction:row;align-items:center;gap:12px;padding:10px 10px 14px;margin-bottom:6px;border-bottom:1px solid var(--tb-line)}
.topbar.tb .tb-user-head>div{display:block;min-width:0}
.tb-user-head strong{display:block;font-size:14px;color:var(--tb-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-user-head small{display:block;font-size:12px;color:var(--tb-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tb-user-menu a,.tb-user-menu button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:9px;background:none;font:inherit;font-size:13.5px;font-weight:500;color:var(--tb-ink);cursor:pointer;text-align:left}
.tb-user-menu a svg,.tb-user-menu button svg{width:18px;height:18px;color:var(--tb-muted)}
.tb-user-menu a:hover,.tb-user-menu button:hover{background:var(--tb-hover)}
.tb-user-menu a b{margin-left:auto;font-size:11px;font-weight:700;color:#fff;background:var(--tb-danger);padding:1px 7px;border-radius:99px}
.tb-user-menu form{margin:6px 0 0;padding-top:6px;border-top:1px solid var(--tb-line)}
.tb-user-menu button.danger{color:var(--tb-danger)}
.tb-user-menu button.danger svg{color:var(--tb-danger)}
.tb-user-menu button.danger:hover{background:#fef3f2}

/* Lien actif de la barre latérale */
.sidebar nav a.active{background:rgba(255,255,255,.1);color:#fff;font-weight:600;box-shadow:inset 3px 0 0 #3ec7b2}
.sidebar nav a.active i{color:#3ec7b2}

.sidebar nav a .nav-badge{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:99px;background:#f59e0b;color:#1f1300;font-size:11px;font-weight:700;line-height:20px;text-align:center}


/* Bouton alertes sonores */
.tb-sound .off{display:none}
.tb-sound.muted .on{display:none}
.tb-sound.muted .off{display:block}
.tb-sound.muted{color:#a3b0b7}

/* Toasts salle d'attente */
.wr-toasts{position:fixed;top:78px;right:20px;z-index:100;display:flex;flex-direction:column;gap:10px;width:min(380px,calc(100vw - 32px));pointer-events:none}
.wr-toast{pointer-events:auto;display:flex;align-items:flex-start;gap:12px;padding:14px 14px 14px 12px;background:#fff;border:1px solid #e4eaee;border-left:4px solid var(--t,#168174);border-radius:14px;box-shadow:0 18px 40px -12px rgba(20,35,44,.3),0 4px 10px rgba(20,35,44,.08);color:#14232c;text-decoration:none;animation:wr-toast-in .28s cubic-bezier(.2,.9,.3,1.2)}
.wr-toast.is-call{--t:#3b5bab}
.wr-toast.is-urgent{--t:#d92d20;background:#fff8f7}
.wr-toast.out{animation:wr-toast-out .25s ease forwards}
.wr-toast-ticket{flex:none;min-width:54px;padding:7px 6px;border-radius:10px;background:var(--t,#168174);color:#fff;font-size:13px;font-weight:800;text-align:center;font-variant-numeric:tabular-nums}
.wr-toast.is-urgent .wr-toast-ticket{animation:wr-blink 1s ease-in-out 3}
.wr-toast>div{flex:1;min-width:0}
.wr-toast strong{display:block;font-size:13.5px;margin-bottom:2px}
.wr-toast p{margin:0;font-size:13px;color:#3b4d55;line-height:1.4}
.wr-toast p span{color:#6b7b85;font-size:12px}
.wr-toast button{flex:none;width:24px;height:24px;border:0;border-radius:6px;background:transparent;color:#94a3a8;cursor:pointer;font-size:12px}
.wr-toast button:hover{background:#f3f6f8;color:#14232c}
@keyframes wr-toast-in{from{opacity:0;transform:translateX(30px) scale(.96)}to{opacity:1;transform:none}}
@keyframes wr-toast-out{to{opacity:0;transform:translateX(30px)}}
@keyframes wr-blink{50%{opacity:.45}}
@media(max-width:600px){.wr-toasts{top:70px;right:16px;left:16px;width:auto}}
@media(prefers-reduced-motion:reduce){.wr-toast,.wr-toast.out,.wr-toast-ticket{animation:none!important}}

/* Responsive */
@media(max-width:1100px){.tb-date{display:none}}
@media(max-width:1000px){
  body.menu-open .topbar.tb{z-index:1}
  .topbar.tb{padding:0 14px;gap:10px;height:62px}
  .topbar.tb .tb-menu{display:grid}
  .tb-user-text,.tb-caret,.tb-sep{display:none}
  .tb-user{padding:0 2px}
  .tb-crumbs{display:none}
}
@media(max-width:480px){
  .tb-notif{position:fixed;left:10px;right:10px;top:70px;width:auto}
  .tb-user-menu{position:fixed;right:10px;top:70px}
}
@media(prefers-reduced-motion:reduce){.tb-bell.has-unread svg,.tb-panel{animation:none}}
