/* ─── Auto Data Intellect — Core Styles ─── */
:root {
  --navy:   #0A1628;
  --navy2:  #0f2044;
  --navy3:  #060E1A;
  --border: #1e3a5f;
  --brand:  #2563EB;
  --sky:    #38BDF8;
  --text:   #e2e8f0;
  --muted:  #64748b;
  --sub:    #94a3b8;
  --success:#10B981;
  --danger: #EF4444;
  --warn:   #F59E0B;
}

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

body {
  background: var(--navy);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

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

.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: var(--navy3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  line-height: 1.3;
}

.sidebar-nav { flex: 1; padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sub);
  font-size: .8125rem;
  text-decoration: none;
  margin-bottom: 2px;
  transition: all .13s;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active { background: rgba(37,99,235,.18); color: #60a5fa; }
.nav-item svg { flex-shrink: 0; }

.sidebar-agent {
  padding: 10px;
  border-top: 1px solid var(--border);
}

.agent-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(56,189,248,.07);
  border: 1px solid rgba(56,189,248,.18);
  text-decoration: none;
  margin-bottom: 12px;
  transition: background .13s;
}
.agent-btn:hover { background: rgba(56,189,248,.12); }
.agent-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--sky);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}
.agent-btn span { color: #7dd3fc; font-size: .8rem; font-weight: 500; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #1e3a5f;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: .78rem; color: var(--text); }
.user-plan { font-size: .72rem; color: var(--muted); }

.main-content {
  margin-left: 228px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--navy2);
  border-bottom: 1px solid var(--border);
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-title { color: var(--text); font-size: .875rem; font-weight: 500; }
.topbar-sep { color: var(--border); }

.page { padding: 28px; flex: 1; }

/* ─── Cards ─── */
.card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-title {
  color: #fff;
  font-size: .9375rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ─── Stat Cards ─── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.stat-value { color: #fff; font-size: 1.75rem; font-weight: 700; }
.stat-sub   { font-size: .72rem; margin-top: 4px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .13s;
  white-space: nowrap;
}
.btn:hover { background: #1d4ed8; }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sub);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: .8125rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .13s;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--text); }
.btn-danger { background: #991b1b; }
.btn-danger:hover { background: #7f1d1d; }

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-title { color: #fff; font-size: 1.25rem; font-weight: 700; }
.page-sub   { color: var(--muted); font-size: .8125rem; margin-top: 3px; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--sub); font-size: .8125rem; }
td.primary { color: var(--text); font-weight: 500; }
tr:hover td { background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: none; }

/* ─── Badges ─── */
.badge {
  display: inline-block;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-active    { background: #064e3b; color: #6ee7b7; }
.badge-draft     { background: #1e3a5f; color: #7dd3fc; }
.badge-paused    { background: #431407; color: #fdba74; }
.badge-completed { background: #064e3b; color: #86efac; }
.badge-archived  { background: #1c1917; color: #a8a29e; }
.badge-new       { background: #1e3a5f; color: #7dd3fc; }
.badge-replied   { background: #064e3b; color: #6ee7b7; }
.badge-interested{ background: #1c1917; color: #fb923c; }
.badge-running   { background: #1c1917; color: #fb923c; }
.badge-failed    { background: #431407; color: #fca5a5; }
.badge-excellent { background: #064e3b; color: #6ee7b7; }
.badge-good      { background: #1e3a5f; color: #93c5fd; }
.badge-fair      { background: #431407; color: #fdba74; }
.badge-poor      { background: #431407; color: #fca5a5; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-label { color: var(--sub); font-size: .8rem; display: block; margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--text);
  font-size: .8125rem;
  outline: none;
  font-family: inherit;
  transition: border-color .13s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--brand); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── Alerts ─── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .875rem; margin-bottom: 16px; }
.alert-success { background: #064e3b; border: 1px solid #065f46; color: #6ee7b7; }
.alert-error   { background: #431407; border: 1px solid #c2410c; color: #fdba74; }
.alert-info    { background: #0c3156; border: 1px solid #1e4d7b; color: #93c5fd; }

/* ─── Progress ─── */
.progress { background: rgba(255,255,255,.07); border-radius: 3px; height: 5px; overflow: hidden; }
.progress-fill { background: var(--brand); height: 100%; border-radius: 3px; transition: width .3s; }

/* ─── Avatar ─── */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #1e3a5f;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #7dd3fc;
  flex-shrink: 0;
}

/* ─── Pagination ─── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; margin-top: 2px; border-top: 1px solid var(--border);
}
.pagination-info { color: var(--muted); font-size: .78rem; }

/* ─── Utilities ─── */
.flex           { display: flex; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-center    { display: flex; align-items: center; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.mt-2           { margin-top: 8px; }
.mt-4           { margin-top: 16px; }
.mb-4           { margin-bottom: 16px; }
.text-muted     { color: var(--muted); }
.text-sm        { font-size: .78rem; }
.text-sky       { color: var(--sky); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.w-full         { width: 100%; }
.grid-2         { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3         { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4         { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ─── Inbox ─── */
.inbox-layout { display: grid; grid-template-columns: 280px 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; background: var(--navy2); }
.inbox-row { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer; transition: background .1s; }
.inbox-row:hover, .inbox-row.active { background: rgba(37,99,235,.1); }
.inbox-name { color: var(--text); font-size: .8125rem; font-weight: 500; }
.inbox-preview { color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { color: var(--muted); font-size: .7rem; white-space: nowrap; }

/* ─── Agent Chat ─── */
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 10px; font-size: .8125rem; line-height: 1.55; margin-bottom: 10px; }
.chat-ai   { background: rgba(37,99,235,.12); border: 1px solid rgba(37,99,235,.25); }
.chat-user { background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.2); margin-left: auto; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
