/* ============================================================
   ReachDesk Dashboard — Global Styles
   Design: Dark chrome (sidebar/header) + Light content area
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=Space+Mono:wght@400;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark chrome palette */
  --chrome-bg:      #0e0e1c;
  --chrome-surface: #161628;
  --chrome-border:  rgba(123,110,246,0.14);
  --chrome-hover:   rgba(123,110,246,0.10);
  --chrome-active:  rgba(123,110,246,0.18);

  /* Accent */
  --accent:         #7b6ef6;
  --accent-2:       #b8b0ff;
  --accent-glow:    rgba(123,110,246,0.25);
  --accent-light:   rgba(123,110,246,0.10);

  /* Content area (light) */
  --content-bg:     #f4f5f9;
  --card-bg:        #ffffff;
  --card-border:    #e8e9ef;
  --card-shadow:    0 1px 4px rgba(14,14,28,0.07), 0 4px 16px rgba(14,14,28,0.04);

  /* Text */
  --text-dark:      #12122a;
  --text-body:      #3a3a5c;
  --text-muted:     #8888aa;
  --text-light:     #ede9ff;
  --text-light-2:   #9490b6;

  /* Status */
  --green:   #22c55e; --green-bg:  rgba(34,197,94,0.10);
  --amber:   #f59e0b; --amber-bg:  rgba(245,158,11,0.10);
  --red:     #ef4444; --red-bg:    rgba(239,68,68,0.10);
  --blue:    #3b82f6; --blue-bg:   rgba(59,130,246,0.10);
  --purple:  #8b5cf6; --purple-bg: rgba(139,92,246,0.10);

  /* Layout */
  --sidebar-w:       240px;
  --sidebar-w-col:    64px;
  --header-h:         60px;
  --radius-sm:         8px;
  --radius-md:        12px;
  --radius-lg:        16px;
  --transition:       0.22s ease;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-body);
  background: var(--content-bg);
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(123,110,246,0.25); border-radius: 10px; }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--chrome-bg);
  border-right: 1px solid var(--chrome-border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar.collapsed {
  width: var(--sidebar-w-col);
  min-width: var(--sidebar-w-col);
}

/* Sidebar top — logo */
.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--chrome-border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo img {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: height 0.22s ease;
}
.sidebar.collapsed .sidebar-logo img { height: 28px; }

/* Collapse toggle */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--chrome-surface);
  border: 1px solid var(--chrome-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  color: var(--text-light-2);
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover { background: var(--accent); color: #fff; }
.sidebar-toggle svg { transition: transform var(--transition); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* Nav sections */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.nav-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-light-2);
  opacity: 0.5;
  padding: 14px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  color: var(--text-light-2);
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--chrome-hover);
  color: var(--text-light);
}

.nav-item.active {
  background: var(--chrome-active);
  color: var(--accent-2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .nav-label {
  font-size: 13.5px;
  font-weight: 500;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

/* Sidebar bottom — user */
.sidebar-user {
  border-top: 1px solid var(--chrome-border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.user-info { transition: opacity var(--transition); }
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-light); }
.user-info .user-role { font-size: 11px; color: var(--text-light-2); }
.sidebar.collapsed .user-info { opacity: 0; pointer-events: none; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--content-bg);
}

/* ============================================================
   HEADER
   ============================================================ */
.top-header {
  height: var(--header-h);
  background: var(--chrome-bg);
  border-bottom: 1px solid var(--chrome-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  flex: 1;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  width: 240px;
  transition: border-color var(--transition);
}
.header-search:focus-within { border-color: rgba(123,110,246,0.45); }

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-light);
  width: 100%;
}
.header-search input::placeholder { color: var(--text-light-2); opacity: 0.6; }
.header-search svg { color: var(--text-light-2); flex-shrink: 0; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--chrome-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light-2);
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.header-btn:hover { background: var(--chrome-hover); color: var(--text-light); }

.header-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--chrome-bg);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: 2px solid var(--chrome-border);
  transition: border-color var(--transition);
}
.header-avatar:hover { border-color: var(--accent); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.page-header .page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.card-body { padding: 18px 20px; }
.card-body.no-top { padding-top: 0; }

/* Metric cards */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.6;
}

.metric-card.green::before  { background: var(--green); }
.metric-card.amber::before  { background: var(--amber); }
.metric-card.blue::before   { background: var(--blue); }
.metric-card.purple::before { background: var(--purple); }

.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}
.metric-delta.up   { background: var(--green-bg); color: var(--green); }
.metric-delta.down { background: var(--red-bg);   color: var(--red); }
.metric-delta.neu  { background: var(--blue-bg);  color: var(--blue); }

/* ============================================================
   GRIDS
   ============================================================ */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 18px; }

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray   { background: rgba(136,136,170,0.10); color: var(--text-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: background var(--transition), transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6a5de0; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-body);
}
.btn-outline:hover { background: var(--content-bg); border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 12px;
}
.btn-ghost:hover { background: var(--content-bg); color: var(--text-body); }

.btn-dark {
  background: var(--chrome-bg);
  color: var(--text-light);
  border: 1px solid var(--chrome-border);
}
.btn-dark:hover { background: var(--chrome-surface); border-color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ============================================================
   TABLE
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-body);
  border-bottom: 1px solid rgba(232,233,239,0.6);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(123,110,246,0.03); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238888aa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-select:focus { border-color: var(--accent); }

/* ============================================================
   AI CHAT FLOAT BUTTON
   ============================================================ */
.ai-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(123,110,246,0.45);
  z-index: 999;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.ai-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(123,110,246,0.55);
}
.ai-float-btn .ai-pulse {
  position: absolute;
  top: -3px; right: -3px;
  width: 13px; height: 13px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid #0c0a17;
  z-index: 1;
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
  60%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* AI Chat Panel */
.ai-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 360px;
  height: 500px;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  z-index: 998;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}
.ai-chat-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.ai-chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--chrome-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-header .title { font-size: 14px; font-weight: 600; color: var(--text-light); }
.ai-chat-header .sub   { font-size: 11px; color: var(--green); }
.ai-chat-close {
  margin-left: auto;
  background: none; border: none;
  color: var(--text-light-2);
  cursor: pointer; padding: 4px;
}
.ai-chat-close:hover { color: var(--text-light); }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.ai-msg.bot {
  background: var(--chrome-surface);
  color: var(--text-light);
  border-radius: 4px 12px 12px 12px;
  align-self: flex-start;
}
.ai-msg.user {
  background: var(--accent);
  color: #fff;
  border-radius: 12px 4px 12px 12px;
  align-self: flex-end;
}
.ai-msg .msg-time {
  font-size: 10px;
  opacity: 0.55;
  margin-top: 4px;
  display: block;
}

.ai-typing {
  display: flex;
  gap: 4px;
  padding: 10px 13px;
  background: var(--chrome-surface);
  border-radius: 4px 12px 12px 12px;
  align-self: flex-start;
  width: fit-content;
}
.ai-typing span {
  width: 6px; height: 6px;
  background: var(--text-light-2);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.ai-chat-input-row {
  padding: 12px;
  border-top: 1px solid var(--chrome-border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-light);
  outline: none;
  resize: none;
}
.ai-chat-input::placeholder { color: var(--text-light-2); opacity: 0.6; }
.ai-chat-input:focus { border-color: rgba(123,110,246,0.45); }

.ai-send-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background 0.2s;
}
.ai-send-btn:hover { background: #6a5de0; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 6px;
  background: var(--card-border);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--accent);
  transition: width 0.5s ease;
}
.progress-fill.green  { background: var(--green); }
.progress-fill.amber  { background: var(--amber); }
.progress-fill.red    { background: var(--red); }

/* ============================================================
   AVATAR GROUP
   ============================================================ */
.avatar-stack {
  display: flex;
}
.avatar-stack .av {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card-bg);
  margin-left: -8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.avatar-stack .av:first-child { margin-left: 0; }
.avatar-stack .av.green  { background: var(--green); }
.avatar-stack .av.blue   { background: var(--blue); }
.avatar-stack .av.amber  { background: var(--amber); }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { height: 1px; background: var(--card-border); margin: 16px 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-body); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ============================================================
   TOOLTIPS / POPOVERS
   ============================================================ */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%; bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: var(--text-dark);
  color: #fff;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
}
[data-tip]:hover::after { opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-3-1 { grid-template-columns: 1fr; }
  .page-content { padding: 20px 18px; }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .header-search { display: none; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.45);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  /* Overlay escuro atrás do menu no mobile */
  .sidebar-mobile-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 299;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .sidebar-mobile-overlay.active { display: block; }
  /* Botão X de fechar dentro do sidebar no mobile */
  .sidebar-close-btn {
    display: flex !important;
    position: absolute; top: 14px; right: 14px;
    width: 30px; height: 30px;
    background: rgba(255,255,255,0.08);
    border: none; border-radius: 6px;
    color: #fff; cursor: pointer;
    align-items: center; justify-content: center;
    z-index: 10;
    transition: background 0.18s;
  }
  .sidebar-close-btn:hover { background: rgba(255,255,255,0.18); }
}

/* ============================================================
   UTILITY
   ============================================================ */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-dark { color: var(--text-dark); }
.font-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   HAMBURGER BUTTON (in top header)
   ============================================================ */
.hamburger-btn {
  width: 36px; height: 36px;
  background: transparent; border: none;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; cursor: pointer; flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.hamburger-btn:hover { background: var(--chrome-hover); }
.hamburger-btn span {
  display: block; width: 18px; height: 2px;
  background: #ffffff; border-radius: 2px;
  transition: all 0.22s ease;
}
.hamburger-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   LOGO SWITCHING (sidebar open vs collapsed)
   ============================================================ */
/* sidebar-logo: centred, scales between open and collapsed */
.sidebar-logo {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: center;
  padding: 0 10px; border-bottom: 1px solid var(--chrome-border);
  flex-shrink: 0; overflow: hidden;
}
/* Open state: show marca + wordmark row */
.sidebar-logo .logo-open-wrap {
  display: flex; align-items: center; gap: 8px;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.sidebar.collapsed .logo-open-wrap { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.sidebar-logo .logo-marca {
  height: 36px; width: auto; object-fit: contain; flex-shrink: 0;
}
.sidebar-logo .logo-wordmark {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; font-weight: 700;
  color: var(--text-light); letter-spacing: -0.3px;
  white-space: nowrap;
}
.sidebar-logo .logo-wordmark span { color: var(--accent-2); }
/* Collapsed state: only the mark, centred */
.sidebar-logo .logo-collapsed {
  display: none; align-items: center; justify-content: center;
}
.sidebar.collapsed .logo-collapsed { display: flex; }
.sidebar.collapsed .logo-open-wrap { display: none; }

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */
.notif-dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 500; overflow: hidden;
}
.notif-dropdown.show { display: block; }
.notif-head {
  padding: 14px 16px; border-bottom: 1px solid var(--chrome-border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-head span { font-size: 14px; font-weight: 600; color: var(--text-light); }
.notif-head a { font-size: 11px; color: var(--accent-2); text-decoration: none; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid rgba(123,110,246,0.07);
  display: flex; gap: 10px; cursor: pointer;
}
.notif-item:hover { background: rgba(123,110,246,0.06); }
.notif-item-last { border-bottom: none; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 5px;
}
.notif-dot.read { background: rgba(123,110,246,0.2); }
.notif-item .ni-title { font-size: 13px; color: var(--text-light); font-weight: 500; }
.notif-item .ni-sub   { font-size: 11px; color: var(--text-light-2); margin-top: 2px; }

/* ============================================================
   MODAL SYSTEM
   ============================================================ */
.rd-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,22,0.7);
  backdrop-filter: blur(3px);
  z-index: 800;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.rd-overlay.active { opacity: 1; pointer-events: all; }
.rd-modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.22s ease;
  position: relative;
}
.rd-overlay.active .rd-modal { transform: translateY(0) scale(1); }
.rd-modal.modal-lg { max-width: 820px; }
.rd-modal.modal-sm { max-width: 440px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--card-border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text-dark); letter-spacing: -0.3px; }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: none; border: 1px solid var(--card-border);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--content-bg); color: var(--text-dark); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ============================================================
   KANBAN BOARD
   ============================================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--content-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  min-height: 300px;
  display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}
.kanban-col-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-dark);
}
.kanban-col-title .col-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.kanban-col-count {
  font-size: 11px; background: rgba(136,136,170,0.15);
  color: var(--text-muted); padding: 2px 7px; border-radius: 10px;
  font-weight: 600;
}
.kanban-cards {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  flex: 1;
  min-height: 200px;
}
.kanban-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  user-select: none;
}
.kanban-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  border-color: rgba(123,110,246,0.3);
  transform: translateY(-1px);
}
.kanban-card.dragging {
  opacity: 0.5; cursor: grabbing;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.kanban-card.drag-over { border-color: var(--accent); border-style: dashed; }
.kanban-col.drop-target .kanban-cards { background: rgba(123,110,246,0.04); border-radius: 8px; }

.kcard-title { font-size: 13px; font-weight: 500; color: var(--text-dark); margin-bottom: 8px; line-height: 1.4; }
.kcard-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Kanban empty column state */
.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  border: 1.5px dashed var(--card-border);
  border-radius: 10px;
  margin: 4px 0;
  gap: 4px;
}

/* ============================================================
   EMAIL VIEW page enhancements
   ============================================================ */
.email-thread-item {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.email-thread-header {
  padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; background: var(--card-bg);
  transition: background var(--transition);
}
.email-thread-header:hover { background: rgba(123,110,246,0.02); }
.email-thread-body { padding: 16px 18px; border-top: 1px solid var(--card-border); font-size: 14px; line-height: 1.8; color: var(--text-body); }

/* ============================================================
   CRM contact page
   ============================================================ */
.contact-hero {
  background: linear-gradient(135deg, #141430, #1e1240);
  border: 1px solid rgba(123,110,246,0.2);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 22px;
}
.contact-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-size: 24px; font-weight: 700;
  color: #fff; flex-shrink: 0;
  border: 3px solid rgba(123,110,246,0.4);
}
