:root {
  --sidebar-bg: #0f292d;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: #091a1d;
  --primary-color: #10b981;
  --primary-hover: #059669;
  --bg-color: #f8fafc;
  --text-dark: #0f172a;
  --text-gray: #64748b;
  --border-color: #e2e8f0;
  --chat-bg: #f1f5f9;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --radius-md: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container { display: flex; height: 100vh; width: 100vw; }

/* --- SIDEBAR --- */
.sidebar {
  width: 90px;
  background-color: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 4px 0 15px rgba(0,0,0,0.05);
  z-index: 100;
}
.sidebar-logo {
  padding: 24px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.sidebar-logo svg { filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3)); }
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  color: #94a3b8;
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 11px;
  font-weight: 500;
  gap: 8px;
}
.nav-item:hover { color: white; background-color: var(--sidebar-hover); transform: translateY(-1px); }
.nav-item.active { color: var(--primary-color); background-color: var(--sidebar-active); box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--sidebar-bg); box-shadow: 0 0 0 2px var(--primary-color); }
.sidebar-bottom { margin-bottom: 20px; }

/* --- MAIN CONTENT & TABS --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  overflow: hidden;
}
.tab-content { display: none; height: 100%; flex-direction: column; }
.tab-content.active { display: flex; animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- TOP BAR --- */
.top-bar {
  height: 70px;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 32px;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.top-bar h2 { font-size: 20px; font-weight: 700; color: var(--text-dark); letter-spacing: -0.5px; }
.search-wrap { position: relative; }
.search-wrap::before {
  content: '🔍'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: 0.4; filter: grayscale(100%);
}
.search-wrap input {
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 30px;
  width: 320px;
  font-size: 14px;
  background-color: #f8fafc;
  transition: all 0.3s ease;
}
.search-wrap input:focus { outline: none; border-color: var(--primary-color); background-color: var(--white); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1); }

/* --- BUTTONS --- */
.btn-primary {
  background-color: var(--primary-color);
  color: white; border: none; padding: 10px 20px; border-radius: var(--radius-md);
  cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 10px rgba(16, 185, 129, 0.3); }
.btn-primary.sm { padding: 8px 16px; font-size: 13px; }

.btn-outline {
  background-color: var(--white);
  color: var(--text-dark); border: 1px solid var(--border-color);
  padding: 10px 20px; border-radius: var(--radius-md); cursor: pointer;
  font-weight: 500; font-size: 14px; transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.btn-outline:hover { background-color: #f1f5f9; border-color: #cbd5e1; }
.btn-outline.sm { padding: 8px 16px; font-size: 13px; }

/* --- LIVE CHAT LAYOUT --- */
.chat-layout-3col { display: flex; flex: 1; overflow: hidden; }

/* COL 1: Chat List */
.chat-list-col {
  width: 360px;
  background-color: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  z-index: 5;
}
.chat-tabs { display: flex; border-bottom: 1px solid var(--border-color); padding: 0 16px; gap: 8px; }
.chat-tab {
  flex: 1; text-align: center; padding: 16px 0;
  font-size: 12px; font-weight: 700; color: var(--text-gray);
  cursor: pointer; position: relative; letter-spacing: 0.5px;
  transition: color 0.2s;
}
.chat-tab:hover { color: var(--text-dark); }
.chat-tab.active { color: var(--primary-color); }
.chat-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 3px; background-color: var(--primary-color); border-radius: 3px 3px 0 0;
}
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.chat-item {
  display: flex; padding: 14px 16px; border-radius: var(--radius-md);
  cursor: pointer; align-items: center; transition: all 0.2s ease;
  border: 1px solid transparent;
}
.chat-item:hover { background-color: #f8fafc; border-color: #f1f5f9; }
.chat-item.active { background-color: #ecfdf5; border-color: #a7f3d0; box-shadow: var(--shadow-sm); }
.avatar {
  width: 46px; height: 46px; border-radius: 14px;
  background-color: #f59e0b; color: white; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
  font-size: 18px; margin-right: 16px; flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.chat-info { flex: 1; overflow: hidden; }
.chat-info h4 { margin: 0 0 6px 0; font-size: 15px; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-info p { margin: 0; font-size: 13px; color: var(--text-gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* COL 2: Chat Thread */
.chat-thread-col {
  flex: 1; background-color: var(--chat-bg); position: relative;
  display: flex; flex-direction: column;
}
.chat-bg-pattern {
  position: absolute; top:0; left:0; right:0; bottom:0; opacity: 0.5;
  background-image: url('data:image/svg+xml;utf8,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%2394a3b8" fill-opacity="0.15"><path d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/></g></g></svg>');
  z-index: 1;
}
.chat-msgs {
  flex: 1; overflow-y: auto; padding: 32px; position: relative;
  z-index: 2; display: flex; flex-direction: column; gap: 16px;
}
.empty-state {
  text-align: center; margin: auto; color: var(--text-gray);
  background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(8px);
  padding: 48px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 10;
  border: 1px solid rgba(255,255,255,0.5);
}
.empty-state h3 { margin-top: 20px; color: var(--text-dark); font-size: 20px; font-weight: 700; }
.msg-row { display: flex; width: 100%; }
.msg-row.in { justify-content: flex-start; }
.msg-row.out { justify-content: flex-end; }
.msg-bubble {
  max-width: 65%; padding: 12px 16px; border-radius: 12px;
  position: relative; font-size: 14px; line-height: 1.6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.msg-row.in .msg-bubble { background-color: var(--white); border-top-left-radius: 0; }
.msg-row.out .msg-bubble { background-color: #d1fae5; border-top-right-radius: 0; color: #064e3b; }
.msg-row.in .msg-bubble::before {
  content: ''; position: absolute; top: 0; left: -10px;
  width: 0; height: 0; border-top: 12px solid var(--white); border-left: 12px solid transparent;
}
.msg-row.out .msg-bubble::before {
  content: ''; position: absolute; top: 0; right: -10px;
  width: 0; height: 0; border-top: 12px solid #d1fae5; border-right: 12px solid transparent;
}
.msg-time {
  font-size: 11px; opacity: 0.6; text-align: right;
  margin-top: 6px; display: flex; justify-content: flex-end; align-items: center; gap: 4px;
  font-weight: 500;
}
.tick { color: #9ca3af; font-size: 14px; display: flex; align-items: center; }
.tick.read { color: #3b82f6; }

/* Chat Input */
.chat-input-area {
  background: var(--white); padding: 16px 24px;
  display: flex; align-items: center; z-index: 2;
  border-top: 1px solid var(--border-color); gap: 16px;
  box-shadow: 0 -4px 6px rgba(0,0,0,0.02);
}
.chat-input-area input {
  flex: 1; border: 1px solid var(--border-color); outline: none;
  padding: 14px 20px; font-size: 15px; border-radius: 30px;
  background: var(--bg-color); transition: all 0.3s;
}
.chat-input-area input:focus { border-color: var(--primary-color); background: var(--white); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1); }
.input-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--text-gray); transition: all 0.2s; padding: 8px; border-radius: 50%;
}
.icon-btn:hover { color: var(--primary-color); background: #ecfdf5; }
.btn-send-round {
  background: linear-gradient(135deg, #10b981, #059669); color: white;
  border: none; width: 44px; height: 44px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-send-round:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4); }

/* COL 3: Chat Profile */
.chat-profile-col {
  width: 360px; background-color: var(--white);
  border-left: 1px solid var(--border-color); display: flex; flex-direction: column;
  box-shadow: -4px 0 15px rgba(0,0,0,0.02); z-index: 5;
}
.profile-header {
  padding: 24px; font-weight: 700; border-bottom: 1px solid var(--border-color);
  font-size: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--text-dark);
}
.profile-card { padding: 32px 24px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; }
.avatar-lg {
  width: 100px; height: 100px; border-radius: 24px;
  background: linear-gradient(135deg, #f59e0b, #d97706); color: white; display: flex;
  align-items: center; justify-content: center; font-size: 40px;
  font-weight: 700; margin-bottom: 20px; box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}
.profile-card h3 { font-size: 22px; font-weight: 700; color: var(--text-dark); margin-bottom: 6px; letter-spacing: -0.5px; }
.profile-card p { color: var(--text-gray); font-size: 15px; font-weight: 500; margin-bottom: 24px; }

/* Custom Accordion for Coaching Data */
.coaching-section { width: 100%; display: flex; flex-direction: column; gap: 12px; }
details.acc-item {
  width: 100%; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  background: var(--white); transition: box-shadow 0.2s;
}
details.acc-item[open] { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
details.acc-item summary {
  padding: 16px; cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text-dark); list-style: none; display: flex; justify-content: space-between;
  align-items: center; background: #f8fafc; border-radius: var(--radius-md); transition: background 0.2s;
}
details.acc-item summary:hover { background: #f1f5f9; }
details.acc-item[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid var(--border-color); background: var(--white); }
details.acc-item summary::-webkit-details-marker { display: none; }
details.acc-item summary::after { content: '▾'; color: var(--text-gray); font-size: 14px; transition: transform 0.3s; }
details.acc-item[open] summary::after { transform: rotate(180deg); }
.acc-content { padding: 16px; font-size: 13px; color: var(--text-gray); background: var(--white); border-radius: 0 0 var(--radius-md) var(--radius-md); line-height: 1.6; }
.acc-content .kv-row { display: flex; justify-content: space-between; margin-bottom: 8px; border-bottom: 1px dashed #e2e8f0; padding-bottom: 8px; }
.acc-content .kv-row:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.acc-content .kv-row span:first-child { font-weight: 500; }
.acc-content .kv-row span:last-child { color: var(--text-dark); font-weight: 600; }

.btn-danger-text {
  color: #ef4444; background: #fef2f2; border: 1px solid #fee2e2; cursor: pointer;
  margin-top: 40px; font-weight: 600; font-size: 14px; padding: 12px; border-radius: var(--radius-md);
  width: 100%; transition: all 0.2s;
}
.btn-danger-text:hover { background: #fee2e2; border-color: #fca5a5; }

/* UTILITIES */
.p-20 { padding: 32px; }
.mt-20 { margin-top: 24px; }
.badge { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; display: inline-flex; align-items: center; gap: 4px; }
.badge.green { background-color: #d1fae5; color: #047857; }
.badge.blue { background-color: #dbeafe; color: #1d4ed8; }
.badge.orange { background-color: #fef3c7; color: #b45309; }
.badge.outline { border: 1px solid var(--border-color); color: var(--text-dark); background: var(--white); }
.badge.lg { padding: 8px 16px; font-size: 14px; }
.card { background: white; border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); transition: box-shadow 0.3s; }
.card:hover { box-shadow: var(--shadow-md); }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-bottom: 32px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.promo { color: white; border: none; }
.promo.teal { background: linear-gradient(135deg, #0f766e, #115e59); box-shadow: 0 10px 15px -3px rgba(15, 118, 110, 0.3); }
.promo.emerald { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3); }
.offer-banner { background: #f0fdf4; border: 1px solid #bbf7d0; padding: 20px 32px; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 20px; margin-bottom: 32px; color: #166534; font-weight: 500; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: white; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.data-table th, .data-table td { padding: 16px 24px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.data-table th { background: #f8fafc; font-weight: 700; color: var(--text-gray); text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background-color: #f1f5f9; cursor: pointer; }
.active-contact-header { display: flex; align-items: center; }
.active-contact-header .avatar { width: 40px; height: 40px; font-size: 16px; margin-right: 16px; border-radius: 12px; }
.table-actions { display: flex; gap: 16px; align-items: center; margin: 32px 0; }
.table-actions .spacer { flex: 1; }
