/* Dashboard base variables and shared UI patterns */
:root{
  --background:         #F5F3EB;
  --background-hover:   #EFEDE5;
  --foreground:         #111111;
  --muted-foreground:   #6B6B6B;
  --rule:               #D1D5DB;
  --card-white:         #FFFFFF;
  --card-soft:          #FAFAF7;
  --soft-border:        #D4D3CB;
  --soft-border-hover:  #C0BDAD;
  --hard-border:        #000000;
}

body {
  background: var(--background);
  color: var(--foreground);
  padding-left: 1rem;
}

@media (max-width: 767px) {
  body {
    padding-inline: 8px;
  }
}

::selection {
  background: #111;
  color: #fff;
}

.ink-link {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.ink-link:hover {
  text-decoration-thickness: 2px;
}

.ink-link--active {
  text-decoration-thickness: 3px;
}

.text-muted {
  color: var(--muted-foreground);
}

.popover {
  position: relative;
  display: inline-block;
}

.popover-card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  top: 100%;
  background: var(--card-white);
  border: 1px solid var(--hard-border);
  box-shadow: 3px 3px 0 var(--hard-border);
  padding: 0.5rem 0.75rem;
  min-width: 16rem;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.popover-title {
  font-weight: 600;
  font-size: 0.825rem;
  margin-bottom: 0.25rem;
}

.popover-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.popover-card::before {
  content: "";
  position: absolute;
  top: -5.785px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--card-white);
  border-left: 1px solid var(--hard-border);
  border-top: 1px solid var(--hard-border);
}

.popover[data-pinned="true"] .popover-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(16px);
}

.popover[data-pinned="false"] .popover-card {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(20px) !important;
}

.footer-line {
  border-top: 1px solid var(--hard-border);
}

/* Dashboard-specific type scale tweaks (scoped to dashboard content only) */
.dashboard-content {
  font-size: 1.0625rem; /* ~17px base */
  line-height: 1.6;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}
.dashboard-content p { line-height: 1.65; }

/* Sidebar navigation */
.dashboard-sidebar {
  background: #ede5d2;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.6),
    6px 0 18px rgba(53, 47, 37, 0.12);
  border-right: 1px solid rgba(37, 35, 31, 0.08);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  transition: width 200ms ease, padding 200ms ease;
}

.dashboard-sidebar.sidebar-expanded {
  width: 15rem;
}

@media (min-width: 768px) {
  .dashboard-sidebar.sidebar-expanded {
    width: 15.5rem;
  }
}

.dashboard-sidebar.sidebar-collapsed {
  width: 5rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.dashboard-sidebar .sidebar-nav,
.dashboard-sidebar .sidebar-footer {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.7rem;
  background: rgba(34, 31, 28, 0.06);
  color: #1f1f1f;
}

.sidebar-brand {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding-right: 2.4rem;
}

.sidebar-brand-stack {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  align-items: flex-start;
}

.sidebar-brand-mark {
  font-family: 'Fraunces', ui-serif, Georgia, serif;
  font-size: 2.4rem;
  line-height: 1;
  color: #1f1f1f;
}

.sidebar-brand-mark:hover {
  color: #312e29;
}

.sidebar-brand-title {
  font-family: 'Fraunces', ui-serif, Georgia, serif;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: #1f1f1f;
}

.sidebar-brand-title:hover {
  color: #312e29;
}

.sidebar-brand-bar {
  width: 92px;
  height: 6px;
  object-fit: cover;
  border-radius: 999px;
}

.dashboard-colorbar {
  transform: scaleX(0.15);
  transform-origin: left;
}


.sidebar-brand-bar--desktop {
  display: block;
}


.sidebar-toggle {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(41, 37, 31, 0.28);
  background: #f5efe0;
  color: #2b2721;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease, border 160ms ease;
}

.sidebar-toggle:hover {
  background: #ede2cb;
  color: #181612;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: #2b2721;
}

.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(41, 37, 31, 0.18);
  border-radius: 9999px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dashboard-scroll-anchor {
  scroll-margin-top: var(--dashboard-anchor-offset, 140px);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-divider {
  width: 100%;
  height: 1px;
  margin-top: 1px;
  margin-bottom: 1px;
  background: rgba(37, 35, 31, 0.12);
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem;
  border-radius: 0.8rem;
  color: #000;
  font-weight: 500;
  line-height: 1.28;
  transition: background-color 160ms ease, color 160ms ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background-color: rgba(29, 26, 23, 0.08);
  color: #000;
}

.sidebar-link:focus-visible {
  outline: 2px solid rgba(29, 26, 23, 0.2);
  outline-offset: 2px;
}

.sidebar-link--section {
  font-weight: 600;
  letter-spacing: 0.005em;
  padding-inline: 0.85rem;
  margin-bottom: 0.1rem;
}

.sidebar-link--child {
  padding-left: 1.8rem;
  color: #000;
}

.sidebar-link--home {
  color: #000;
}

.sidebar-link--active {
  background: rgba(249, 115, 22, 0.12);
  color: #000;
}

.sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  color: inherit;
  opacity: 0.78;
  transition: opacity 160ms ease, transform 160ms ease;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: inherit;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.sidebar-material-icon {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.sidebar-icon-img {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-brand-title,
.dashboard-sidebar.sidebar-collapsed .sidebar-brand-bar,
.dashboard-sidebar.sidebar-collapsed .sidebar-link-text,
.dashboard-sidebar.sidebar-collapsed .sidebar-subnav {
  display: none;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-brand-stack {
  align-items: center;
  order: 1;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-toggle {
  position: static;
  width: 2.2rem;
  height: 2.2rem;
  order: 0;
  margin-bottom: 0.15rem;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.55rem;
}

.dashboard-sidebar.sidebar-collapsed .sidebar-divider {
  margin-left: auto;
  margin-right: auto;
  width: 60%;
}

body.sidebar-collapsed .dashboard-text {
  padding-left: 6.2rem !important;
}

body.sidebar-expanded .dashboard-text {
  padding-left: 13.5rem !important;
}

.config-form {
  width: 100%;
}

.config-form input,
.config-form select {
  width: 100%;
}

@media (max-width: 640px) {
  .config-form {
    padding-right: 0.75rem;
  }
  .dashboard-text {
    padding-left: 6.5rem !important;
  }
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link:focus-visible .sidebar-link-icon,
.sidebar-link--active .sidebar-link-icon {
  opacity: 1;
  transform: translateX(0.3px);
}

.sidebar-link-text {
  font-size: inherit;
  letter-spacing: 0.01em;
}

.sidebar-footer {
  position: relative;
  margin-top: auto;
}

.sidebar-footer-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.5rem;
  padding-bottom: 0.01rem;
  color: #000;
}

.sidebar-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(37, 35, 31, 0.12);
}

.sidebar-link--footer {
  padding-inline: 0.5rem;
  gap: 0.25rem;
  line-height: 1.25;
}

.sidebar-profile-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-weight: 600;
  border-radius: 9999px;
  background: #f6f0e1;
  border: 1px solid rgba(67, 60, 51, 0.28);
  color: #000;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(41, 37, 31, 0.18);
}

.sidebar-link-icon--home { color: #e27232; }
.sidebar-link-icon--stats { color: #3b82f6; }
.sidebar-link-icon--insights { color: #6366f1; }
.sidebar-link-icon--funnel { color: #0ea5e9; }
.sidebar-link-icon--notifications { color: #f59e0b; }
.sidebar-link-icon--custom { color: #10b981; }
.sidebar-link-icon--compare { color: #42506a; }
.sidebar-link-icon--ask { color: #433c33; }
.sidebar-link-icon--call-log { color: #14b8a6; }
.sidebar-link-icon--customer-insights { color: #fb7185; }

.sidebar-link-icon--settings,
.sidebar-link-icon--profile {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}
.sidebar-link-icon--settings { color: #8b5cf6; }
.sidebar-link-icon--profile { color: #433c33; }

.sidebar-link-icon--notifications {
  position: relative;
}

.sidebar-link-icon--notifications .sidebar-link-indicator {
  position: absolute;
  top: -0.1rem;
  right: -0.15rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.45);
  pointer-events: none;
}

/* Subtle elevated card for section boxes */
.card-elevated {
  /* soft ring + stronger base shadow */
  box-shadow:
    0 0 0 1px rgba(16, 24, 40, 0.05),
    0 2px 4px rgba(16, 24, 40, 0.06),
    0 8px 20px rgba(16, 24, 40, 0.08);
  border-color: #d1d5db !important; /* slightly darker than gray-200 */
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.card-elevated:hover {
  box-shadow:
    0 0 0 1px rgba(16, 24, 40, 0.06),
    0 4px 10px rgba(16, 24, 40, 0.10),
    0 14px 28px rgba(16, 24, 40, 0.12);
}

/* Subtle accent card (used for Add Metric) */
.card-accent {
  background: #fbfcff !important; /* faint blue tint */
  border-color: #e7ecff !important;
}

/* Metric display styling */
.dashboard-content .stat-number,
.dashboard-content .metric-number {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
/* Conversational Flow Funnel */
.dashboard-content .funnel-wrap { width: 100%; }
.dashboard-content .funnel { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dashboard-content .funnel-seg { position: relative; height: 44px; max-width: 920px; background: linear-gradient(90deg, #c7d2fe 0%, #93c5fd 100%); border: 1px solid #d1d5db; box-shadow: 0 1px 0 rgba(17,24,39,0.05);
  --slant: 18px; clip-path: polygon(var(--slant) 0, calc(100% - var(--slant)) 0, 100% 100%, 0 100%);
}
.dashboard-content .funnel-seg__text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #111827; text-align: center; padding: 0 44px; }
.dashboard-content .funnel-chip { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); font-size: 11px; padding: 2px 8px; border-radius: 9999px; border: 1px solid #e5e7eb; background: #fff; }

.dashboard-content .journey-funnel-host { height: auto; min-height: 0; aspect-ratio: 1000 / 220; }


@keyframes aiEdgeIdle {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* --- Mobile layout adjustments (dashboard only) --- */
@media (max-width: 767px) {
  /* Remove global body left padding from site styles on dashboard */
  body { padding-left: 0; padding-right: 6px; }
  /* Align header '=' with sidebar '=' */
  .dashboard-text { margin-top: 0 !important; }
  /* Tighter right gutter */
  .dashboard-shell { padding-right: 6px !important; }
  .dashboard-text { padding-right: 6px !important; }
  aside.fixed { padding-top: 0.9rem !important; }
  .sidebar-logo { transform: translateY(0) !important; }
  /* Bigger funnel + tighter card padding */
  /* Match padding with other cards (p-4 ~ 16px) */
  #conversationFlowCard { padding: 16px !important; }
  #conversationFlowCard p.text-sm { margin-bottom: 8px !important; }
  /* Match SVG aspect ratio to current mobile viewHeight (260) and bleed to card edges */
  .dashboard-content .journey-funnel-host { height: auto; min-height: 0; aspect-ratio: 1000 / 260; }
  /* Bleed the funnel to the card edges on mobile to maximize width */
  /* Increase mobile side padding by 2px on each side (total +4px) */
  #conversationFlowCard .journey-funnel-host { width: calc(100% + 26px); margin-left: -13px; margin-right: -13px; }
  /* Reduce vertical spacing around the funnel */
  #conversationFlowCard > .flex { margin-bottom: 2px !important; }
  #conversationFlowCard > p { margin-bottom: 6px !important; }
  #journeyFunnel { margin-top: 20px !important; margin-bottom: 20px !important; }
  #journeyFunnelInsight { margin-top: 8px !important; }
}
.sidebar-link--stats { color: #000; }
.sidebar-link--insights { color: #000; }
.sidebar-link--funnel { color: #000; }
.sidebar-link--notifications { color: #000; }
.sidebar-link--custom { color: #000; }
.sidebar-link--compare { color: #000; }
.sidebar-link--customer-insights { color: #000; }
.sidebar-link--ask { color: #000; }
.sidebar-link--settings { color: #000; }
.sidebar-link--profile { color: #000; }
