@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-base: #07090f;
  --bg-surface: #0d1117;
  --bg-card: #111827;
  --bg-card2: #161f2e;
  --bg-hover: #1a2235;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --border3: rgba(255,255,255,0.18);
  --accent: #3B82F6;
  --accent-dim: rgba(59,130,246,0.15);
  --accent-hover: #2563EB;
  --purple: #7C3AED;
  --purple-dim: rgba(124,58,237,0.15);
  --green: #10B981;
  --green-dim: rgba(16,185,129,0.15);
  --amber: #F59E0B;
  --amber-dim: rgba(245,158,11,0.15);
  --red: #EF4444;
  --red-dim: rgba(239,68,68,0.12);
  --text1: #F1F5F9;
  --text2: #94A3B8;
  --text3: #4B5563;
  --teams: #5558AF;
  --teams-dim: rgba(85,88,175,0.15);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 220px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text1);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* LAYOUT */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }

/* TOPBAR */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 0 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar-logo {
  width: var(--sidebar-w);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark i { color: #fff; font-size: 17px; }
.logo-name { font-size: 15px; font-weight: 700; letter-spacing: -0.03em; color: var(--text1); }
.logo-tag { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; font-weight: 500; }
.topbar-center { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 20px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; width: 280px;
}
.topbar-search input { background: none; border: none; outline: none; color: var(--text1); font-size: 12px; font-family: inherit; width: 100%; }
.topbar-search input::placeholder { color: var(--text3); }
.topbar-search i { color: var(--text3); font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; color: var(--text2);
}
.icon-btn:hover { border-color: var(--border2); color: var(--text1); }
.icon-btn i { font-size: 16px; }
.notif-dot { position: relative; }
.notif-dot::after {
  content: ''; position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--red);
  border: 1.5px solid var(--bg-surface);
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px; cursor: pointer;
}
.user-chip:hover { border-color: var(--border2); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--accent);
}
.user-name { font-size: 12px; font-weight: 500; color: var(--text1); }

/* SIDEBAR */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: 12px;
}
.nav-section-label {
  font-size: 9px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .1em;
  padding: 16px 16px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; margin: 1px 8px;
  border-radius: 8px; cursor: pointer;
  transition: all .12s; color: var(--text2);
  font-size: 12.5px; font-weight: 400;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text1); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(59,130,246,0.2); }
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 9px; font-weight: 600;
  padding: 2px 6px; border-radius: 10px;
  background: var(--red); color: #fff;
}
.nav-badge.green { background: var(--green); }
.nav-badge.blue { background: var(--accent); }
.sidebar-footer {
  margin-top: auto; padding: 12px 8px 0;
  border-top: 1px solid var(--border);
}
.agent-live-card {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: center; gap: 9px;
}
.live-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  animation: lp 2s ease-in-out infinite;
}
@keyframes lp { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.85)} }
.agent-live-info { flex: 1; min-width: 0; }
.agent-live-name { font-size: 11.5px; font-weight: 500; color: var(--text1); }
.agent-live-sub { font-size: 10px; color: var(--green); }

/* MAIN */
.main {
  overflow-y: auto;
  background: var(--bg-base);
  display: flex; flex-direction: column;
}

/* PAGE HEADER */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 16px;
  flex-shrink: 0;
}
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.page-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; transition: all .15s;
  white-space: nowrap;
}
.btn i { font-size: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg-card); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text1); border-color: var(--border2); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,0.25); }
.btn-teams { background: var(--teams-dim); color: #8B8FD4; border: 1px solid rgba(85,88,175,0.3); }
.btn-teams:hover { background: rgba(85,88,175,0.25); }
.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn-sm i { font-size: 13px; }

/* CONTENT AREA */
.content { padding: 0 26px 26px; flex: 1; }

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text1); }
.card-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.card-body { padding: 16px 18px; }

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

/* METRIC CARDS */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative; overflow: hidden;
}
.metric-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.metric-card.blue::after { background: var(--accent); }
.metric-card.green::after { background: var(--green); }
.metric-card.purple::after { background: var(--purple); }
.metric-card.amber::after { background: var(--amber); }
.metric-card.red::after { background: var(--red); }
.metric-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; margin: 6px 0 4px; }
.metric-trend { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.metric-trend.up { color: var(--green); }
.metric-trend.down { color: var(--red); }
.metric-trend.neutral { color: var(--text3); }
.metric-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.metric-icon i { font-size: 18px; }
.metric-icon.blue { background: var(--accent-dim); color: var(--accent); }
.metric-icon.green { background: var(--green-dim); color: var(--green); }
.metric-icon.purple { background: var(--purple-dim); color: var(--purple); }
.metric-icon.amber { background: var(--amber-dim); color: var(--amber); }
.metric-icon.red { background: var(--red-dim); color: var(--red); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 500;
  padding: 3px 8px; border-radius: 20px;
}
.badge.live { background: rgba(239,68,68,0.12); color: #F87171; border: 1px solid rgba(239,68,68,0.2); }
.badge.live::before { content:'●'; animation: lp 1.2s infinite; margin-right: 2px; }
.badge.active { background: var(--green-dim); color: #34D399; border: 1px solid rgba(16,185,129,0.25); }
.badge.pending { background: var(--amber-dim); color: #FBB040; border: 1px solid rgba(245,158,11,0.25); }
.badge.booked { background: var(--accent-dim); color: #60A5FA; border: 1px solid rgba(59,130,246,0.25); }
.badge.paused { background: var(--bg-card2); color: var(--text3); border: 1px solid var(--border); }
.badge.teams { background: var(--teams-dim); color: #8B8FD4; border: 1px solid rgba(85,88,175,0.3); }
.badge.mobile { background: var(--green-dim); color: #34D399; border: 1px solid rgba(16,185,129,0.25); }

/* TABS */
.tabs { display: flex; gap: 2px; padding: 4px; background: var(--bg-card); border-radius: 10px; width: fit-content; }
.tab {
  padding: 6px 16px; border-radius: 7px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text3); transition: all .15s;
}
.tab.active { background: var(--bg-card2); color: var(--text1); border: 1px solid var(--border); }
.tab:hover:not(.active) { color: var(--text2); }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 18px; text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text2);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table td.bold { color: var(--text1); font-weight: 500; }

/* WAVEFORM */
.waveform { display: flex; align-items: center; gap: 2.5px; height: 20px; }
.wave-b {
  width: 3px; border-radius: 2px; background: var(--accent);
  animation: wv .7s ease-in-out infinite;
}
.wave-b:nth-child(2){animation-delay:.1s}
.wave-b:nth-child(3){animation-delay:.2s}
.wave-b:nth-child(4){animation-delay:.13s}
.wave-b:nth-child(5){animation-delay:.06s}
@keyframes wv { 0%,100%{height:5px} 50%{height:16px} }

/* SENTIMENT BAR */
.sentiment-bar { height: 4px; border-radius: 2px; overflow: hidden; background: var(--border); display: flex; }
.sent-pos { background: var(--green); }
.sent-neu { background: var(--amber); }
.sent-neg { background: var(--red); }

/* PROGRESS */
.prog-bar { height: 5px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; }

/* AVATAR */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0; font-size: 11px;
}

/* FORM ELEMENTS */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 11px; font-weight: 500; color: var(--text2); margin-bottom: 6px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px; font-family: inherit;
  color: var(--text1);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

/* TOGGLE */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  width: 36px; height: 20px;
  background: var(--border2); border-radius: 10px;
  position: relative; cursor: pointer; transition: background .2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .2s;
}
.toggle.on::after { transform: translateX(16px); }

/* PAGE SECTIONS */
.page-section { display: none; }
.page-section.active { display: block; }

/* CHART BARS */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 100px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.bar { width: 100%; border-radius: 4px 4px 0 0; transition: opacity .15s; cursor: pointer; }
.bar:hover { opacity: .8; }
.bar-label { font-size: 10px; color: var(--text3); }
.bar-val { font-size: 10px; color: var(--text2); font-weight: 500; }

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

/* STATUS DOT */
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.on { background: var(--green); }
.status-dot.busy { background: var(--amber); animation: lp 1.5s infinite; }
.status-dot.off { background: var(--text3); }

/* NOTIFICATION */
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(59,130,246,0.04); }
.notif-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-text { flex: 1; }
.notif-msg { font-size: 12px; color: var(--text1); line-height: 1.5; }
.notif-time { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* MODAL OVERLAY */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 500;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 520px; max-width: 95vw;
  max-height: 85vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* TOOLTIP */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #1e293b; color: var(--text1);
  font-size: 11px; padding: 5px 9px;
  border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--border2);
  z-index: 9999; pointer-events: none;
}

/* STEP INDICATOR */
.step-indicator { display: flex; gap: 0; align-items: center; }
.step-ind-item { display: flex; align-items: center; gap: 0; }
.step-ind-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--bg-hover); color: var(--text3);
  border: 1px solid var(--border);
}
.step-ind-num.done { background: var(--green-dim); color: var(--green); border-color: rgba(16,185,129,.3); }
.step-ind-num.current { background: var(--accent-dim); color: var(--accent); border-color: rgba(59,130,246,.3); }
.step-ind-line { width: 40px; height: 1px; background: var(--border); }
.step-ind-line.done { background: var(--green); }

/* INTEGRATIONS GRID */
.int-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.int-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s;
}
.int-card:hover { border-color: var(--border2); }
.int-card.connected { border-color: rgba(16,185,129,.25); }
.int-logo { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.int-name { font-size: 13px; font-weight: 600; color: var(--text1); }
.int-desc { font-size: 11px; color: var(--text3); line-height: 1.5; }
.int-status-row { display: flex; align-items: center; justify-content: space-between; }

/* TEAMS SPECIFIC */
.teams-connect-box {
  background: linear-gradient(135deg, rgba(85,88,175,0.12), rgba(59,130,246,0.08));
  border: 1px solid rgba(85,88,175,0.3);
  border-radius: var(--radius-lg); padding: 24px;
}
.teams-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.teams-feat {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(85,88,175,0.1); border-radius: 8px;
  font-size: 12px; color: var(--text2);
}
.teams-feat i { font-size: 15px; color: #8B8FD4; flex-shrink: 0; }

/* PROMPT BUILDER */
.prompt-builder { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.prompt-editor {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--text1);
  min-height: 260px; outline: none;
  resize: none; width: 100%; line-height: 1.7;
}
.prompt-var-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 4px; padding: 0 6px;
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
}

/* CALENDAR */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: all .1s;
  border: 1px solid transparent;
}
.cal-day:hover { background: var(--bg-hover); }
.cal-day.today { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cal-day.has-event { background: var(--accent-dim); }
.cal-day.booked { background: var(--green-dim); }
.cal-day.other-month { color: var(--text3); }

/* RESPONSIVE UTILITY */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-muted { color: var(--text2); }
.text-dim { color: var(--text3); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
