
/* 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 (theme) ---------- */
:root{
  --bg:#f5f6fa; --surface:#ffffff; --border:#e5e7eb;
  --text:#1f2937; --muted:#6b7280;
  --primary:#0d6efd; --primary-contrast:#ffffff;
  --success:#16a34a; --success-contrast:#ffffff;
  --warning:#f59e0b; --warning-contrast:#111827;
  --danger:#dc2626;  --danger-contrast:#ffffff;
  --info:#0ea5e9;    --info-contrast:#ffffff;
  --nav:#0f172a; --nav-hover:#1f2937;
}

/* ---------- Reset / base ---------- */
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,'Helvetica Neue',Arial,sans-serif;color:var(--text);background:var(--bg)}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;height:auto}

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

.header,.topbar,.navbar,.topnav{
  display:flex;align-items:center;gap:12px;
  background:var(--nav);color:#fff;padding:10px 16px;position:relative;z-index:2101;
}
.nav-title{font-weight:800;letter-spacing:.18em;font-size:.85rem}
.nav-toggle{
  display:none;flex:0 0 auto;border:1px solid var(--nav-hover);
  background:transparent;color:#fff;border-radius:10px;padding:6px 8px;margin-left:auto;
  position:relative;z-index:2102;
}
.nav-toggle span{display:block;width:18px;height:2px;background:#fff;margin:3px 0}
.nav-toggle{flex-direction:column}
.nav-links{display:flex;align-items:center;gap:10px;flex:1 1 auto;flex-wrap:nowrap}
.nav-link{color:#fff;padding:8px 10px;border-radius:10px;text-decoration:none;font-size:.95rem}
.nav-link:hover{background:var(--nav-hover)}
.nav-search{display:flex;align-items:center;gap:6px;flex:0 0 260px;margin-left:8px;position:relative}
.nav-search .form-control{width:100%;min-width:160px;padding:6px 10px;border-radius:8px;border:1px solid rgba(255,255,255,.25);background:#fff}
.nav-search-btn{
  background:linear-gradient(135deg,#0f172a,#1f2937);
  border:1px solid rgba(255,255,255,.2);
  color:#fff;
  padding:6px 10px;
  border-radius:999px;
  box-shadow:0 6px 14px rgba(0,0,0,.18), inset 0 0 0 1px rgba(255,255,255,.06);
  transition:transform .08s ease, box-shadow .2s ease, filter .2s ease;
}
.nav-search-btn:hover{
  filter:brightness(1.05);
  box-shadow:0 8px 18px rgba(0,0,0,.22), inset 0 0 0 1px rgba(255,255,255,.1);
}
.nav-search-btn:active{
  transform:translateY(1px);
  box-shadow:0 4px 10px rgba(0,0,0,.18), inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-search-suggest{
  position:absolute;top:calc(100% + 6px);left:0;right:0;
  background:#fff;border:1px solid var(--border);border-radius:10px;
  box-shadow:0 14px 32px rgba(0,0,0,.18);padding:6px;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:#64748b;
  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:6px 8px;border-radius:8px;
  color:var(--text);text-decoration:none;
}
.nav-search-suggest .suggest-item:hover{background:#f1f5f9}
.nav-search-suggest .suggest-title{font-weight:600;font-size:.92rem}
.nav-search-suggest .suggest-sub{font-size:.8rem;color:#64748b}
.nav-search-suggest .suggest-action{
  background:linear-gradient(135deg,#eef2ff,#f0fdf4);
  border:1px solid #e2e8f0;
}
.nav-group{position:relative}
.nav-group summary{
  list-style:none;cursor:pointer;color:#fff;padding:8px 10px;border-radius:10px;
  font-size:.95rem;
}
.nav-group summary::-webkit-details-marker{display:none}
.nav-group[open] > summary{background:var(--nav-hover)}
.nav-dropdown{
  position:absolute;top:calc(100% + 6px);left:0;min-width:210px;
  background:#fff;border:1px solid var(--border);border-radius:12px;padding:6px;
  box-shadow:0 12px 30px rgba(0,0,0,.18);display:none;
}
.nav-links > .nav-group:last-of-type .nav-dropdown,
.nav-account .nav-dropdown{left:auto;right:0}
.nav-group[open] .nav-dropdown{display:block}
.nav-dropdown a{
  display:block;padding:8px 10px;border-radius:8px;color:var(--text);text-decoration:none;
}
.nav-dropdown a:hover{background:#f1f5f9}
.nav-account{margin-left:auto}
.nav-needs-toggle.nav-open .nav-account{margin-left:0}
.nav-needs-toggle .nav-toggle{display:flex}
.nav-needs-toggle .nav-links{display:none;flex:1 1 100%}
.nav-needs-toggle.nav-open .nav-links{
  position:fixed;inset:0;z-index:2000;background:rgba(15,23,42,.98);
  padding:10px 16px 16px;display:flex;flex-direction:column;align-items:stretch;
  gap:10px;overflow:auto;
}
.nav-close{
  display:none;align-self:flex-end;border:1px solid rgba(255,255,255,0.25);
  background:transparent;color:#fff;border-radius:10px;padding:6px 10px;font-size:1rem;
}
.nav-needs-toggle.nav-open .nav-close{display:inline-flex}
.nav-needs-toggle.nav-open .nav-link,
.nav-needs-toggle.nav-open .nav-group summary{
  background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.15);
  font-size:1.05rem;
}
.nav-needs-toggle.nav-open .nav-dropdown{
  position:static;display:block;background:transparent;border:none;box-shadow:none;
  padding:6px 0 0 12px;
}
.nav-needs-toggle.nav-open .nav-dropdown a{color:#fff;padding:6px 0}

/* ---------- Cards / panels ---------- */
.card,.panel,.box{
  background:var(--surface);border:1px solid var(--border);border-radius:12px;
}
.card-header,.panel-heading{padding:12px 16px;border-bottom:1px solid var(--border);font-weight:600}
.card-body,.panel-body{padding:16px}
.card-footer,.panel-footer{padding:12px 16px;border-top:1px solid var(--border);background:#fafafa}
.shadow-sm{box-shadow:0 1px 2px rgba(0,0,0,.04)}
.shadow{box-shadow:0 8px 24px rgba(0,0,0,.08)}

/* ---------- 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}
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:8px 10px;border:1px solid #d1d5db;border-radius:8px;background:#fff;color:var(--text);
}
textarea{min-height:100px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:none;border-color:#93c5fd;box-shadow:0 0 0 3px rgba(59,130,246,.15)}
.help-text,.form-text{color:var(--muted);font-size:.875rem;margin-top:4px}

/* ---------- Buttons ---------- */
.btn{display:inline-block;padding:8px 12px;border:1px solid #cbd5e1;border-radius:8px;background:#f8fafc;color:#0f172a;cursor:pointer;line-height:1}
.btn:hover{background:#eef2f7}
.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-primary{background:var(--primary);border-color:var(--primary);color:var(--primary-contrast)}
.btn-primary:hover{filter:brightness(.95)}
.btn-success{background:var(--success);border-color:var(--success);color:var(--success-contrast)}
.btn-success:hover{filter:brightness(.95)}
.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:none;flex:1 1 auto;overflow:hidden;min-height:0}
.chat-expanded .task-panel[data-panel="chat"].active{flex:1 1 auto}
.chat-expanded .chat-main{min-height:0; height: 620px}
.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}
.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 140px;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-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;justify-content:space-between;padding:6px 8px;border-radius:8px;cursor:pointer}
.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}
.chat-initials{display:none;font-weight:600}
.task-dock.chat-collapsed .chat-sidebar{flex:0 0 56px}
.task-dock.chat-collapsed .chat-channel-item{padding-left:0;justify-content:right}
.task-dock.chat-collapsed .chat-label{display:none}
.task-dock.chat-collapsed .chat-initials{display:inline}
.task-dock.chat-collapsed .chat-presence{margin-left:6px;margin-right:0}
.task-dock.chat-collapsed .chat-channel-badge{margin-left:4px}
.task-dock.chat-collapsed .chat-sidebar-title{display:none}
.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}

/* ---------- 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)}}
@media (max-width: 720px){
  .toast-container{left:16px;right:16px;max-width:none}
}
.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-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-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}
.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}

/* ---------- 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-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}

/* ---------- Progress / KPI ---------- */
.progress{height:10px;background:#eef2f7;border-radius:20px;overflow:hidden}
.progress .bar{height:10px;background:#4ade80}

/* ---------- 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}

/* ---------- 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}

nav{
    position: relative;
}
nav:before, nav:after{
    content: "";
    position: absolute;
    width: 50vw;
    height: 10px;
    top: 100%;
    z-index: 0;
    pointer-events: none;
}
.topnav > *{position:relative;z-index:1}

nav:before{
    left: 0;
    background-color: #9fca00;
}
nav:after{
    right: 0;
    background-color: #1078BD;
}

@media (max-width: 720px){
  .container,.container-fluid{padding:14px}
  .topnav{flex-wrap:wrap;gap:6px}
  .nav-search{order:2;width:100%;flex:1 1 100%;margin-left:0}
  .nav-search .form-control{width:100%}
  .search-head{flex-direction:column;align-items:stretch}
  .search-inline{width:100%}
  .nav-link,.nav-group summary{font-size:1rem}
  .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:column;align-items:stretch}
  .table-tools .table-search{flex:0 1 0;max-width:none}
  .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}
  .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%}
  .task-dock{right:0;bottom:0;left:0;width:100%;border-radius:0;box-shadow:none}
  .task-dock summary{border-radius:0}
  .task-dock[open]{position:fixed;inset:0;z-index:2101;background:#fff;overflow:auto}
  .task-dock[open] summary{position:sticky;top:0;background:#fff;z-index:2001}
  .task-dock-body{max-height:none;overflow:hidden}
  .chat-layout{flex-direction:column}
  .chat-sidebar{border-left:0;border-top:1px solid var(--border);padding-left:0;padding-top:8px}
  .chat-expand{display:none}
}
