/* Dashboard Layout */
.dash-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-logo { padding: 0 24px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-nav { flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: all .2s;
  font-size: .95rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--text-bright);
  background: rgba(99,102,241,.1);
  text-decoration: none;
}
.sidebar-nav a.active { border-right: 3px solid var(--primary); }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.sidebar-footer .user-info { font-size: .85rem; color: var(--text-muted); margin-bottom: 8px; }
.sidebar-footer .user-email { font-weight: 600; color: var(--text); }

.main-content { flex: 1; padding: 32px 40px; overflow-y: auto; }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.page-header h1 { font-size: 1.75rem; font-weight: 800; color: var(--text-bright); }

/* Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.stat-card .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--text-bright); }

/* Tables */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 16px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(99,102,241,.05); }

/* Agent Cards */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all .2s;
  cursor: pointer;
}
.agent-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.agent-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.agent-avatar {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.agent-card-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-bright); }
.agent-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}
.agent-status.active { background: #10b98120; color: #10b981; }
.agent-status.inactive { background: #ef444420; color: #ef4444; }
.agent-meta { display: flex; gap: 20px; margin-top: 12px; font-size: .85rem; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  padding: 32px;
}
.modal h2 { font-size: 1.5rem; font-weight: 800; color: var(--text-bright); margin-bottom: 24px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.modal .form-group input,
.modal .form-group textarea,
.modal .form-group select {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: .95rem; outline: none; font-family: inherit;
}
.modal .form-group textarea { min-height: 100px; resize: vertical; }
.modal .form-group input:focus,
.modal .form-group textarea:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* Embed Code */
.embed-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .85rem;
  color: var(--accent);
  word-break: break-all;
  position: relative;
}
.embed-code .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--primary); color: white;
  border: none; border-radius: 6px;
  padding: 4px 12px; font-size: .8rem; cursor: pointer;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text-bright); margin-bottom: 8px; }

/* Conversation View */
.convo-messages {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-height: 500px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.convo-msg {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.5;
}
.convo-msg.user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.convo-msg.assistant { background: var(--bg); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.convo-msg .time { font-size: .75rem; color: rgba(255,255,255,.5); margin-top: 4px; }
.convo-msg.assistant .time { color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}
