/* ==========================================================================
   SHELLY BOT - ENTERPRISE DASHBOARD STYLESHEET
   Luxury Monochrome Fintech / Apple Aesthetics (Black, White, Graphite)
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-canvas: #f6f7f9;
  --bg-card: #ffffff;
  --bg-subtle: #f0f1f4;
  --bg-hover: #e9ebf0;
  --bg-dark: #111113;

  --text-main: #111113;
  --text-muted: #6e6e73;
  --text-dim: #8e8e93;
  --text-light: #ffffff;

  --border-card: #e5e7eb;
  --border-subtle: #eeeff2;
  --border-focus: #111113;

  --accent-black: #111113;
  --accent-gray: #3a3a3c;
  --status-green: #10b981;
  --status-green-bg: #ecfdf5;

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-float: 0 14px 40px rgba(0, 0, 0, 0.08);
  --shadow-pill: 0 2px 6px rgba(0, 0, 0, 0.06);

  --radius-card: 22px;
  --radius-btn: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Background glow */
.glow-bg {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  z-index: 0;
}

.glow-one {
  width: 550px;
  height: 550px;
  top: -150px;
  left: 10%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(240, 241, 244, 0) 70%);
}

.glow-two {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: 5%;
  background: radial-gradient(circle, rgba(235, 236, 240, 0.7) 0%, rgba(246, 247, 249, 0) 70%);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.dash-sidebar {
  width: 275px;
  background: #ffffff;
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo-box {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-edition {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
}

.sidebar-close-btn svg {
  width: 20px;
  height: 20px;
}

/* Profile Card */
.profile-card {
  margin: 1.25rem 1.25rem 0.5rem;
  padding: 0.95rem;
  background: var(--bg-subtle);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border-subtle);
}

.profile-avatar-wrap {
  position: relative;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-green);
  border: 2px solid #ffffff;
  position: absolute;
  bottom: -2px;
  right: -2px;
}

.profile-details {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.code-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  background: #ffffff;
  color: var(--text-main);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border-card);
}

.status-pill {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--status-green-bg);
  color: var(--status-green);
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
}

.nav-group-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin: 1rem 0 0.5rem 0.65rem;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-link:hover svg {
  color: var(--text-main);
}

.nav-link.active {
  background: var(--accent-black);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.nav-link.active svg {
  color: #ffffff;
}

.nav-badge.live {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-counter {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-link.active .nav-counter {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.switch-biz-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.switch-biz-btn:hover {
  background: #e5e7eb;
}

.switch-biz-btn svg, .exit-link svg {
  width: 15px;
  height: 15px;
}

.exit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem;
  transition: var(--transition);
}

.exit-link:hover {
  color: var(--text-main);
}

/* ==========================================================================
   MAIN DASHBOARD CONTENT
   ========================================================================== */
.dash-main {
  flex: 1;
  margin-left: 275px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Topbar Header */
.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  max-width: 450px;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  padding: 4px;
}

.menu-toggle-btn svg {
  width: 22px;
  height: 22px;
}

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-subtle);
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.search-box:focus-within {
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-main);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.status-text {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn-topbar-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.btn-topbar-action:hover {
  background: #27272a;
  transform: translateY(-1px);
}

.btn-topbar-action svg {
  width: 14px;
  height: 14px;
}

.biz-select-wrapper {
  position: relative;
}

.biz-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.45rem 2rem 0.45rem 0.95rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

/* ==========================================================================
   VIEWS CONTAINER & COMMON STYLES
   ========================================================================== */
.dash-view {
  display: none;
  padding: 2rem;
  flex: 1;
}

.dash-view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1.5rem;
}

.view-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.15;
}

.view-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Period switcher segmented control */
.period-switcher {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: 9999px;
  border: 1px solid var(--border-card);
}

.period-btn {
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.period-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-pill);
}

/* Dash Card Base */
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 1.65rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-eyebrow {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  display: block;
}

.card-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.card-section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
}

/* ==========================================================================
   VIEW 1: OVERVIEW METRICS GRID (BonVue Layout)
   ========================================================================== */
.stats-hero-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Hero Metric Card */
.hero-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: var(--status-green-bg);
  color: var(--status-green);
}

.trend-badge svg {
  width: 12px;
  height: 12px;
}

.hero-metric-body {
  margin: 1.25rem 0;
}

.hero-huge-num {
  font-family: var(--font-heading);
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
  display: block;
}

.hero-metric-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.4rem;
  display: block;
}

.hero-metric-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  line-height: 1.45;
}

.hero-metric-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.pill-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pill-toggle-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.pill-toggle {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* Chart Card */
.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.chart-big-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.chart-title-num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.chart-title-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.chart-container {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.curve-chart-svg {
  width: 100%;
  height: 140px;
  overflow: visible;
}

.chart-x-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.65rem;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Mini Stats Grid (4 items) */
.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.mini-metric-card {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mini-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.mini-metric-icon svg {
  width: 18px;
  height: 18px;
  color: var(--text-main);
}

.mini-val {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
  display: block;
}

.mini-label {
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

.mini-subtext {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.65rem;
  display: block;
}

.mini-subtext.positive {
  color: var(--status-green);
  font-weight: 600;
}

/* Split Grid (Table + Feed) */
.dash-split-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 1.25rem;
}

.card-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.btn-text-action {
  background: none;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.btn-text-action:hover {
  text-decoration: underline;
}

.live-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-green);
  animation: pulse-dot 1.5s infinite;
}

/* Dash Table */
.chats-table-wrapper {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.dash-table th {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-card);
}

.dash-table td {
  padding: 0.95rem 0.5rem;
  font-size: 0.82rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.dash-table tr:last-child td {
  border-bottom: none;
}

.dash-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

.table-user-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-cell-name {
  font-weight: 700;
  font-family: var(--font-heading);
  display: block;
}

.user-cell-phone {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.table-msg-preview {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-status.auto {
  background: var(--accent-black);
  color: #ffffff;
}

.badge-status.human {
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  color: var(--text-main);
}

.btn-table-view {
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-table-view:hover {
  background: var(--accent-black);
  color: #ffffff;
}

.text-right {
  text-align: right;
}

/* Activity Feed */
.activity-feed-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  position: relative;
}

.activity-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-main);
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.4;
}

.activity-text strong {
  font-weight: 700;
}

.activity-time {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  display: block;
}

/* ==========================================================================
   VIEW 2: LIVE CONVERSATIONS (CHAT BOARD)
   ========================================================================== */
.chat-filter-pills {
  display: flex;
  gap: 0.4rem;
}

.chat-filter-btn {
  padding: 0.4rem 0.95rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.chat-filter-btn.active {
  background: var(--accent-black);
  border-color: var(--accent-black);
  color: #ffffff;
}

.live-chat-board {
  display: grid;
  grid-template-columns: 340px 1fr;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  height: 680px;
  box-shadow: var(--shadow-card);
}

.chat-list-panel {
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  background: #fbfbfd;
}

.chat-search-wrap {
  padding: 1rem;
  border-bottom: 1px solid var(--border-card);
}

.chat-search-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  font-size: 0.82rem;
  outline: none;
}

.chat-items-scroll {
  flex: 1;
  overflow-y: auto;
}

.chat-card-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.chat-card-item:hover {
  background: #ffffff;
}

.chat-card-item.active {
  background: #ffffff;
  border-left: 3px solid var(--accent-black);
}

.chat-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.chat-item-name {
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.chat-item-snippet {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Conversation Window */
.chat-conversation-panel {
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.active-chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbfbfd;
}

.active-chat-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.active-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.active-user-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.active-user-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-control-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-control-toggle:hover {
  background: var(--bg-subtle);
}

.btn-control-toggle svg {
  width: 14px;
  height: 14px;
}

.active-messages-stream {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f7f7fa;
}

.msg-bubble {
  max-width: 70%;
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.5;
  position: relative;
}

.msg-bubble.client {
  align-self: flex-start;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-card);
  border-bottom-left-radius: 4px;
}

.msg-bubble.bot {
  align-self: flex-end;
  background: var(--accent-black);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-bubble-time {
  display: block;
  font-size: 0.65rem;
  margin-top: 0.35rem;
  text-align: right;
  opacity: 0.75;
}

.active-reply-bar {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #ffffff;
}

.reply-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 9999px;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  outline: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.reply-input:focus {
  background: #ffffff;
  border-color: var(--border-focus);
}

.reply-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-black);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.reply-send-btn svg {
  width: 16px;
  height: 16px;
  transform: translateX(1px);
}

.reply-send-btn:hover {
  transform: scale(1.05);
}

/* ==========================================================================
   VIEW 3: KNOWLEDGE BASE / FORM EDITOR
   ========================================================================== */
.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.k-field-group {
  margin-top: 1.25rem;
}

.k-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.k-input, .k-select, .k-textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.k-input.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: #f0f1f4;
}

.k-textarea {
  resize: vertical;
  line-height: 1.55;
}

.k-input:focus, .k-select:focus, .k-textarea:focus {
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  background: var(--accent-black);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  transition: var(--transition);
}

.btn-primary-action:hover {
  background: #27272a;
  transform: translateY(-1px);
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary-action:hover {
  background: var(--bg-subtle);
}

/* Switches in Settings */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.switch-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.switch-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: var(--accent-black);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Code Preview Block */
.code-preview {
  margin-top: 1rem;
  background: #111113;
  color: #f4f4f5;
  padding: 1.25rem;
  border-radius: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
}

/* ==========================================================================
   MODAL LOGIN / SWITCH BUSINESS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 28px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border-card);
  text-align: center;
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.login-logo-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  margin: 0 auto 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.login-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.45;
}

.login-form {
  margin-top: 1.75rem;
  text-align: left;
}

.login-field {
  margin-bottom: 1.5rem;
}

.login-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrap svg {
  position: absolute;
  left: 1rem;
  width: 17px;
  height: 17px;
  color: var(--text-dim);
}

.login-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.85rem;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1.5px solid transparent;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-main);
  text-transform: uppercase;
  outline: none;
}

.login-input:focus {
  background: #ffffff;
  border-color: var(--border-focus);
}

.login-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
  display: block;
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Toast */
.dash-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  background: var(--accent-black);
  color: #ffffff;
  padding: 0.85rem 1.35rem;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dash-toast.hidden {
  display: none;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.toast-icon {
  width: 18px;
  height: 18px;
  color: var(--status-green);
}

.toast-msg {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ========================================================================== */
@media (max-width: 1100px) {
  .stats-hero-grid {
    grid-template-columns: 1fr;
  }
  .dash-split-grid {
    grid-template-columns: 1fr;
  }
  .stats-mini-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .knowledge-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dash-sidebar {
    transform: translateX(-100%);
  }
  .dash-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: block;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 90;
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .dash-main {
    margin-left: 0;
  }
  .menu-toggle-btn {
    display: block;
  }
  .live-chat-board {
    grid-template-columns: 1fr;
    height: auto;
  }
  .chat-conversation-panel {
    display: none; /* Mobile view can toggle */
  }
  .chat-conversation-panel.mobile-active {
    display: flex;
  }
}

@media (max-width: 600px) {
  .dash-topbar {
    padding: 0.75rem 1rem;
  }
  .dash-view {
    padding: 1.25rem 1rem 3rem;
  }
  .system-status-pill {
    display: none; /* Save space on small screens */
  }
  .stats-mini-grid {
    grid-template-columns: 1fr;
  }
  .hero-huge-num {
    font-size: 2.75rem;
  }
  .chart-title-num {
    font-size: 1.6rem;
  }
  .view-header {
    flex-direction: column;
    align-items: stretch;
  }
  .period-switcher {
    width: 100%;
    justify-content: center;
  }
}
