:root {
  --bg-app: #f8f9fb;
  --surface: #ffffff;
  --primary: #12141d;
  --primary-light: #2a2e3a;
  --accent: #c5a059;
  --accent-light: #e2d1a8;
  --text-main: #1a1c22;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 50px rgba(18, 20, 29, 0.08);
  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Inter', 'Manrope', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-app);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Decorations */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: linear-gradient(180deg, rgba(197, 160, 89, 0.05) 0%, rgba(248, 249, 251, 0) 100%);
  z-index: -1;
  pointer-events: none;
}

/* Header / Topbar */
.topbar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E") no-repeat center;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E") no-repeat center;
}

.topbar nav {
  display: flex;
  gap: 32px;
}

.topbar a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.topbar a:hover {
  color: var(--accent);
}

.topbar a.btn-crm {
  background: var(--primary);
  color: white;
  padding: 10px 24px;
  border-radius: 999px;
  transition: transform 0.2s, background 0.2s;
}

.topbar a.btn-crm:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* Layout */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 80px;
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 48px;
  align-items: start;
}

/* Hero Section */
.hero {
  padding-right: 40px;
}

.hero-visual {
  width: 100%;
  height: 300px;
  background: url('/static/hero.png') no-repeat center;
  background-size: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 40px;
  box-shadow: var(--shadow-lg);
}

.eyebrow {
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::after {
  content: '';
  height: 1px;
  width: 40px;
  background: var(--accent);
}

h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  color: var(--primary);
  margin: 0 0 24px 0;
}

.lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 48px;
}

/* Role Cards */
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.role-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-tab:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.role-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-lg);
}

.role-tab .icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.role-tab.active .icon {
  background: rgba(255, 255, 255, 0.1);
}

.role-tab h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.role-tab p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Dynamic Content Card */
.role-detail {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
}

.role-detail h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin: 0 0 12px 0;
}

.role-detail ul {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.role-detail li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.role-detail li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 900;
}

/* Chat Section */
.demo-container {
  background: var(--primary);
  border-radius: var(--radius-lg);
  color: white;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 700px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 40px;
}

.chat-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-header .status-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Custom Scrollbar for Chat */
.chat-window::-webkit-scrollbar {
  width: 6px;
}
.chat-window::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.msg {
  max-width: 85%;
  padding: 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.95rem;
  position: relative;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--primary-light);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.msg small {
  display: block;
  margin-top: 8px;
  font-size: 0.7rem;
  opacity: 0.6;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chat-controls {
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 4px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 52px;
}

.input-group select {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 10px;
  color: white;
  padding: 0 12px;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  max-width: 130px;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  padding: 0 16px;
  font-size: 0.95rem;
  outline: none;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.input-group button {
  background: var(--accent);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.input-group button:hover {
  opacity: 0.9;
}

/* Dashboard / CRM specific */
.crm-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

.crm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.stat-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 8px 0;
}

/* CRM Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 80px 1fr 200px;
  align-items: center;
  gap: 24px;
}

.timeline-item .time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timeline-item .content strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-item .tags {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-app);
  color: var(--text-muted);
  font-weight: 600;
}

/* Dashboard Grid & Sidebar */
.crm-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 40px 80px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
}

.sidebar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  height: calc(100vh - 140px);
  position: sticky;
  top: 40px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar a:hover {
  background: var(--bg-app);
  color: var(--primary);
}

.sidebar a.active {
  background: var(--primary);
  color: white;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.leads-section {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

@media (max-width: 1100px) {
  .leads-section {
    grid-template-columns: 1fr;
  }
}

.leads-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.lead-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.lead-item:last-child {
  border-bottom: none;
}

.lead-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lead-avatar {
  width: 44px;
  height: 44px;
  background: var(--bg-app);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
}

.lead-score {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #059669;
}

.lead-score.hot {
  background: #fef2f2;
  color: #dc2626;
}

/* Timeline Item Responsiveness */
@media (max-width: 600px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .timeline-item .tags {
    justify-content: flex-start;
  }
}

/* Responsiveness */
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 20px 40px;
  }
  .hero {
    padding-right: 0;
    text-align: center;
  }
  .hero-visual {
    height: 250px;
  }
  .eyebrow {
    justify-content: center;
  }
  .eyebrow::after {
    display: none;
  }
  .lead {
    margin-left: auto;
    margin-right: auto;
  }
  .demo-container {
    position: static;
    height: 600px;
  }
}

@media (max-width: 1400px) {
  .crm-layout {
    grid-template-columns: 1fr;
    padding: 0 20px 40px;
  }
  .sidebar {
    display: none; /* In a real app, we would add a hamburger menu here */
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    text-align: center;
  }
  .topbar nav {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .role-grid {
    grid-template-columns: 1fr;
  }
  .role-detail {
    padding: 24px;
  }
  .role-detail ul {
    grid-template-columns: 1fr;
  }
  .role-detail h2 {
    font-size: 1.6rem;
  }
}
