
/* MK HABITAT CRM — compatibility stylesheet
   Goal: restore/alias common legacy classes used in original templates
   so the UI looks like before. Safe to drop-in as static/style.css.
*/

/* ---------- CSS Variables (Hope UI inspired) ---------- */
:root{
  --bg:#f4f6fb;
  --surface:#ffffff;
  --surface-alt:#f9fafc;
  --border:#e6e9f2;
  --text:#111827;
  --muted:#667085;
  --primary:#3a57e8;
  --primary-contrast:#ffffff;
  --brand-green:#9fca00;
  --brand-blue:#1078BD;
  --success:#0e9f6e;
  --success-contrast:#ffffff;
  --warning:#f4a100;
  --warning-contrast:#111827;
  --danger:#e11d48;
  --danger-contrast:#ffffff;
  --info:#0ea5e9;
  --info-contrast:#ffffff;
  --sidebar:#ffffff;
  --sidebar-border:#e7eaf3;
  --shadow-sm:0 2px 8px rgba(15,23,42,.06);
  --shadow-md:0 12px 24px rgba(15,23,42,.08);
}

/* ---------- Reset / base ---------- */
*{box-sizing:border-box}
html{color-scheme:light}
html,body{margin:0;padding:0;font-family:'Plus Jakarta Sans','Manrope','Outfit','Segoe UI',sans-serif;color:var(--text);background:var(--bg)}
/*body{background-image:radial-gradient(circle at 15% 10%,rgba(58,87,232,.08),transparent 40%),radial-gradient(circle at 80% 0,rgba(14,159,110,.06),transparent 35%)}*/
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;height:auto}
.icon-flipped{transform: scaleX(-1)}

/* ---------- Layout containers (legacy aliases) ---------- */
.container,.container-fluid{max-width:1200px;margin:0 auto;padding:24px}
.wrapper{max-width:1200px;margin:0 auto;padding:24px}
.content{padding:10px 0}

/* ---------- App shell ---------- */
.env-banner{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:2400;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:repeating-linear-gradient(135deg,#7f1d1d 0 12px,#991b1b 12px 24px);
  color:#fff7ed;
  border-bottom:2px solid rgba(255,255,255,.2);
  font-size:.82rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  text-align:center;
}
.env-banner strong{font-size:.84rem}
.env-banner span{opacity:.92;word-break:break-word}
.app-shell{display:flex;min-height:100vh;position:relative}
.sidebar{
  width:260px;flex:0 0 260px;background:var(--sidebar);
  border-right:1px solid var(--sidebar-border);padding:18px 16px 20px;
  display:flex;flex-direction:column;gap:16px;position:sticky;top:0;height:100vh;
}
.sidebar-brand{display:flex;align-items:center;gap:2px;font-weight:800}
.sidebar-close{
  display:none;margin-left:auto;border:1px solid var(--border);background:#fff;color:#475569;
  border-radius:10px;padding:6px 8px;cursor:pointer;
}
.brand-mark{background:var(--primary);color:#fff;font-weight:800;border-radius:10px;padding:6px 8px;font-size:1.05rem;display:inline-block;text-decoration:none;}
.brand-mark:hover{text-decoration: none;}
.brand-mark{background:linear-gradient(135deg,var(--brand-green),var(--brand-blue))}
.brand-name{font-size:1.05rem;letter-spacing:.04em}
.sidebar-section{display:flex;flex-direction:column;gap:8px}
.sidebar-label{font-size:.7rem;text-transform:uppercase;letter-spacing:.18em;color:#98a2b3;margin-bottom:4px}
.sidebar-link{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;
  color:var(--text);font-weight:600;background:transparent;border:1px solid transparent;
}
.sidebar-link i{font-size:1rem;color:#94a3b8}
.sidebar-link.active{
  background:var(--surface-alt);
  border-color:#eef2f7;
}
.sidebar-link.active i{color:var(--text)}
.sidebar-link:hover{background:var(--surface-alt);border-color:#eef2f7;text-decoration:none}
.sidebar-group{display:flex;flex-direction:column}
.sidebar-group summary{
  list-style:none;cursor:pointer;padding:10px 12px;border-radius:12px;
  display:flex;align-items:center;justify-content:space-between;font-weight:600;color:var(--text);
}
.sidebar-link.new-appointment{background:var(--brand-blue); color:white;}
.sidebar-link.new-appointment i{color:white;}
.sidebar-group summary::-webkit-details-marker{display:none}
.sidebar-group summary i{font-size:1rem;margin-right:10px;color:#94a3b8}
.sidebar-group[open] summary{background:var(--surface-alt)}
.sidebar-sub{display:flex;flex-direction:column;gap:6px;padding:8px 12px 4px 18px}
.sidebar-sub a{color:var(--muted);font-weight:500}
.sidebar-sub a:hover{color:var(--text);text-decoration:none}
.sidebar-sub a.active{color:var(--text);font-weight:600}
.sidebar-footer{margin-top:auto;display:flex;flex-direction:column;gap:12px}
.sidebar-user{display:flex;align-items:center;gap:10px;padding:10px;border-radius:12px;background:var(--surface-alt);border:1px solid #eef2f7}
.sidebar-user-avatar{width:36px;height:36px;border-radius:12px;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700}
.sidebar-user-name{font-weight:700}
.sidebar-user-role{font-size:.8rem;color:var(--muted);text-transform:capitalize}
.logout-link{color:#ef4444}

.app-main{flex:1 1 auto;display:flex;flex-direction:column;min-width:0}
.app-content{flex:1 1 auto;max-width: 100%;padding-bottom: calc(24px + 40px);}
.topbar{
  display:flex;align-items:center;gap:16px;padding:14px 20px;background:rgba(255,255,255,.9);
  backdrop-filter:blur(8px);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:1000;
}
.topbar:before{
  content:"";
  position:absolute;
  left:0;right:0;top:calc(71px - 3px);height:3px;
  background:linear-gradient(90deg, var(--brand-green) 50%, var(--brand-blue) 50%);
}
.sidebar-toggle{
  display:none;border:1px solid var(--border);background:#fff;border-radius:12px;padding:8px 10px;cursor:pointer;
  color:#475569;font-size:1.1rem;
}
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:12px}
.topbar-quick-actions{display:none;align-items:center;gap:8px}
.topbar-quick-link{
  display:inline-flex;align-items:center;justify-content:center;
  width:36px;height:36px;border-radius:12px;
  background:var(--surface-alt);border:1px solid #eef2f7;color:#1f2937;
}
.topbar-quick-link:hover{text-decoration:none;background:#f1f5f9}
.topbar-account{position:relative}
.topbar-account summary{
  list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;
  padding:6px 10px;border-radius:999px;background:var(--surface-alt);border:1px solid #eef2f7;
}
.topbar-account summary::-webkit-details-marker{display:none}
.account-avatar{width:28px;height:28px;border-radius:999px;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.85rem}
.account-avatar-img{width:28px;height:28px;border-radius:999px;object-fit:cover;border:1px solid #dbe3ee}
.account-name{font-weight:600}
.topbar-dropdown{
  position:absolute;right:0;top:calc(100% + 8px);min-width:180px;background:#fff;border:1px solid var(--border);
  border-radius:12px;box-shadow:var(--shadow-md);padding:10px;display:flex;flex-direction:column;gap:6px;
}
.topbar-dropdown a{padding:6px 8px;border-radius:8px;color:var(--text)}
.topbar-dropdown a:hover{background:var(--surface-alt);text-decoration:none}
.dropdown-meta{padding:6px 8px;border-radius:8px;background:var(--surface-alt)}
.dropdown-name{font-weight:700}
.dropdown-role{font-size:.8rem;color:var(--muted);text-transform:capitalize}
.topbar-notifs{position:relative}
.topbar-notifs summary{list-style:none;cursor:pointer}
.topbar-notifs summary::-webkit-details-marker{display:none}
.notif-icon{position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:12px;background:var(--surface-alt);border:1px solid #eef2f7;color:#1f2937}
.notif-badge{position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;border-radius:999px;background:#ef4444;color:#fff;font-size:.7rem;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 5px;box-shadow:0 4px 10px rgba(239,68,68,.25)}
.notif-badge:not(.active){display:none}
.notif-dropdown{min-width:320px;max-width:420px}
.notif-list{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.notif-item{padding:10px;border-radius:10px;border:1px solid #eef2f7;background:#fff;display:flex;flex-direction:column;gap:4px}
.notif-item.clickable{cursor:pointer}
.notif-item.clickable:hover{background:var(--surface-alt)}
.notif-item-title{font-weight:700}
.notif-item-body{color:var(--text)}
.notif-item-meta{font-size:.75rem;color:var(--muted)}
.notif-empty{color:var(--muted);font-size:.9rem;padding:8px}

.auth-topbar{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;border-bottom:1px solid var(--border);background:#fff}
.auth-brand{font-weight:800;font-size:1.1rem}
.auth-remember{display:flex;align-items:center;gap:8px;font-size:.9rem;color:var(--muted)}
.auth-remember input{accent-color:var(--primary)}

.nav-search{display:flex;align-items:center;gap:6px;flex:1 1 420px;max-width:520px;position:relative}
.nav-search .form-control{width:100%;min-width:200px;padding:8px 12px;border-radius:12px;border:1px solid var(--border);background:#fff}
.nav-search-btn{
  background:var(--primary);border:1px solid var(--primary);color:#fff;padding:8px 12px;border-radius:12px;
  box-shadow:0 8px 16px rgba(58,87,232,.2);transition:transform .08s ease, box-shadow .2s ease;
}
.nav-search-btn:hover{box-shadow:0 12px 20px rgba(58,87,232,.26);filter:brightness(1.02)}
.nav-search-btn:active{transform:translateY(1px)}
.nav-search-suggest{
  position:absolute;top:calc(100% + 8px);left:0;right:0;background:#fff;border:1px solid var(--border);
  border-radius:14px;box-shadow:var(--shadow-md);padding:8px;z-index:2200;
  display:flex;flex-direction:column;gap:4px;max-height:360px;overflow:auto;
}
.nav-search-suggest .suggest-header{
  font-size:.7rem;text-transform:uppercase;letter-spacing:.12em;color:#94a3b8;
  padding:6px 8px;border-top:1px solid #eef2f7;
}
.nav-search-suggest .suggest-header:first-child{border-top:none}
.nav-search-suggest .suggest-item{
  display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:10px;
  color:var(--text);text-decoration:none;
}
.nav-search-suggest .suggest-item:hover{background:var(--surface-alt)}
.nav-search-suggest .suggest-title{font-weight:600;font-size:.92rem}
.nav-search-suggest .suggest-sub{font-size:.8rem;color:var(--muted)}
.nav-search-suggest .suggest-action{
  background:linear-gradient(135deg,#eef2ff,#f0fdf4);
  border:1px solid #e2e8f0;
}

.sidebar-overlay{display:none}
body.sidebar-open .sidebar-overlay{
  display:block;position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:900;
}
body.sidebar-open .sidebar{
  transform:translateX(0);
}

/* ---------- Cards / panels ---------- */
.card,.panel,.box{
  background:var(--surface);border:1px solid var(--border);border-radius:16px;
  box-shadow:var(--shadow-sm);
}
.card-header,.panel-heading{padding:14px 18px;border-bottom:1px solid var(--border);font-weight:700}
.card-body,.panel-body{padding:18px}
.card-footer,.panel-footer{padding:12px 18px;border-top:1px solid var(--border);background:var(--surface-alt)}
.shadow-sm{box-shadow:var(--shadow-sm)}
.shadow{box-shadow:var(--shadow-md)}

/* ---------- Typography helpers ---------- */
.muted,.text-muted{color:var(--muted)}
.small,.text-small{font-size:.875rem}
.h1{font-size:2rem}.h2{font-size:1.5rem}.h3{font-size:1.25rem}

/* ---------- Spacing helpers ---------- */
.p-2{padding:8px}.p-3{padding:16px}.p-4{padding:20px}
.m-0{margin:0}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}

/* ---------- Grid (Bootstrap-like) ---------- */
.row{display:flex;flex-wrap:wrap;margin-left:-8px;margin-right:-8px}
[class^="col-"],[class*=" col-"]{padding-left:8px;padding-right:8px}
.col{flex:1 1 0}
.col-3{flex:0 0 25%}.col-4{flex:0 0 33.333%}.col-6{flex:0 0 50%}.col-8{flex:0 0 66.666%}.col-12{flex:0 0 100%}
.col-md-3{flex:0 0 25%}.col-md-4{flex:0 0 33.333%}.col-md-6{flex:0 0 50%}.col-md-8{flex:0 0 66.666%}.col-md-12{flex:0 0 100%}
.d-flex{display:flex}.align-center{align-items:center}.align-end{align-items:flex-end}.justify-between{justify-content:space-between}

/* ---------- Forms ---------- */
.form,.form-horizontal{display:block}
.form-group{margin-bottom:12px}
label,.form-label{display:block;margin-bottom:6px;color:#374151;font-weight:600}
.req{color:#dc2626;font-weight:700;}
input[type="text"],input[type="password"],input[type="email"],input[type="number"],
input[type="date"],input[type="time"],select,textarea,.form-control,.input {
  width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:#fff;color:var(--text);
}
textarea{min-height:100px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:none;border-color:#a5b4fc;box-shadow:0 0 0 4px rgba(58,87,232,.15)}
.help-text,.form-text{color:var(--muted);font-size:.875rem;margin-top:4px}
@media (max-width: 768px){
  input[type="text"],input[type="password"],input[type="email"],input[type="number"],
  input[type="date"],input[type="time"],select,textarea,.form-control,.input,.chat-search-input{
    font-size:16px;
  }
}

/* ---------- Buttons ---------- */
.btn{display:inline-block;padding:9px 14px;border:1px solid #e2e8f0;border-radius:12px;background:#fff;color:#0f172a;cursor:pointer;line-height:1}
.btn:hover{background:#f1f5f9}
.btn:disabled{opacity:.6;cursor:not-allowed}
.btn-block{display:block;width:100%}
.btn-sm{font-size:.875rem;padding:6px 10px}
.btn-xs{font-size:.75rem;padding:4px 8px}
.btn-xs i{margin-right: 5px}

.btn-primary{background:var(--primary);border-color:var(--primary);color:var(--primary-contrast);box-shadow:0 8px 16px rgba(58,87,232,.2)}
.btn-primary:hover{filter:brightness(1.02)}
.btn-success{background:var(--success);border-color:var(--success);color:var(--success-contrast)}
.btn-warning{background:var(--warning);border-color:var(--warning);color:var(--warning-contrast)}
.btn-danger{background:var(--danger);border-color:var(--danger);color:var(--danger-contrast)}
.btn-info{background:var(--info);border-color:var(--info);color:var(--info-contrast)}

.btn-outline-primary{background:transparent;color:var(--primary);border-color:var(--primary)}
.btn-outline-secondary{background:transparent;color:#334155;border-color:#94a3b8}
.btn-outline-success{background:transparent;color:var(--success);border-color:var(--success)}
.btn-outline-danger{background:transparent;color:var(--danger);border-color:var(--danger)}

/* Legacy aliasing */
.primary{background:var(--primary)!important;color:#fff!important}
.success{background:var(--success)!important;color:#fff!important}
.danger{background:var(--danger)!important;color:#fff!important}

/* ---------- Tasks ---------- */
.task-dock{position:fixed;right:16px;bottom:16px;width:500px;background:#fff;border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:1200}
.task-dock summary{list-style:none;cursor:pointer;padding:8px 10px;font-weight:600;background:#f8fafc;border-radius:10px;display:flex;align-items:center;justify-content:space-between}
.task-dock summary::-webkit-details-marker{display:none}
.task-dock[open] summary{border-bottom:1px solid var(--border);border-bottom-left-radius:0;border-bottom-right-radius:0}
.task-badge{display:inline-flex;align-items:center;gap:4px;justify-content:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#ef4444;color:#fff;font-size:.75rem}
.task-badges{display:inline-flex;align-items:center;gap:6px}
.task-summary-right{margin-left:auto;display:inline-flex;align-items:center;gap:8px}
.chat-expand{border:1px solid var(--border);background:#fff;border-radius:8px;padding:2px 8px;font-size:.75rem;line-height:1.4;color:var(--text);text-decoration:none}
.chat-expand:hover{text-decoration:none;background:#f1f5f9}
.chat-expanded .task-dock{right:12px;bottom:12px;width:min(900px,95vw);height:min(80vh,720px);display:flex;flex-direction:column}
.chat-expanded .task-dock-body{max-height:calc(720px - 55px);;flex:1 1 auto;overflow:hidden;min-height:0;}
.chat-expanded .task-panel[data-panel="chat"].active{flex:1 1 auto;border:0px;padding:0px;border-radius: 0px}
.chat-expanded .chat-main{min-height:0; height: calc(620px - 35px)}
.chat-expanded .chat-list{overflow:auto}
.chat-full .task-dock{position:fixed;inset:0;width:100%;height:100%;border-radius:0;box-shadow:none;display:flex;flex-direction:column}
.chat-full .task-dock summary{position:sticky;top:0;background:#fff;z-index:2001}
.chat-full .task-dock-body{max-height:none;flex:1 1 auto;overflow:hidden;min-height:0}
.chat-full .task-panel[data-panel="chat"].active{flex:1 1 auto}
.chat-full .chat-main{min-height:0}
.chat-full .chat-list{overflow:auto}
.chat-full main.container{display:none}
.chat-full .chat-expand{display:none}
.task-dock-body{max-height:300px;overflow:hidden;padding:8px 10px;display:flex;flex-direction:column;min-height:0}
.task-tabs{display:flex;gap:6px;margin-bottom:8px}
.task-tab{flex:1 1 auto;padding:6px 8px;border:1px solid var(--border);border-radius:8px;background:#fff;cursor:pointer;font-size:.85rem}
.task-tab.active{background:var(--primary);border-color:var(--primary);color:var(--primary-contrast)}
.task-panel{display:none}
.task-panel.active{display:block;flex:1 1 auto;overflow:auto;min-height:0}
.task-panel[data-panel="chat"].active{overflow:hidden;display:flex;flex-direction:column;min-height:0;border:0px;padding:0px;border-radius: 0px}
.task-panel-title{font-weight:600;margin-bottom:6px}
.task-list{margin:0;padding-left:18px}
.task-list li{margin:4px 0}

/* ---------- Search ---------- */
.search-head{gap:16px}
.search-inline{min-width:260px}
.search-actions{display:flex;gap:8px;flex-wrap:wrap}
.result-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.result-item a{font-weight:600}

.chat-layout{display:flex;gap:10px;flex:1 1 auto;min-height:0;align-items:stretch}
.chat-expanded .chat-layout,
.chat-full .chat-layout{
  height:auto;
}
.chat-main{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chat-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.chat-title{font-weight:600}
.chat-collapse{border:1px solid var(--border);background:#fff;border-radius:8px;padding:2px 6px;font-size:.8rem;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.chat-collapse:hover{background:#f1f5f9}
.chat-sidebar{flex:0 0 220px;border-left:1px solid var(--border);padding-left:8px;display:flex;flex-direction:column;min-height:0}
.chat-channel-list{display:flex;flex-direction:column;overflow:auto;flex:1 1 auto;min-height:0}
.chat-expanded .chat-channel-list{max-height:none;overflow:auto}
.chat-full .chat-channel-list{max-height:none;overflow:auto}
.chat-sidebar-title{display:flex;align-items:center;gap:6px;font-size:.75rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;margin:4px 0 6px;padding-right:24px}
.chat-search{margin:4px 0 10px}
.chat-search-input{width:100%;border-radius:999px;padding:6px 10px;border:1px solid var(--border);background:#fff;font-size:.85rem}
.chat-active-count{color:var(--muted);font-weight:600;margin-left:6px}
.chat-caret{margin-left:6px;font-size:.8rem;transition:transform .15s ease;display:inline-block}
.task-dock[open] .chat-caret{transform:rotate(180deg)}
.chat-channel-item{display:flex;align-items:center;gap:10px;padding:8px;border-radius:10px;cursor:pointer}
.chat-avatar{
  width:34px;height:34px;border-radius:10px;background:#0f172a;color:#fff;
  display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.85rem;
}
.chat-channel-main{flex:1 1 auto;display:flex;flex-direction:column;gap:2px;min-width:0}
.chat-channel-top{display:flex;align-items:center;justify-content:space-between;gap:6px}
.chat-time{font-size:.7rem;color:var(--muted)}
.chat-preview-row{display:flex;align-items:center;gap:6px}
.chat-preview{font-size:.78rem;color:#64748b;flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-channel-item:hover{background:#f1f5f9}
.chat-channel-item.active{background:#e0f2fe;color:#075985}
.chat-presence{color:#9ca3af;font-size:.55rem;margin-left:6px;margin-right:6px}
.chat-presence.active{color:#22c55e}
.chat-label{display:inline;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:140px}
.chat-initials{display:none;font-weight:600}
.chat-channel-badge{display:none;align-items:center;gap:4px;justify-content:center;min-width:16px;height:16px;padding:0 5px;border-radius:999px;background:#3b82f6;color:#fff;font-size:.7rem;line-height:1}
.chat-empty{padding:6px 8px}
.chat-list{height:180px;overflow:auto;border:1px solid var(--border);border-radius:8px;background:#f8fafc;padding:6px;margin-bottom:8px;flex:1 1 auto;min-height:0}
.chat-expanded .chat-list,
.chat-full .chat-list{
  height:0;
  flex:1 1 auto;
  min-height:0;
}
.chat-message{background:#fff;border:1px solid var(--border);border-radius:8px;padding:6px;margin-bottom:6px;max-width:78%;margin-right:auto}
.chat-message.me{border-color:#93c5fd;background:#eff6ff;margin-left:auto;margin-right:0}
.chat-meta{display:flex;justify-content:space-between;font-size:.75rem;color:var(--muted);margin-bottom:2px}
.chat-text{white-space:pre-wrap;font-size:.85rem}
.chat-channel-badge.has{display:inline-flex}
.chat-input-row{display:flex;gap:6px}
.chat-input{flex:1 1 auto}
.chat-send{flex:0 0 auto}
.chat-indicator,.chat-dot{display:none;align-items:center;gap:4px;justify-content:center;min-width:16px;height:16px;padding:0 5px;border-radius:999px;background:#3b82f6;color:#fff;font-size:.7rem;margin-left:6px;line-height:1}
.badge-count{display:inline-flex;min-width:10px;justify-content:center}
.chat-indicator.has,.chat-dot.has{display:inline-flex}

/* ---------- Task dock redesign ---------- */
.task-dock{
  background:linear-gradient(180deg,#ffffff 0%,#f7f8fc 100%);
  border:1px solid #e5e7f2;
  border-radius:16px;
  box-shadow:0 20px 50px rgba(15,23,42,.18);
  overflow:hidden;
}
.task-dock summary{
  padding:10px 12px;
  border-radius:16px;
  gap:10px;
  font-size:.95rem;
  letter-spacing:.01em;
}
.task-toggle{display:flex;align-items:center;justify-content:space-between}
.task-toggle-main{display:flex;align-items:center;gap:10px}
.task-toggle-icon{
  width:34px;height:34px;border-radius:12px;
  background:var(--brand-blue);;color:#fff;display:flex;align-items:center;justify-content:center;
  box-shadow:0 8px 16px rgba(15,23,42,.18);
}
.task-toggle-text{display:flex;flex-direction:column;line-height:1}
.task-toggle-text span{display:block}
.task-toggle-sub{font-size:.7rem;color:#475569;font-weight:600;margin-top:4px}
.task-toggle-badges{display:flex;align-items:center;gap:8px}
.task-dock[open] summary{
  border-bottom:1px solid #e5e7f2;
  border-bottom-left-radius:0;
  border-bottom-right-radius:0;
}
.task-summary-right{display:flex;align-items:center;gap:8px}
.task-badges .task-badge,
.chat-indicator,
.chat-dot{
  background:#0f172a;
  color:#fff;
  box-shadow:0 6px 18px rgba(15,23,42,.18);
}
.chat-expand{
  border:1px solid #dbe1f0;
  background:#fff;
  border-radius:999px;
  padding:4px 10px;
  font-weight:600;
}
.task-dock-body{
  padding:12px;
  gap:10px;
}
.task-tabs{
  background:#eef2ff;
  border:1px solid #e0e7ff;
  border-radius:999px;
  padding:4px;
  gap:6px;
}
.task-tab{
  flex:1 1 auto;
  border-radius:999px;
  padding:6px 10px;
  font-weight:700;
  color:#475569;
  background:transparent;
  border:0;
}
.task-tab.active:nth-child(1){
  background:linear-gradient(135deg, #6de616, #12b827);
  color:#fff;
  box-shadow:0 8px 18px rgba(37,99,235,.25);
}
.task-tab.active{
  background:linear-gradient(135deg,#0ea5e9,#2563eb);
  color:#fff;
  box-shadow:0 8px 18px rgba(37,99,235,.25);
}
.task-panel{
  background:#fff;
  border:1px solid #eef0f6;
  border-radius:14px;
  padding:10px;
}
.task-panel-title{
  font-size:.9rem;
  color:#334155;
  text-transform:uppercase;
  letter-spacing:.12em;
}
.task-count{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:20px;height:20px;margin-left:8px;padding:0 6px;
  border-radius:999px;background:#0f172a;color:#fff;font-size:.7rem;font-weight:700;
}
.task-cards{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.task-card{
  display:flex;flex-direction:column;gap:6px;padding:10px 12px;
  background:linear-gradient(135deg,#ffffff,#f8fafc);
  border:1px solid #e6eaf2;border-radius:12px;text-decoration:none;color:inherit;
  box-shadow:0 6px 14px rgba(15,23,42,.06);
}
.task-card:hover{transform:translateY(-1px);box-shadow:0 10px 20px rgba(15,23,42,.1);text-decoration: none;}
.task-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.task-card-title{font-weight:700;color:#0f172a}
.task-card-date{font-size:.75rem;color:#64748b}
.task-card-meta{display:flex;align-items:center;justify-content:space-between;gap:8px}
.task-card-client{font-size:.8rem;color:#475569}
.task-card-cta{
  font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  color:#2563eb;background:#eef2ff;border-radius:999px;padding:4px 8px;
}
.task-empty{padding:8px 6px;color:#64748b;font-size:.85rem}
.chat-layout{gap:12px}
.chat-main{
  background:#f8fafc;
  border:1px solid #e7ebf3;
  border-radius:12px;
  padding:10px;
}
.chat-header{margin-bottom:10px;gap:10px}
.chat-title{font-weight:700}
.chat-back{
  display:none;
  border:1px solid #dbe1f0;
  background:#fff;
  border-radius:999px;
  padding:4px 8px;
  line-height:1;
}
.chat-message-search{
  flex:1 1 auto;
  max-width:220px;
  border-radius:999px;
  padding:6px 10px;
  border:1px solid #e7ebf3;
  background:#fff;
  font-size:.85rem;
}
.chat-meta{display:flex;gap:8px}
.chat-status{
  position:absolute;
  right:8px;
  bottom:6px;
  font-size:.7rem;
  color:var(--muted);
}
.chat-status.delivered{color:#64748b}
.chat-status.seen{color:#0ea5e9}
.chat-collapse{
  border-radius:999px;
  border:1px solid #dbe1f0;
}
.chat-list{
  background:#fff;
  border:1px solid #edf0f6;
  border-radius:12px;
  padding:8px;
}
.chat-date-sep{
  text-align:center;
  font-size:.7rem;
  color:#64748b;
  margin:6px 0;
  padding:4px 8px;
  background:#f1f5f9;
  border-radius:999px;
}
.chat-message{
  position:relative;
  border-radius:12px;
  border:1px solid #e7ebf3;
  padding:8px 10px 16px;
}
.chat-message.me{
  background:#e0f2fe;
  border-color:#bae6fd;
}
.chat-input-row{
  background:#fff;
  border:1px solid #edf0f6;
  border-radius:999px;
  padding:6px;
}
.chat-input{
  border:0;
  box-shadow:none;
  background:transparent;
  padding:6px 8px;
}
.chat-send{
  border-radius:999px;
  background:linear-gradient(135deg,#22c55e,#16a34a);
  color:#fff;
  border:0;
  padding:6px 12px;
}
.chat-send:hover{
    background:linear-gradient(135deg,#0ea5e9,#2563eb);
}
.chat-sidebar{
  border-left:0;
  background:#fff;
  border:1px solid #e7ebf3;
  border-radius:12px;
  padding:10px;
}
.chat-search-input{border:1px solid #e7ebf3;background:#fff}
.chat-avatar{background:#0f172a}
.chat-channel-item.active{background:#0f172a;color:#fff;border-color:#0f172a}
.chat-channel-item.active .chat-time{color:#cbd5f5}
.chat-channel-item.active .chat-preview{color:#e2e8f0}
.chat-sidebar-title{
  font-weight:700;
  color:#0f172a;
  text-transform:none;
  letter-spacing:.02em;
}
.chat-channel-item{
  border-radius:10px;
  border:1px solid transparent;
}
.chat-channel-item.active{
  background:#0f172a;
  color:#fff;
  border-color:#0f172a;
}
.chat-channel-badge{
  background:#f97316;
}

/* Compact chat (reduced PC + mobile): list first, thread second */
.task-dock.chat-compact .chat-layout{gap:0}
.task-dock.chat-compact .chat-main{display:none}
.task-dock.chat-compact .chat-sidebar{display:flex;flex:1 1 auto}
.task-dock.chat-compact.chat-thread-open .chat-main{display:flex}
.task-dock.chat-compact.chat-thread-open .chat-sidebar{display:none}
.task-dock.chat-compact .chat-back{display:inline-flex}
.task-dock.chat-compact .chat-message-search{max-width:100%}

/* ---------- Tables ---------- */
.table{width:100%;border-collapse:collapse;background:#fff;border:1px solid var(--border);border-radius:12px;overflow:hidden}
.table th,.table td{border-bottom:1px solid var(--border);padding:10px;text-align:left;font-size:14px}
.table thead th{background:#f9fafb;color:#374151;font-weight:600}
.table-striped tbody tr:nth-child(odd){background:#fcfcfd}
.table-hover tbody tr:hover{background:#f3f4f6}
.table-sm th,.table-sm td{padding:6px 8px;font-size:13px}
.table-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-start;margin:10px 0}
.table-tools:empty{display:none}
.table-tools .table-search{flex:0 1 320px;max-width:320px}
.table-tools .table-size{flex:0 0 auto;margin-left:auto}
.table-pager{display:flex;align-items:center;justify-content:center;gap:8px;margin:8px 0}
.table-page-info{color:var(--muted);font-size:.875rem}
.table-sortable{cursor:pointer;user-select:none}
.table-sortable.sorted-asc::after{content:" ▲";font-size:.7em;color:var(--muted)}
.table-sortable.sorted-desc::after{content:" ▼";font-size:.7em;color:var(--muted)}
.table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.table-wrap .table{min-width:680px}
.row-overdue{background:#fee2e2}
.row-highlight{background:#fecaca}
.plan-date{max-width:160px}
.input-error{border-color:#dc2626;box-shadow:0 0 0 3px rgba(220,38,38,.15)}

/* Tabs */
.tabs{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.tab-btn{padding:6px 10px;border:1px solid var(--border);border-radius:999px;background:#fff;cursor:pointer}
.tab-btn.active{background:var(--primary);border-color:var(--primary);color:var(--primary-contrast)}

/* ---------- Badges / alerts ---------- */
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:.75rem;border:1px solid var(--border);background:#f3f4f6}
.badge-success{background:#dcfce7;color:#166534;border-color:#bbf7d0}
.badge-warning{background:#fef9c3;color:#854d0e;border-color:#fde68a}
.badge-danger{background:#fee2e2;color:#991b1b;border-color:#fecaca}

.alert{border:1px solid var(--border);border-left-width:4px;padding:10px 12px;border-radius:8px;background:#fff}
.alert-success{border-left-color:var(--success);}
.alert-warning{border-left-color:var(--warning);}
.alert-danger{border-left-color:var(--danger);}
.toast-container{position:fixed;top:76px;right:16px;z-index:2000;display:grid;gap:10px;max-width:360px}
.toast{box-shadow:0 10px 24px rgba(0,0,0,.14);animation:toast-in .2s ease;border-left-width:6px}
.toast-content{display:flex;align-items:flex-start;gap:10px}
.toast-icon{font-size:1.1rem;line-height:1;margin-top:2px}
.toast-hide{opacity:0;transform:translateY(-6px);transition:opacity .3s ease,transform .3s ease}
@keyframes toast-in{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)}}
.notif-prompt{
  position:sticky;top:72px;
  display:flex;align-items:center;gap:12px;position:sticky;
  margin:12px 20px 0;padding:14px 14px 12px 40px;border-radius:12px;
  background:linear-gradient(135deg,#eff6ff,#eef2ff);
  border:1px solid #dbeafe;color:#1e293b;
  box-shadow:var(--shadow-sm);
}
.notif-prompt.hidden{display:none}
.notif-prompt-text{font-weight:600;font-size:.9rem}
.notif-prompt .btn{white-space:nowrap}
.notif-dismiss{
  position:absolute;top:6px;left:6px;
  padding:2px 6px;line-height:1;border-radius:8px;
}
@media (max-width: 720px){
  .toast-container{left:16px;right:16px;max-width:none}
  .notif-prompt{margin:10px 16px 0;top:64px}
  .task-toggle-sub{display:none}
  .task-toggle-icon{width:30px;height:30px;border-radius:10px}
}
.error{color:#b91c1c}

/* ---------- Users page ---------- */
.users-page{display:flex;flex-direction:column;gap:18px}
.users-hero{display:flex;justify-content:space-between;gap:20px;padding:20px;position:relative;overflow:hidden;background:linear-gradient(135deg,#fff7ed,#e0f2fe);border:1px solid #f1f5f9}
.users-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.users-title{margin:6px 0 4px;font-size:1.8rem}
.users-subtitle{margin:0;color:#475569}
.users-hero-metrics{display:flex;gap:16px;align-items:center}
.users-metric{min-width:120px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:10px 14px}
.users-metric-label{font-size:.75rem;color:#64748b;text-transform:uppercase;letter-spacing:.08em}
.users-metric-value{font-size:1.25rem;font-weight:700;margin-top:4px}
.users-grid{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:18px;align-items:start}
.users-panel{padding:16px}
.users-panel-head{display:flex;flex-direction:column;gap:4px;margin-bottom:12px}
.users-form{display:flex;flex-direction:column;gap:12px}
.users-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.users-list{display:flex;flex-direction:column;gap:12px}
.users-list-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.users-filters{display:flex;gap:8px;align-items:center}
.users-filters .form-control{min-width:180px}
.users-list-status{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.users-cards{display:grid;gap:12px}
.user-card{padding:14px}
.user-card-inactive{
  background:
    repeating-linear-gradient(
      -45deg,
      #f8fafc 0,
      #f8fafc 10px,
      #eef2f7 10px,
      #eef2f7 20px
    );
  border-color:#d6dee8;
}
.user-card-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}
.user-name{font-size:1.1rem;font-weight:700}
.user-sub{font-size:.85rem;color:#64748b}
.user-avatar-img{width:42px;height:42px;border-radius:999px;object-fit:cover;border:1px solid #dbe3ee}
.user-actions{display:flex;gap:6px;flex-wrap:wrap}
.user-card-body{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.user-field{display:flex;flex-direction:column;gap:6px}
.user-label{font-size:.75rem;text-transform:uppercase;letter-spacing:.08em;color:#64748b}
.user-value{font-weight:600}
.user-inline-form{display:flex;gap:8px;align-items:center}
.user-toggle{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600}
.user-agenda{grid-column:1/-1}
.user-agenda-form{display:grid;grid-template-columns:1.3fr 1fr auto;gap:8px;align-items:center}
.users-inactive-panel{padding:10px 12px}
.users-inactive-panel summary{display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-weight:700;list-style:none}
.users-inactive-panel summary::-webkit-details-marker{display:none}
.users-cards-inactive{margin-top:10px}
.user-agenda-status{margin-top:6px}
.user-role{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;background:#e2e8f0;color:#334155}
.role-admin{background:#fee2e2;color:#991b1b}
.role-commercial{background:#dcfce7;color:#166534}
.role-secretary{background:#e0f2fe;color:#075985}
.role-user{background:#ede9fe;color:#5b21b6}

/* ---------- Profile page ---------- */
.profile-page{gap:20px}
.profile-hero{
  background:linear-gradient(135deg,#f8fafc,#e0f2fe);
  border:1px solid #d7e6f7;
  align-items:center;
}
.profile-hero-aside{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:14px;
  background:#ffffffcc;
  border:1px solid #dbeafe;
}
.profile-avatar,
.profile-avatar-fallback{
  width:58px;
  height:58px;
  border-radius:14px;
  flex:0 0 58px;
}
.profile-avatar{
  object-fit:cover;
  border:1px solid #dbe3ee;
}
.profile-avatar-fallback{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.25rem;
  font-weight:700;
  color:#fff;
  background:linear-gradient(135deg,#0ea5e9,#145ee5);
}
.profile-identity{display:flex;flex-direction:column;gap:4px}
.profile-name{font-weight:700;color:#0f172a}
.profile-meta{font-size:.85rem;color:#64748b}
.profile-grid{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);
  gap:16px;
  align-items:start;
}
.profile-card{padding:18px;gap:16px}
.profile-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.profile-card-head h3{margin:0;font-size:1.1rem}
.profile-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:14px;
}

/* ---------- Products page ---------- */
.products-page{display:flex;flex-direction:column;gap:18px}
.products-hero{display:flex;justify-content:space-between;gap:20px;padding:20px;position:relative;overflow:hidden;background:linear-gradient(135deg,#eef2ff,#fefce8);border:1px solid #f1f5f9}
.products-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.products-title{margin:6px 0 4px;font-size:1.8rem}
.products-subtitle{margin:0;color:#475569}
.products-hero-metrics{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.products-metric{min-width:120px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:10px 14px}
.products-metric-label{font-size:.75rem;color:#64748b;text-transform:uppercase;letter-spacing:.08em}
.products-metric-value{font-size:1.25rem;font-weight:700;margin-top:4px}
.products-grid{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:18px;align-items:start}
.products-panel{display:flex;flex-direction:column;gap:12px}
.products-card{padding:16px;display:flex;flex-direction:column;gap:10px}
.products-card-head{display:flex;flex-direction:column;gap:4px;margin-bottom:4px}
.products-toggle{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600}
.products-list{display:flex;flex-direction:column;gap:12px}
.products-list-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.products-filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.products-filters .form-control{min-width:160px}
.products-groups{display:flex;flex-direction:column;gap:16px}
.product-group{display:flex;flex-direction:column;gap:10px}
.product-group-head{display:flex;align-items:center;justify-content:space-between}
.product-group-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.product-card{padding:12px;display:flex;flex-direction:column;gap:10px}
.product-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.product-name{font-weight:700;font-size:1.05rem}
.product-meta{display:grid;gap:8px}
.product-meta-item{display:flex;justify-content:space-between;gap:8px;font-size:.9rem}
.product-label{text-transform:uppercase;letter-spacing:.06em;font-size:.7rem;color:#64748b}
.product-actions{display:flex;gap:6px;flex-wrap:wrap}
.categories-list{display:flex;flex-direction:column;gap:12px}
.categories-head{display:flex;justify-content:space-between;align-items:center}
.categories-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.category-card{padding:12px;display:flex;justify-content:space-between;align-items:center;gap:10px}
.category-name{font-weight:700}
.category-actions{display:flex;gap:6px;flex-wrap:wrap}
.confirm-modal{max-width:520px;min-width:0;width:92vw}
.confirm-body{padding:12px 16px;color:var(--text)}
.confirm-actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid var(--border);background:#f8fafc}

/* ---------- Templates page ---------- */
.templates-page{display:flex;flex-direction:column;gap:18px}
.templates-hero{display:flex;justify-content:space-between;gap:20px;padding:20px;position:relative;overflow:hidden;background:linear-gradient(135deg,#fdf2f8,#ecfeff);border:1px solid #f1f5f9}
.templates-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.templates-title{margin:6px 0 4px;font-size:1.8rem}
.templates-subtitle{margin:0;color:#475569}
.templates-hero-metrics{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.templates-metric{min-width:120px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:10px 14px}
.templates-metric-label{font-size:.75rem;color:#64748b;text-transform:uppercase;letter-spacing:.08em}
.templates-metric-value{font-size:1.25rem;font-weight:700;margin-top:4px}
.templates-grid{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:18px;align-items:start}
.templates-panel{padding:16px}
.templates-panel-head{display:flex;flex-direction:column;gap:4px;margin-bottom:12px}
.templates-form{display:flex;flex-direction:column;gap:12px}
.templates-toggle{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600}
.templates-products-picker{max-height:220px;overflow:auto;border:1px solid var(--border);border-radius:10px;padding:8px;display:flex;flex-direction:column;gap:6px;background:#fff}
.templates-product-option{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0;padding:4px 2px}
.templates-list{display:flex;flex-direction:column;gap:12px}
.templates-list-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.templates-filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.templates-filters .form-control{min-width:180px}
.templates-cards{display:grid;gap:12px}
.template-card{padding:12px;display:flex;flex-direction:column;gap:10px}
.template-card-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.template-name{font-weight:700;font-size:1.05rem}
.template-sub{font-size:.9rem;color:#64748b}
.template-actions{display:flex;gap:6px;flex-wrap:wrap}

/* ---------- Dashboard page ---------- */
.dashboard-page{display:flex;flex-direction:column;gap:18px}
.dashboard-hero{display:flex;justify-content:space-between;gap:20px;padding:22px;position:relative;overflow:hidden;background:linear-gradient(135deg,#ecfeff,#fef9c3);border:1px solid #f1f5f9}
.dashboard-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.dashboard-title{margin:6px 0 4px;font-size:1.8rem}
.dashboard-subtitle{margin:0;color:#475569}
.dashboard-hero-tags{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.dashboard-tag{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:.75rem;font-weight:600;background:#fff;border:1px solid var(--border);color:#334155}
.dashboard-tag-info{background:#eef2ff;border-color:#c7d2fe;color:#3730a3}
.dashboard-hero-metrics{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.dashboard-metric{min-width:140px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:12px 14px}
.dashboard-metric-rdv-mobile{display:none}
.dashboard-metric-label{font-size:.75rem;color:#64748b;text-transform:uppercase;letter-spacing:.08em}
.dashboard-metric-value{font-size:1.3rem;font-weight:700;margin-top:4px}
.dashboard-metric-sub{font-size:.85rem;color:#64748b;margin-top:2px}
.dashboard-grid{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:18px;align-items:start}
.dashboard-grid > *{min-width:0}
.dashboard-panel{display:flex;flex-direction:column;gap:16px}
.dashboard-progress{padding:16px;display:flex;flex-direction:column;gap:12px}
.dashboard-progress-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.dashboard-progress-body{display:flex;flex-direction:column;gap:12px}
.dashboard-progress-value{display:flex;align-items:baseline;gap:8px;font-weight:700}
.dashboard-progress-value .value{font-size:1.4rem}
.dashboard-progress-meta{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.progress.progress-lg{height:12px;border-radius:999px}
.dashboard-progress .bar{background:linear-gradient(90deg,var(--brand-green),var(--brand-blue))}
.dashboard-shortcuts{padding:16px;display:flex;flex-direction:column;gap:12px}
.dashboard-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.dashboard-shortcuts-grid{display:grid;gap:10px}
.dashboard-shortcut{display:flex;gap:12px;align-items:center;padding:12px;border:1px solid var(--border);border-radius:14px;background:#fff;color:var(--text);text-decoration:none}
.dashboard-shortcut i{font-size:1.2rem;color:#1d4ed8}
.dashboard-shortcut:hover{background:var(--surface-alt);text-decoration:none}
.dashboard-shortcut-title{font-weight:700}
.dashboard-shortcut-sub{font-size:.85rem;color:#64748b}
.dashboard-list{padding:16px;display:flex;flex-direction:column;gap:12px}
.dashboard-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.dashboard-list-search{margin-top:-2px}
.dashboard-mobile-search{display:none}
.dashboard-list-actions{display:flex;gap:8px;flex-wrap:wrap}
.dashboard-row-actions{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.dashboard-inline-form{display:inline-flex;margin:0}
.dashboard-inline-form .btn{white-space:nowrap}
.dashboard-inline-form .btn.btn-xs{width: 100%;text-align: left;}
.dashboard-mobile-list{display:none}
.dashboard-rdv-card{padding:12px;border:1px solid var(--border);border-radius:12px;background:#f8fafc;display:flex;flex-direction:column;gap:8px}
.dashboard-rdv-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.dashboard-rdv-id{font-size:.75rem;text-transform:uppercase;letter-spacing:.08em;color:#64748b;font-weight:700}
.dashboard-rdv-date{font-size:.85rem;color:#334155;font-weight:600}
.dashboard-rdv-main{font-weight:700;color:#0f172a}
.dashboard-rdv-sub{font-size:.9rem;color:#64748b}
.dashboard-rdv-address{margin-top:-12px}
.dashboard-rdv-card.row-highlight{
  background:#fed7aa;
  border-color:#fb923c;
}

/* ---------- Appointments pages ---------- */
.appointments-page{display:flex;flex-direction:column;gap:18px}
.appointments-hero{display:flex;justify-content:space-between;gap:20px;padding:22px;position:relative;overflow:hidden;background:linear-gradient(135deg,#ecfeff,#f1f5f9);border:1px solid #f1f5f9}
.appointments-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.appointments-title{margin:6px 0 4px;font-size:1.8rem}
.appointments-subtitle{margin:0;color:#475569}
.appointments-hero-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.appointments-filters{padding:16px}
.appointments-filters-form{display:flex;flex-direction:column;gap:14px;align-items:stretch}
.appointments-filter-row{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.appointments-filter-row-scope{align-items:center}
.appointments-filter-row-commercial{align-items:flex-start}
.appointments-filter-row-period{justify-content:space-between}
.appointments-filter-row-period .form-control{min-width:220px}
.appointments-filters-actions{margin-left:0}
.appointments-list{padding:16px}
.appointments-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.appointments-row-actions{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.appointments-mobile-list{display:none}
.appointments-rdv-card{padding:12px;border:1px solid var(--border);border-radius:12px;background:#fff;display:flex;flex-direction:column;gap:8px}
.appointments-rdv-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.appointments-rdv-id{font-size:.75rem;text-transform:uppercase;letter-spacing:.08em;color:#64748b;font-weight:700}
.appointments-rdv-date{font-size:.85rem;color:#334155;font-weight:600}
.appointments-rdv-main{font-weight:700;color:#0f172a}
.appointments-rdv-sub{font-size:.9rem;color:#64748b}
.appointments-tabs{padding:16px}
.appointments-tabs .tabs{margin:0}
.form-card{display:flex;flex-direction:column;gap:24px}
.avant-card{display:flex;flex-direction:column;gap:14px}
.avant-header{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;padding-bottom:10px;border-bottom:1px solid var(--border)}
.avant-header-text{display:flex;flex-direction:column;gap:4px}
.avant-picker{min-width:240px;display:flex;flex-direction:column;gap:6px}
.avant-list{display:flex;flex-direction:column;gap:10px}
.avant-item{border:1px solid var(--border);background:var(--surface-alt)}
.avant-details summary{list-style:none}
.avant-summary{display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer}
.avant-summary::-webkit-details-marker{display:none}
.avant-title{font-weight:700}
.avant-fields{padding:10px 6px}
.avant-details[open] .avant-summary{margin-bottom:6px}
.form-section{padding:18px;border:1px solid #eef2f7;border-radius:16px;background:linear-gradient(180deg,#fff,#fbfdff)}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:14px}
.section-head h3{margin:0;font-size:1.15rem}
.section-head p{margin:0;color:var(--muted);font-size:.9rem}
.section-body{display:block}
.subsection{margin-top:10px;padding:14px;border:1px dashed #e2e8f0;border-radius:14px;background:#f8fafc}
.subsection-head{font-size:.75rem;text-transform:uppercase;letter-spacing:.12em;color:#64748b;margin-bottom:10px}
.form-columns{display:grid;grid-template-columns:1.2fr .8fr;gap:18px;align-items:start}
.client-mode-radios{display:flex;gap:8px;flex-wrap:wrap}
.client-mode-pill{margin:0;cursor:pointer}
.client-mode-pill input{position:absolute;opacity:0;pointer-events:none}
.client-mode-pill span{display:inline-flex;align-items:center;justify-content:center;min-width:120px;padding:10px 14px;border-radius:10px;border:1px solid #dbe2ea;background:#fff;color:#334155;font-weight:700}
.client-mode-pill input:checked + span{border-color:var(--brand-blue);background:#eff6ff;color:#1d4ed8;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.client-mode-pill.is-selected span{border-color:var(--brand-blue);background:#eff6ff;color:#1d4ed8;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.client-mode-select{display:none}
.avant-select-radios .client-mode-pill span{min-width:84px;padding:8px 10px;font-weight:600}
.avant-select-none{display:none}
.note-images-card{display:flex;flex-direction:column;gap:14px}
.note-images-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.note-images-actions{display:flex;align-items:center;gap:8px}
.media-qr-card{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.media-qr-modal-content{min-width:0;width:min(420px,92vw)}
.media-qr-body{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center}
.media-qr-image{width:min(240px,70vw);height:auto;border:1px solid var(--border);border-radius:12px;background:#fff;padding:10px}
.note-images-upload-input{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}
.note-images-existing{display:flex;flex-direction:column;gap:10px}
.note-images-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,160px));gap:10px;justify-content:flex-start}
.note-image-item{margin:0;display:flex;flex-direction:column;gap:6px;max-width:160px}
.note-image-preview-btn{padding:0;border:1px solid var(--border);background:#fff;border-radius:12px;overflow:hidden;cursor:pointer}
.note-image-item img{width:100%;height:100px;object-fit:cover;display:block}
.note-image-meta{display:flex;flex-direction:column;gap:6px}
.note-image-meta .btn{width:100%}
.note-image-comment-input{font-size:.8rem;padding:6px 8px}
.note-image-item figcaption{font-size:.82rem;color:#475569;line-height:1.35}
.appointment-docs-card{display:flex;flex-direction:column;gap:12px}
.appointment-docs-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.appointment-docs-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.appointment-docs-actions .form-control{min-width:220px}
.appointment-docs-list{display:flex;flex-direction:column;gap:8px}
.appointment-doc-row{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--border);border-radius:10px;padding:8px 10px;background:#fff}
.appointment-doc-title{font-weight:600;color:#334155;word-break:break-word}
.appointment-doc-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.note-preview-modal{position:fixed;inset:0;z-index:1400;display:flex;align-items:center;justify-content:center;padding:16px}
.note-preview-modal.hidden{display:none}
.note-preview-overlay{position:absolute;inset:0;background:rgba(15,23,42,.58)}
.note-preview-content{position:relative;z-index:1;max-width:min(96vw,860px);width:100%;padding:12px;display:flex;flex-direction:column;gap:10px}
.note-preview-close{align-self:flex-end}
.note-preview-content img{width:100%;max-height:70vh;object-fit:contain;border-radius:10px;background:#0f172a}
.note-preview-actions{display:flex;justify-content:flex-end}

/* ---------- Business followup page ---------- */
.business-page{display:flex;flex-direction:column;gap:18px}
.business-hero{display:flex;justify-content:space-between;gap:20px;padding:22px;position:relative;overflow:hidden;background:linear-gradient(135deg,#f0f9ff,#ecfccb);border:1px solid #f1f5f9}
.business-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.business-title{margin:6px 0 4px;font-size:1.8rem}
.business-subtitle{margin:0;color:#475569}
.business-selected{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:10px}
.business-tags{font-weight:600;color:#0f172a}
.business-period{min-width:220px;background:#fff;border:1px solid var(--border);border-radius:14px;padding:12px 14px}
.business-period-label{text-transform:uppercase;letter-spacing:.14em;font-size:.7rem;color:#64748b}
.business-period-range{font-weight:700;margin-top:6px}
.business-filters{padding:16px}
.business-filters-grid{display:grid;grid-template-columns:minmax(260px,1.4fr) minmax(240px,1fr);gap:16px;align-items:start}
.business-filter{display:flex;flex-direction:column;gap:10px}
.business-filter-head{display:flex;flex-direction:column;gap:4px}
.dashboard-admin-filters{display:flex;flex-direction:column;gap:12px;padding-top:16px}
.dashboard-admin-scope{display:flex;gap:8px;flex-wrap:wrap}
.dashboard-commercial-filter{display:block}
.client-mode-pill-btn{display:inline-flex;align-items:center;justify-content:center;min-width:120px;padding:10px 14px;border-radius:10px;border:1px solid #dbe2ea;background:#fff;color:#334155;font-weight:700;cursor:pointer}
.client-mode-pill-btn.is-selected{border-color:var(--brand-blue);background:#eff6ff;color:#1d4ed8;box-shadow:0 0 0 3px rgba(37,99,235,.14)}
.business-sources{display:flex;flex-direction:column;gap:10px}
.source-subfilters{display:flex;gap:10px;flex-wrap:wrap}
.dropdown{position:relative;display:inline-block}
.dropdown[open] .dropdown-toggle{background:#e2e8f0}
.dropdown-toggle{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:10px;border:1px solid #e2e8f0;background:#f8fafc;font-weight:600;cursor:pointer;list-style:none}
.dropdown-toggle::-webkit-details-marker{display:none}
.dropdown-menu{position:absolute;z-index:10;min-width:240px;max-height:260px;overflow:auto;margin-top:6px;padding:10px;border:1px solid #e2e8f0;border-radius:12px;background:#fff;box-shadow:0 12px 30px rgba(15,23,42,.12)}
.dropdown-item{display:flex;align-items:center;gap:8px;padding:6px 4px;font-weight:600;color:#1e293b}
.sub-dropdown{min-width:260px}
.sub-dropdown .dropdown-menu{position:static;box-shadow:none;border:none;padding:0;margin-top:8px}
.business-pill{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;border:1px solid #dbeafe;background:#eff6ff;font-size:.85rem;font-weight:600;color:#1e3a8a}
.business-pill input{margin:0}
.business-pill.radio{background:#f1f5f9;border-color:#e2e8f0;color:#334155}
.business-period-options{display:flex;flex-wrap:wrap;gap:8px}
.business-custom-range{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.business-filter-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end;grid-column:1 / -1}
.business-metrics{padding:16px;display:flex;flex-direction:column;gap:12px}
.business-metrics-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.business-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px;align-items:start}
@media (min-width: 980px){
  .business-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
.business-table{padding:16px}
.business-table-head{margin-bottom:10px}

/* ---------- Sources page ---------- */
.sources-page{display:flex;flex-direction:column;gap:18px}
.sources-hero{display:flex;justify-content:space-between;gap:20px;padding:20px;position:relative;overflow:hidden;background:linear-gradient(135deg,#eef2ff,#f0fdf4);border:1px solid #f1f5f9}
.sources-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.sources-title{margin:6px 0 4px;font-size:1.8rem}
.sources-subtitle{margin:0;color:#475569}
.sources-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px}
@media (min-width: 1100px){
  .sources-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
.sources-panel{padding:16px;display:flex;flex-direction:column;gap:14px}
.sources-panel-head{display:flex;flex-direction:column;gap:4px}
.sources-form{display:flex;flex-direction:column;gap:10px}
.sources-list{display:flex;flex-direction:column;gap:10px}
.sources-item{display:flex;flex-direction:column;gap:8px;padding:12px;border:1px solid var(--border);border-radius:12px;background:#fff}
.sources-item--inactive{background:repeating-linear-gradient(135deg,#f8fafc,#f8fafc 12px,#f1f5f9 12px,#f1f5f9 24px);border-color:#e2e8f0}
.sources-item-name{font-weight:600;color:#334155;padding:6px 2px}
.sources-unified-form{padding:16px}
.sources-unified-grid{display:grid;grid-template-columns:1fr 1.2fr auto;gap:12px;align-items:end}
.sources-unified-actions{display:flex;justify-content:flex-end}
@media (max-width: 900px){
  .sources-unified-grid{grid-template-columns:1fr}
  .sources-unified-actions{justify-content:flex-start}
}
.sources-toggle{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600}
.sources-actions{display:flex;gap:8px;flex-wrap:wrap}

/* ---------- Source profile ---------- */
.source-profile{display:flex;flex-direction:column;gap:18px}
.source-profile-hero{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}
.source-profile-panel{padding:16px;display:flex;flex-direction:column;gap:14px}
.source-profile-filter{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;align-items:end}
.source-profile-filter-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.source-profile-period-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.source-profile-overview{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
.source-profile-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.source-profile-tab-btn.is-active{background:#1e293b;color:#fff;border-color:#1e293b}
@media (max-width: 900px){
  .source-profile-hero{flex-direction:column;align-items:stretch}
  .source-profile-hero .dashboard-hero-metrics{justify-content:flex-start}
}
@media (max-width: 900px){
  .note-images-head{align-items:stretch}
  .note-images-actions{width:100%}
  .note-images-actions .btn{width:100%}
  .note-images-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .note-image-item{max-width:none}
  .note-image-item img{height:110px}
  .appointment-docs-head{align-items:stretch}
  .appointment-docs-actions{width:100%}
  .appointment-docs-actions .form-control{min-width:0;width:100%}
  .appointment-docs-actions .btn{width:100%}
  .appointment-doc-row{flex-direction:column;align-items:flex-start}
  .appointment-doc-actions{width:100%}
  .appointment-doc-actions .btn{flex:1 1 0}
}
.status-badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.status-badge.active{background:#dcfce7;color:#166534;border:1px solid #86efac}
.status-badge.inactive{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}

slot-selected-meta{display:flex;flex-wrap:wrap;gap:14px;margin:6px 0 10px;color:var(--text)}
.slot-selected-meta strong{font-weight:600}
.slot-selected-meta span{color:var(--text-muted)}
.slot-grid .slot-table{width:100%;border-collapse:separate;border-spacing:8px}
.slot-compare-wrap{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:start}
.slot-compare-col{min-width:0}
.slot-compare-head{font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#334155;margin:0 0 6px 8px}
.slot-grid th{font-size:.75rem;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);text-align:center;padding:4px 6px}
.slot-grid th:first-child{text-align:left}
.slot-grid .slot-cell{position:relative;text-align:center;padding:8px 10px;border-radius:12px;border:1px solid #e2e8f0;background:#f8fafc;font-weight:600;color:#1f2937;transition:transform .15s ease,box-shadow .15s ease,background .15s ease,border-color .15s ease}
.slot-grid td:first-child.slot-cell{background:var(--brand-blue);color:#f8fafc;border-color:var(--brand-blue);font-weight:700}
.slot-grid .slot-available{background:#dcfce7;border-color:#86efac;color:#166534;cursor:pointer}
.slot-grid .slot-available:hover{transform:translateY(-1px);box-shadow:0 6px 18px rgba(22,101,52,.18)}
.slot-grid .slot-busy{background:#fee2e2;border-color:#fecaca;color:#991b1b}
.slot-grid .slot-past{background:#e2e8f0;border-color:#cbd5e1;color:transparent}
.slot-grid .slot-selected{outline:2px solid var(--brand-blue);box-shadow:0 0 0 4px rgba(37,99,235,.12)}
@media (max-width: 1100px){
  .compare-desktop-only{display:none !important}
}
@media (max-width: 1100px){
  .slot-compare-wrap{grid-template-columns:1fr}
}

/* ---------- Clients pages ---------- */
.clients-page{display:flex;flex-direction:column;gap:18px}
.clients-hero{display:flex;justify-content:space-between;gap:20px;padding:22px;position:relative;overflow:hidden;background:linear-gradient(135deg,#fef9c3,#e0f2fe);border:1px solid #f1f5f9}
.clients-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.clients-title{margin:6px 0 4px;font-size:1.8rem}
.clients-subtitle{margin:0;color:#475569}
.clients-hero-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.clients-filters{padding:16px}

/* ---------- Tickets ---------- */
.tickets-page{display:flex;flex-direction:column;gap:16px}
.tickets-hero{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding:20px;background:linear-gradient(135deg,#f8fafc,#ecfeff);border:1px solid #e2e8f0}
.tickets-kicker{text-transform:uppercase;letter-spacing:.16em;font-size:.72rem;color:#64748b}
.tickets-title{margin:6px 0 4px;font-size:1.7rem}
.tickets-subtitle{margin:0;color:#475569}
.tickets-grid{display:grid;grid-template-columns:1.2fr .8fr;gap:14px}
.tickets-attachments{display:flex;flex-direction:column;gap:8px}
.tickets-attachment{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px;border:1px solid var(--border);border-radius:10px;background:#fff}
.tickets-history{display:flex;flex-direction:column;gap:10px}
.tickets-history-item{border:1px solid var(--border);border-radius:10px;padding:10px;background:#fff}
.tickets-history-head{display:flex;justify-content:space-between;gap:8px;align-items:center}
.tickets-history-body{margin-top:6px;color:#334155}
@media (max-width: 980px){
  .tickets-grid{grid-template-columns:1fr}
  .tickets-hero{flex-direction:column}
}
.clients-filters-form{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.clients-filters-actions{margin-left:auto}
.clients-list{padding:16px}
.clients-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.clients-form{padding:16px;display:flex;flex-direction:column;gap:12px}

/* ---------- Categories page ---------- */
.categories-page{display:flex;flex-direction:column;gap:18px}
.categories-hero{display:flex;justify-content:space-between;gap:20px;padding:22px;position:relative;overflow:hidden;background:linear-gradient(135deg,#fef3c7,#e0e7ff);border:1px solid #f1f5f9}
.categories-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.categories-title{margin:6px 0 4px;font-size:1.8rem}
.categories-subtitle{margin:0;color:#475569}
.categories-hero-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.categories-grid{display:grid;grid-template-columns:minmax(260px,360px) minmax(0,1fr);gap:18px;align-items:start}
.categories-panel{padding:16px;display:flex;flex-direction:column;gap:12px}
.categories-panel-head{display:flex;flex-direction:column;gap:4px;margin-bottom:12px}
.categories-form{display:flex;flex-direction:column;gap:12px}
.categories-toggle{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:600}
.categories-list{padding:16px;display:flex;flex-direction:column;gap:12px}
.categories-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px}

/* ---------- Search page ---------- */
.search-page{display:flex;flex-direction:column;gap:18px}
.search-hero{display:flex;justify-content:space-between;gap:20px;padding:20px;position:relative;overflow:hidden;background:linear-gradient(135deg,#eef2ff,#f0fdf4);border:1px solid #f1f5f9}
.search-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#64748b}
.search-title{margin:6px 0 4px;font-size:1.8rem}
.search-subtitle{margin:0;color:#475569}

/* ---------- Auth ---------- */
.auth-page{min-height:calc(100vh - 140px);display:flex;align-items:center;justify-content:center;padding:32px}
.auth-card{padding:28px;max-width:420px;width:100%}
.auth-head{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.auth-kicker{text-transform:uppercase;letter-spacing:.2em;font-size:.7rem;color:#94a3b8}
.auth-title{margin:0;font-size:1.6rem}
.auth-subtitle{margin:0;color:#64748b}
.auth-form{display:flex;flex-direction:column;gap:12px}

/* ---------- Progress / KPI ---------- */
.progress{height:10px;background:#eef2f7;border-radius:20px;overflow:hidden; border: solid 1px #d3d3d3;
}
.progress .bar{height:10px;background:#4ade80}
.kpi-title{margin-bottom:20px}
.kpi-sub{margin-bottom:10px}

/* ---------- Modal ---------- */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.35)}
.modal.hidden{display:none}
.modal-content{background:#fff;border-radius:12px;min-width:760px;max-height:80vh;overflow:auto;border:1px solid var(--border)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
.modal-body{padding:12px 16px}
.export-modal .modal-content{
  min-width:0;
  width:min(760px,92vw);
  background:linear-gradient(180deg,#ffffff,#f8fafc);
}
.export-modal-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.export-modal-nav{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 14px}
.export-modal-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-top:6px}

/* ---------- Utilities ---------- */
.text-center{text-align:center}.text-right{text-align:right}
.float-right{float:right}.float-left{float:left}
.hidden{display:none}
hr{border:0;border-top:1px solid var(--border);margin:12px 0}

@media (max-width: 720px){
  .container,.container-fluid{padding:16px}
  .app-content{padding-bottom: calc(16px + 60px);}
  .app-shell{flex-direction:column}
  .sidebar{
    position:fixed;left:0;top:0;bottom:0;transform:translateX(-100%);
    z-index:1200;box-shadow:0 20px 40px rgba(15,23,42,.2);padding-bottom: calc(16px + 50px);
  }
  .sidebar-close{display:inline-flex}
  .sidebar-overlay{z-index:1100}
  body.sidebar-open .sidebar{transform:translateX(0)}
  .sidebar-toggle{display:inline-flex}
  .topbar{flex-wrap:wrap}
  .topbar:before{top:calc(124px - 3px)}
  .topbar-actions{justify-content:flex-end}
  .topbar-quick-actions{display:inline-flex}
  .topbar-notifs[open] .notif-dropdown{
    position:fixed;
    left:12px;
    right:12px;
    top:68px;
    min-width:0;
    max-width:none;
    max-height:calc(100vh - 84px);
    overflow:auto;
    z-index:2300;
  }
  .topbar-notifs[open] .notif-list{
    max-height:calc(100vh - 220px);
    overflow:auto;
    padding-right:2px;
  }
  .topbar-notifs[open] .notif-item{
    padding:12px;
  }
  .topbar-notifs[open] .export-modal-actions{
    position:sticky;
    bottom:0;
    background:#fff;
    padding-top:8px;
    border-top:1px solid var(--border);
  }
  .topbar-notifs[open] .export-modal-actions .btn{
    width:100%;
    min-height:42px;
  }
  .nav-search{order:2;width:100%;flex:1 1 100%;max-width:none}
  .nav-search .form-control{width:100%}
  .account-name{display:none}
  .search-head{flex-direction:column;align-items:stretch}
  .search-inline{width:100%}
  .row{flex-direction:column;margin-left:0;margin-right:0}
  [class^="col-"],[class*=" col-"]{padding-left:0;padding-right:0;width:100%;flex:0 0 100%}
  .d-flex.align-end{align-items:stretch}
  .table-tools{flex-direction:row;align-items:center;flex-wrap:nowrap}
  .table-tools .table-search{flex:1 1 auto;max-width:none;min-width:0}
  .table-tools .table-search .form-control{width:100%}
  .table-tools .table-size{flex:0 0 auto;margin-left:0}
  .table-tools .table-size .form-control{width:auto;min-width:108px}
  .table-pager{gap:6px}
  .modal-content{min-width:0;width:92vw}
  .users-hero{flex-direction:column}
  .users-hero-metrics{flex-wrap:wrap;justify-content:flex-start}
  .users-grid{grid-template-columns:1fr}
  .users-form-grid{grid-template-columns:1fr}
  .profile-grid{grid-template-columns:1fr}
  .profile-hero{align-items:flex-start}
  .profile-hero-aside{width:100%}
  .profile-actions{justify-content:stretch}
  .profile-actions .btn{width:100%}
  .user-card-body{grid-template-columns:1fr}
  .user-agenda-form{grid-template-columns:1fr}
  .users-list-head{flex-direction:column;align-items:flex-start}
  .users-filters{width:100%;flex-direction:column}
  .users-filters .form-control{width:100%}
  .products-hero{flex-direction:column}
  .products-grid{grid-template-columns:1fr}
  .products-filters{width:100%;flex-direction:column}
  .products-filters .form-control{width:100%}
  .categories-head{flex-direction:column;align-items:flex-start}
  .templates-hero{flex-direction:column}
  .templates-grid{grid-template-columns:1fr}
  .templates-filters{width:100%;flex-direction:column}
  .templates-filters .form-control{width:100%}
  .dashboard-hero{flex-direction:column}
  .dashboard-metric-rdv-mobile{display:block}
  .dashboard-grid{grid-template-columns:1fr}
  .dashboard-shortcuts{display:none}
  .dashboard-list-head{flex-direction:column;align-items:flex-start}
  .dashboard-list .table th:first-child,
  .dashboard-list .table td:first-child{display:none}
  .dashboard-list .table-tools,
  .dashboard-list .table-pager{display:none}
  .dashboard-list .table-wrap{display:none}
  .dashboard-mobile-search{display:block}
  .dashboard-mobile-list{display:flex;flex-direction:column;gap:10px}
  .dashboard-mobile-main-actions{
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(0,1fr);
    gap:8px;
  }
  .dashboard-mobile-main-actions .dashboard-inline-form{display:block}
  .dashboard-mobile-main-actions .dashboard-mobile-action{
    width:100%;
    min-height:44px;
    padding:10px 8px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    white-space:normal;
    line-height:1.15;
    font-size:.82rem;
  }
  .dashboard-list-actions,
  .dashboard-row-actions,
  .appointments-row-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .business-hero{flex-direction:column}
  .business-period{width:100%}
  .business-filters-grid{grid-template-columns:1fr}
  .business-sources .dropdown,
  .business-sources .sub-dropdown{width:100%;min-width:0}
  .business-sources .dropdown-toggle{width:100%;justify-content:space-between}
  .source-subfilters{flex-direction:column;gap:8px}
  .business-sources .dropdown-menu{
    position:static;
    min-width:0;
    width:100%;
    max-width:100%;
    box-shadow:none;
    margin-top:8px;
  }
  .business-period-options{display:grid;grid-template-columns:1fr;gap:8px}
  .business-custom-range{grid-template-columns:1fr}
  .business-filter-actions{justify-content:flex-start}
  .business-filter-actions .btn{width:100%}
  .business-metrics-head{flex-direction:column;align-items:flex-start}
  .business-metrics .dashboard-hero-metrics{display:grid;grid-template-columns:1fr;gap:10px}
  .business-table{padding:12px}
  .business-table .table-wrap{margin:0}
  .business-table .table{min-width:0}
  .business-responsive-table{
    width:100%;
    table-layout:fixed;
    font-size:.78rem;
    line-height:1.25;
  }
  .business-responsive-table th,
  .business-responsive-table td{
    padding:7px 4px;
    white-space:normal;
    word-break:break-word;
    overflow-wrap:anywhere;
    hyphens:auto;
    vertical-align:top;
  }
  .business-responsive-table th{font-size:.68rem}
  .business-responsive-table th.text-end,
  .business-responsive-table td.text-end{text-align:right}
  .business-responsive-table td[data-label]::before{content:none}
  .business-responsive-table tbody tr.empty-row td{
    text-align:left !important;
  }
  .business-sales-user-table thead{display:none}
  .business-sales-user-table tbody,
  .business-sales-user-table tr,
  .business-sales-user-table td{display:block;width:100%}
  .business-sales-user-table tbody tr{
    padding:12px;
    border:1px solid var(--border);
    border-radius:12px;
    background:#fff;
    margin-bottom:10px;
  }
  .business-sales-user-table tbody tr:last-child{margin-bottom:0}
  .business-sales-user-table tbody tr.empty-row{
    padding:0;
    border:none;
    background:transparent;
  }
  .business-sales-user-table tbody tr.empty-row td{
    padding:0;
  }
  .business-sales-user-table td{
    padding:0;
    text-align:left !important;
    overflow-wrap:normal;
    word-break:normal;
  }
  .business-sales-user-table td[data-label]{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding-top:8px;
  }
  .business-sales-user-table td[data-label]::before{
    content:attr(data-label);
    display:block;
    min-width:110px;
    color:#64748b;
    font-size:.72rem;
    font-weight:700;
    letter-spacing:.02em;
    text-transform:uppercase;
  }
  .business-sales-user-table td[data-label="Commercial"]{
    display:block;
    padding-top:0;
    margin-bottom:8px;
    font-size:.98rem;
    font-weight:700;
    color:#0f172a;
  }
  .business-sales-user-table td[data-label="Commercial"]::before{
    content:none;
  }
  .business-table .business-responsive-table th:nth-child(1),
  .business-table .business-responsive-table td:nth-child(1){width:62%}
  .business-table .business-responsive-table th:nth-child(2),
  .business-table .business-responsive-table td:nth-child(2){width:38%}
  .business-table:nth-child(3) .business-responsive-table th:nth-child(1),
  .business-table:nth-child(3) .business-responsive-table td:nth-child(1){width:40%}
  .business-table:nth-child(3) .business-responsive-table th:nth-child(2),
  .business-table:nth-child(3) .business-responsive-table td:nth-child(2){width:30%}
  .business-table:nth-child(3) .business-responsive-table th:nth-child(3),
  .business-table:nth-child(3) .business-responsive-table td:nth-child(3){width:30%}
  .business-grid{grid-template-columns:1fr}
  .appointments-hero{flex-direction:column}
  .appointments-filters-form{flex-direction:column;align-items:stretch}
  .appointments-filters-actions{margin-left:0}
  .appointments-upcoming-list .table-wrap{display:none}
  .appointments-upcoming-list .appointments-mobile-list{display:flex;flex-direction:column;gap:10px}
  .appointments-mobile-actions-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
  }
  .appointments-mobile-actions-grid .btn{
    width:100%;
    min-height:44px;
    padding:10px 8px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    white-space:normal;
    line-height:1.15;
    font-size:.82rem;
  }
  .appointments-mobile-actions-grid .badge{
    width:100%;
    min-height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .appointments-page.form-page .section-head{display:none}
  .appointments-page.form-page .avant-header .avant-header-text{display:none}
  .appointments-page.form-page input[type="date"],
  .appointments-page.form-page input[type="time"]{
    display:block;
    width:100%;
    max-width:100%;
    min-width:0;
    box-sizing:border-box;
  }
  .form-columns{grid-template-columns:1fr}
  .client-mode-radios{display:flex}
  .client-mode-select{display:none}
  .slot-grid{overflow-x:auto}
  .slot-grid .slot-table{border-spacing:6px;min-width:680px}
  .slot-grid th{font-size:.7rem;letter-spacing:.06em}
  .slot-grid .slot-cell{padding:10px 8px;font-size:.8rem}
  .slot-grid td:first-child.slot-cell{position:sticky;left:0;z-index:1}
  .avant-header{align-items:flex-start}
  .avant-summary{flex-direction:column;align-items:flex-start}
  .clients-hero{flex-direction:column}
  .clients-filters-form{flex-direction:column;align-items:stretch}
  .clients-filters-actions{margin-left:0}
  .categories-hero{flex-direction:column}
  .categories-grid{grid-template-columns:1fr}
  .search-hero{flex-direction:column}
  .auth-page{padding:20px}
  .task-dock{right:10px;bottom:10px;left:10px;width:calc(100% - 20px);border-radius: 24px;box-shadow:none}
  .task-dock summary{border-radius:0}
  .task-dock[open]{position:fixed;inset:0;z-index:2101;background:#fff;overflow:auto;width:100%}
  .task-dock[open] summary{position:sticky;top:0;background:#fff;z-index:2001}
  .task-dock-body{max-height:none;overflow:hidden;height: calc(100vh - 51.41px);}
  .chat-layout{flex-direction:column}
  .chat-sidebar{border:0;padding:0;}
  .chat-expand{display:none}
  .chat-main{border:0px}
  .chat-channel-item.active{background:none;border:none;}
  .chat-channel-item.active .chat-channel-top{color: var(--text);}
  .chat-channel-item.active .chat-preview{color: #64748b;}
  .task-panel[data-panel="chat"] {padding:0}
  .hide-mobile{display:none !important}
}

/* Keep mobile search hidden on desktop/laptop */
@media (max-width: 720px) and (hover: hover) and (pointer: fine){
  .dashboard-page .dashboard-mobile-search{display:none !important;}
}

.offline-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  padding: 10px 14px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

.offline-banner.hidden {
  display: none;
}

.chat-status.pending {
  opacity: 0.6;
}

.offline-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1200;
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  display: flex;
  gap: 8px;
  align-items: center;
}

.offline-panel.hidden {
  display: none;
}

.offline-panel strong {
  font-weight: 700;
}

.offline-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.offline-modal.hidden {
  display: none;
}

.offline-modal-content {
  width: min(640px, 100%);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.offline-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.offline-modal-body {
  padding: 12px 16px 16px;
}

.offline-empty {
  color: #64748b;
  font-size: 13px;
}

.offline-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offline-list li {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
}

.offline-method {
  font-weight: 700;
  color: #0f172a;
}

.offline-path {
  color: #0f172a;
  word-break: break-all;
}

.offline-time {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .offline-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .offline-time {
    white-space: normal;
  }
}

.row-pending {
  background: #fff7ed;
}


/* ---------- Sources page (status badge) ---------- */
.status-badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.status-badge.active{background:#dcfce7;color:#166534;border:1px solid #86efac}
.status-badge.inactive{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
