/* ═══════════════════════════════════════════════════════════
   BPOHub — Design System CSS
   Dark theme premium · DM Sans · Glassmorphism
═══════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ─────────────────────────────────────*/
:root {
  --bg:    #0f0f10; --bg2: #161618; --bg3: #1e1e21; --bg4: #26262a; --bg5: #2e2e33;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --border3: rgba(255,255,255,0.18);
  --text:  #e8e8ea; --text2: #9898a5; --text3: #5a5a68; --text4: #3a3a45;
  --accent:  #6c63ff; --accent2: #8b84ff; --accent3: #a5a0ff;
  --accent-bg: rgba(108,99,255,0.12); --accent-border: rgba(108,99,255,0.25);
  --green:   #34d399; --green-bg:  rgba(52,211,153,0.1); --green-border: rgba(52,211,153,0.25);
  --amber:   #fbbf24; --amber-bg:  rgba(251,191,36,0.1); --amber-border: rgba(251,191,36,0.25);
  --red:     #f87171; --red-bg:    rgba(248,113,113,0.1); --red-border: rgba(248,113,113,0.25);
  --blue:    #60a5fa; --blue-bg:   rgba(96,165,250,0.1); --blue-border: rgba(96,165,250,0.25);
  --pink:    #f472b6;
  --radius:    10px; --radius-sm: 6px; --radius-lg: 16px; --radius-xl: 22px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --font:  'DM Sans', -apple-system, sans-serif;
  --mono:  'DM Mono', 'Courier New', monospace;
  --sidebar-w: 220px;
  --topbar-h:  54px;
  --transition: 0.15s ease;
}

/* ── 2. Reset ─────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5; height: 100vh; overflow: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent3); }
img { max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
ul, ol { list-style: none; }

/* ── 3. Scrollbar ─────────────────────────────────────────*/
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg5); }

/* ── 4. App Shell Layout ──────────────────────────────────*/
.app-shell {
  display: flex; height: 100vh; overflow: hidden;
  animation: fadeIn 0.3s ease;
}

/* ── 5. Sidebar ───────────────────────────────────────────*/
.sidebar {
  width: var(--sidebar-w); background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
  transition: width var(--transition);
  z-index: 50;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nav-item span:not(.nav-icon) { display: none; }
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-logout { display: none; }
.sidebar.collapsed .logo span { display: none; }
.sidebar.collapsed .nav-badge { display: none; }

.logo {
  padding: 18px 16px 14px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; letter-spacing: -0.4px;
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
}
.logo-icon {
  width: 28px; height: 28px; background: var(--accent); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section {
  padding: 14px 16px 5px; font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; color: var(--text3); text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 16px;
  font-size: 13px; color: var(--text2); cursor: pointer;
  border-left: 2px solid transparent; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--accent2); background: var(--accent-bg); border-left-color: var(--accent); font-weight: 500; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center;
}
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-purple{ background: var(--accent-bg);color: var(--accent2); }

.sidebar-footer {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-user { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sidebar-user-role { font-size: 10px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.super-badge {
  display: inline-block; font-size: 8px; font-weight: 800; letter-spacing: 0.08em;
  padding: 1px 6px; border-radius: 99px;
  background: rgba(244,114,182,0.15); color: var(--pink); border: 1px solid rgba(244,114,182,0.3);
  margin-top: 2px;
}
.sidebar-logout {
  width: 100%; justify-content: center; font-size: 11px;
  color: var(--text3); padding: 5px;
}

/* ── 6. Main Area ─────────────────────────────────────────*/
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 0 20px; display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); flex-shrink: 0;
}
.topbar-title { font-size: 14px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-date { font-size: 11px; color: var(--text3); font-family: var(--mono); white-space: nowrap; }
.content { flex: 1; overflow-y: auto; padding: 20px 22px; }

/* ── 7. Buttons ───────────────────────────────────────────*/
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: transparent;
  color: var(--text2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-danger  { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-ghost   { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }
.btn-sm      { padding: 4px 9px; font-size: 11px; }
.btn-icon    { padding: 7px; border-radius: var(--radius-sm); aspect-ratio: 1; justify-content: center; position: relative; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 8. Badges inline ─────────────────────────────────────*/
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
}

/* ── 9. Cards ─────────────────────────────────────────────*/
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border2); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title  { font-size: 13px; font-weight: 600; }

/* ── 10. Metrics Grid ─────────────────────────────────────*/
.metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 18px; }
.metric {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: all var(--transition); cursor: default; position: relative; overflow: hidden;
}
.metric::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.metric-red::before    { background: var(--red); }
.metric-amber::before  { background: var(--amber); }
.metric-blue::before   { background: var(--blue); }
.metric-green::before  { background: var(--green); }
.metric:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow); }
.metric-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; font-weight: 600; }
.metric-value { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1; margin-bottom: 4px; }
.metric-red   .metric-value { color: var(--red); }
.metric-amber .metric-value { color: var(--amber); }
.metric-blue  .metric-value { color: var(--blue); }
.metric-green .metric-value { color: var(--green); }
.metric-sub   { font-size: 11px; color: var(--text3); }

/* ── 11. Grid Layouts ─────────────────────────────────────*/
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-32 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.grid-23 { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; }

/* ── 12. Tables ───────────────────────────────────────────*/
.sla-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sla-table th {
  font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600;
}
.sla-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.sla-table tr:last-child td { border-bottom: none; }
.sla-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* ── 13. AI Box ───────────────────────────────────────────*/
.ai-box {
  background: linear-gradient(135deg, rgba(108,99,255,0.1) 0%, rgba(96,165,250,0.08) 100%);
  border: 1px solid var(--accent-border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12px; color: var(--text2);
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 8px;
  animation: fadeIn 0.3s ease;
}
.ai-box:last-child { margin-bottom: 0; }
.ai-icon { color: var(--accent2); flex-shrink: 0; font-size: 15px; margin-top: 1px; }
.ai-box b { color: var(--text); }

/* ── 14. AI Chat ──────────────────────────────────────────*/
.ai-chat-wrap {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: 420px; overflow: hidden;
}
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 10px; min-height: 160px;
}
.ai-msg { display: flex; gap: 8px; align-items: flex-start; animation: fadeIn 0.25s ease; }
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.ai-msg.bot  .ai-msg-avatar { background: var(--accent-bg); color: var(--accent2); }
.ai-msg.user .ai-msg-avatar { background: var(--bg4); color: var(--text2); }
.ai-msg-bubble {
  max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 12px;
  line-height: 1.6; word-break: break-word;
}
.ai-msg.bot  .ai-msg-bubble { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 2px 12px 12px 12px; }
.ai-msg.user .ai-msg-bubble { background: var(--accent); color: #fff; border-radius: 12px 2px 12px 12px; }
.ai-chat-input-wrap {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); background: var(--bg3);
}
.ai-chat-input {
  flex: 1; background: var(--bg4); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); font-size: 12px;
  padding: 7px 10px; outline: none; transition: border-color var(--transition);
  resize: none; font-family: var(--font);
}
.ai-chat-input:focus { border-color: var(--accent); }
.ai-typing { color: var(--text3); font-size: 11px; font-style: italic; padding: 4px 8px; }

/* ── 15. Kanban Board ─────────────────────────────────────*/
.kanban { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; min-height: 500px; }
.kanban-col {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; min-height: 480px;
  display: flex; flex-direction: column; transition: border-color var(--transition);
}
.kanban-col.drag-over { border-color: var(--accent); background: rgba(108,99,255,0.04); }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kanban-col-title { font-size: 12px; font-weight: 600; }
.kanban-count {
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 99px; font-size: 10px; color: var(--text2);
  padding: 1px 8px; font-family: var(--mono);
}
.kcard {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px;
  margin-bottom: 8px; cursor: grab; transition: all var(--transition);
  user-select: none; animation: fadeIn 0.2s ease;
}
.kcard:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kcard.dragging { opacity: 0.45; cursor: grabbing; }
.kcard-title  { font-size: 12px; font-weight: 500; margin-bottom: 4px; line-height: 1.35; }
.kcard-client { font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.kcard-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.kcard-assignee { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); }
.mini-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; flex-shrink: 0;
}
.late-bar {
  background: var(--red-bg); border-left: 2px solid var(--red);
  border-radius: 3px; padding: 3px 7px; font-size: 10px; color: var(--red);
  margin-bottom: 6px; font-weight: 500;
}
.recur-badge {
  display: inline-flex; align-items: center; gap: 3px; font-size: 9px;
  padding: 1px 6px; border-radius: 99px;
  background: var(--accent-bg); color: var(--accent2); border: 1px solid var(--accent-border);
}

/* ── 16. Forms ────────────────────────────────────────────*/
.form-group  { margin-bottom: 13px; }
.form-label  { font-size: 11px; color: var(--text2); margin-bottom: 5px; display: block; font-weight: 500; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  padding: 8px 11px; outline: none; transition: border-color var(--transition);
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input.error, .form-select.error { border-color: var(--red); }
.form-textarea { resize: vertical; min-height: 70px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235a5a68' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-hint  { font-size: 10px; color: var(--text3); margin-top: 4px; }

/* ── 17. Modal ────────────────────────────────────────────*/
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 100; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); width: 560px; max-height: 88vh;
  overflow-y: auto; padding: 24px; animation: modalIn 0.22s cubic-bezier(.16,1,.3,1);
  box-shadow: var(--shadow-lg);
}
.modal-sm { width: 420px; }
.modal-lg { width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title  { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close  { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 18px; padding: 3px 7px; border-radius: 5px; transition: all var(--transition); }
.modal-close:hover { color: var(--text); background: var(--bg3); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── 18. Detail Panel (slide-in) ──────────────────────────*/
.detail-overlay { display: none; position: fixed; inset: 0; z-index: 89; background: rgba(0,0,0,0.3); }
.detail-overlay.open { display: block; }
.detail-panel {
  position: fixed; right: -440px; top: 0; bottom: 0; width: 430px;
  z-index: 90; background: var(--bg2); border-left: 1px solid var(--border2);
  overflow-y: auto; padding: 20px; transition: right 0.3s cubic-bezier(.16,1,.3,1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.detail-panel.open { right: 0; }

/* ── 19. Checklist ────────────────────────────────────────*/
.check-item {
  display: flex; align-items: center; gap: 9px; padding: 5px 0;
  font-size: 12px; cursor: pointer; border-radius: var(--radius-sm);
  transition: background var(--transition); padding: 6px 5px;
}
.check-item:hover { background: var(--bg3); }
.check-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.check-item.done span { text-decoration: line-through; color: var(--text3); }

/* ── 20. Progress Bar ─────────────────────────────────────*/
.bar-wrap { flex: 1; height: 4px; background: var(--bg4); border-radius: 99px; overflow: hidden; }
.bar      { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.pct      { font-size: 11px; color: var(--text3); min-width: 32px; text-align: right; font-family: var(--mono); }
.collab-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.collab-item:last-child { margin-bottom: 0; }

/* ── 21. Client Cards ─────────────────────────────────────*/
.client-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.client-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all var(--transition);
}
.client-card:hover { border-color: var(--border2); box-shadow: var(--shadow); transform: translateY(-2px); }
.client-logo {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; margin-bottom: 10px;
}
.client-name   { font-size: 14px; font-weight: 700; margin-bottom: 2px; letter-spacing: -0.2px; }
.client-sector { font-size: 11px; color: var(--text3); margin-bottom: 10px; }
.client-tags   { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { font-size: 10px; padding: 2px 8px; border-radius: 4px; background: var(--bg4); color: var(--text2); border: 1px solid var(--border); }
.client-stats  { display: flex; border-top: 1px solid var(--border); padding-top: 10px; }
.cstat         { flex: 1; text-align: center; }
.cstat-val     { font-size: 17px; font-weight: 700; line-height: 1; margin-bottom: 2px; }
.cstat-lbl     { font-size: 10px; color: var(--text3); }

/* ── 22. Calendar ─────────────────────────────────────────*/
.cal-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav     { display: flex; align-items: center; gap: 10px; }
.cal-nav button { background: var(--bg3); border: 1px solid var(--border2); color: var(--text); border-radius: var(--radius-sm); padding: 5px 13px; cursor: pointer; font-size: 13px; transition: background var(--transition); font-family: var(--font); }
.cal-nav button:hover { background: var(--bg4); }
.cal-month-label { font-size: 16px; font-weight: 700; min-width: 160px; text-align: center; letter-spacing: -0.3px; }
.cal-grid    { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-day-header { text-align: center; font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 0; }
.cal-day {
  min-height: 88px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px; cursor: pointer;
  transition: border-color var(--transition); position: relative;
}
.cal-day:hover    { border-color: var(--border2); }
.cal-day.today    { border-color: var(--accent); background: var(--accent-bg); }
.cal-day.other-month { opacity: 0.3; }
.cal-day.has-recurring { border-color: rgba(108,99,255,0.3); }
.cal-day-num      { font-size: 11px; font-weight: 700; color: var(--text3); margin-bottom: 4px; }
.cal-day.today .cal-day-num { color: var(--accent2); }
.cal-event {
  font-size: 10px; padding: 2px 5px; border-radius: 3px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; font-weight: 500;
}
.cal-event.task-todo   { background: var(--blue-bg);  color: var(--blue);  border-left: 2px solid var(--blue); }
.cal-event.task-doing  { background: var(--amber-bg); color: var(--amber); border-left: 2px solid var(--amber); }
.cal-event.task-late   { background: var(--red-bg);   color: var(--red);   border-left: 2px solid var(--red); }
.cal-event.task-done   { background: var(--green-bg); color: var(--green); border-left: 2px solid var(--green); }
.cal-event.recur       { background: var(--accent-bg);color: var(--accent2);border-left: 2px solid var(--accent); }
.cal-more { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ── 23. Knowledge Base ───────────────────────────────────*/
.kb-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 8px;
  cursor: pointer; transition: all var(--transition); animation: fadeIn 0.2s ease;
}
.kb-item:hover { border-color: var(--border2); transform: translateX(2px); }
.kb-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kb-meta  { font-size: 11px; color: var(--text3); }

/* ── 24. Task Items ───────────────────────────────────────*/
.task-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg3); margin-bottom: 6px; cursor: pointer;
  transition: border-color var(--transition); animation: fadeIn 0.2s ease;
}
.task-item:last-child { margin-bottom: 0; }
.task-item:hover { border-color: var(--border2); }
.task-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.task-name { flex: 1; font-size: 12px; font-weight: 500; }
.task-meta { font-size: 11px; color: var(--text3); }

/* ── 25. Timer ────────────────────────────────────────────*/
.timer-wrap { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg3); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.timer-display { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--accent2); letter-spacing: 2px; min-width: 80px; }
.timer-display.running { color: var(--green); animation: pulse 2s infinite; }
.timer-btn { gap: 5px; }

/* ── 26. WhatsApp Inbox ───────────────────────────────────*/
.wa-inbox { display: flex; flex-direction: column; gap: 8px; }
.wa-message {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: all var(--transition); display: flex; gap: 12px; align-items: flex-start;
}
.wa-message:hover { border-color: var(--border2); }
.wa-message.has-task { border-color: var(--green-border); }
.wa-message.error    { border-color: var(--red-border); }
.wa-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green-bg); border: 2px solid var(--green); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.wa-info   { flex: 1; min-width: 0; }
.wa-name   { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.wa-preview{ font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-time   { font-size: 10px; color: var(--text3); font-family: var(--mono); white-space: nowrap; }
.wa-status-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.wa-status-received  { background: var(--blue-bg);  color: var(--blue); }
.wa-status-processing{ background: var(--amber-bg); color: var(--amber); }
.wa-status-task_created { background: var(--green-bg); color: var(--green); }
.wa-status-error     { background: var(--red-bg);   color: var(--red); }
.wa-status-ignored   { background: var(--bg4); color: var(--text3); }

/* ── 27. Reports / Charts ─────────────────────────────────*/
.chart-container { position: relative; height: 220px; }
.report-filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
}

/* ── 28. Portal Client ────────────────────────────────────*/
.portal-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.portal-header {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; gap: 14px;
}
.portal-content { flex: 1; padding: 24px; max-width: 900px; margin: 0 auto; width: 100%; }
.portal-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}

/* ── 29. NPS Widget ───────────────────────────────────────*/
.nps-wrap { display: flex; gap: 6px; flex-wrap: wrap; }
.nps-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.nps-btn:hover    { border-color: var(--accent); color: var(--accent2); background: var(--accent-bg); }
.nps-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.nps-btn.detract  { border-color: var(--red-border); }
.nps-btn.passive  { border-color: var(--amber-border); }
.nps-btn.promoter { border-color: var(--green-border); }

/* ── 30. Notifications Panel ──────────────────────────────*/
.notif-btn-wrap { position: relative; }
.notif-dot {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  background: var(--red); color: #fff; border-radius: 99px;
  font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg2);
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200;
  animation: fadeIn 0.2s ease;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.notif-list-item {
  display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
}
.notif-list-item:last-child { border-bottom: none; }
.notif-list-item:hover  { background: var(--bg3); }
.notif-list-item.unread { background: rgba(108,99,255,0.06); }
.notif-empty { padding: 20px; text-align: center; color: var(--text3); font-size: 12px; }

/* ── 31. Toast Notification ───────────────────────────────*/
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 13px 18px;
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px; animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast-icon { font-size: 17px; }

/* ── 32. Login Screen ─────────────────────────────────────*/
.login-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-bg-orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.2;
  animation: orbFloat 9s ease-in-out infinite alternate;
}
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}
.login-wrap {
  position: relative; z-index: 2; display: flex; width: 880px; max-width: 96vw;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  animation: loginIn 0.45s cubic-bezier(.16,1,.3,1);
}
.login-left {
  flex: 1; background: linear-gradient(145deg, #181630 0%, #0f0f18 100%);
  padding: 44px 38px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--border); position: relative; overflow: hidden; min-width: 0;
}
.login-left-orb {
  position: absolute; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(108,99,255,0.25) 0%, transparent 70%);
  top: -90px; right: -90px; pointer-events: none;
}
.login-brand      { display: flex; align-items: center; gap: 11px; margin-bottom: 36px; }
.login-brand-icon { width: 38px; height: 38px; background: var(--accent); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff; }
.login-brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.login-tagline    { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.6px; color: var(--text); margin-bottom: 14px; }
.login-tagline span { color: var(--accent2); }
.login-desc       { font-size: 13px; color: var(--text3); line-height: 1.7; margin-bottom: 30px; }
.login-features   { display: flex; flex-direction: column; gap: 9px; }
.login-feat       { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text2); }
.login-feat-icon  { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-bg); border: 1px solid var(--accent-border); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.login-right      { width: 390px; flex-shrink: 0; padding: 44px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-title      { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 6px; }
.login-sub        { font-size: 13px; color: var(--text3); margin-bottom: 26px; }
.login-error      { background: var(--red-bg); border: 1px solid var(--red-border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12px; color: var(--red); margin-bottom: 14px; display: none; }
.login-form-group { margin-bottom: 14px; }
.login-label      { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; display: block; }
.login-input      { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; padding: 10px 13px; outline: none; transition: border-color var(--transition); font-family: var(--font); }
.login-input:focus { border-color: var(--accent); }
.login-input.error { border-color: var(--red); }
.login-btn        { width: 100%; padding: 12px; background: var(--accent); border: none; border-radius: var(--radius-sm); color: #fff; font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer; transition: background var(--transition); margin-top: 4px; letter-spacing: 0.01em; }
.login-btn:hover  { background: var(--accent2); }
.login-btn:active { transform: scale(0.99); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.login-divider    { display: flex; align-items: center; gap: 10px; margin: 20px 0; font-size: 11px; color: var(--text3); }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-users      { display: flex; flex-direction: column; gap: 6px; }
.login-user-chip  { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); background: var(--bg3); }
.login-user-chip:hover { border-color: var(--accent); background: var(--accent-bg); }
.login-user-name  { font-size: 12px; font-weight: 600; flex: 1; }
.login-user-role  { font-size: 10px; color: var(--text3); }
.login-footer     { margin-top: 22px; font-size: 11px; color: var(--text3); text-align: center; }
.login-footer a   { color: var(--accent2); cursor: pointer; }

/* ── 33. Productivity / Reports extras ───────────────────*/
.ranking-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; transition: border-color var(--transition);
}
.ranking-item:hover { border-color: var(--border2); }
.rank-num { font-size: 16px; font-weight: 800; color: var(--text3); width: 22px; }
.rank-score { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.stat-row:last-child { border-bottom: none; }
.stat-row-label { color: var(--text2); }
.stat-row-val   { font-weight: 600; font-family: var(--mono); }

/* ── 34. Utility Classes ──────────────────────────────────*/
.flex   { display: flex; } .flex-1 { flex: 1; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-6  { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.mt-6   { margin-top: 6px; } .mt-8 { margin-top: 8px; }
.mt-12  { margin-top: 12px; } .mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; }
.mb-6   { margin-bottom: 6px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-xs  { font-size: 10px; } .text-sm { font-size: 11px; } .text-base { font-size: 13px; }
.text-center { text-align: center; }
.font-mono { font-family: var(--mono); }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent2); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.spin-icon { display: inline-block; animation: spin 0.8s linear infinite; }

/* ── 35. Animations ───────────────────────────────────────*/
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideIn  { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes modalIn  { from { transform: scale(0.96) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes loginIn  { from { transform: translateY(28px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes orbFloat { from { transform: translateY(0) scale(1); } to { transform: translateY(-28px) scale(1.07); } }
@keyframes shake    { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.shake { animation: shake 0.35s ease; }

/* ── 36. Responsive ───────────────────────────────────────*/
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2,1fr); }
  .grid-32, .grid-23 { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: repeat(2,1fr); }
  .kanban { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -var(--sidebar-w); z-index: 60; }
  .sidebar.mobile-open { left: 0; box-shadow: var(--shadow-lg); }
  .metrics { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .modal { width: 95vw; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .login-wrap { max-width: 420px; }
}

/* ── 37. Print / PDF ──────────────────────────────────────*/
@media print {
  .sidebar, .topbar, .btn, .modal-backdrop, .toast, .notif-panel,
  .sidebar-toggle, .topbar-actions { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; overflow: visible; }
  .app-shell { display: block; height: auto; }
  body { background: #fff !important; color: #000 !important; }
  .card, .metric, .sla-table td, .sla-table th { border-color: #ddd !important; }
  .metric-value, .card-title { color: #000 !important; }
}
