/* ============ GLOBAL RESET ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #ffffff;
  --bg-darker: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border: rgba(33, 76, 119, 0.22);
  --border-subtle: rgba(33, 76, 119, 0.14);
  --text-primary: #214c77;
  --text-secondary: rgba(33, 76, 119, 0.88);
  --text-muted: rgba(33, 76, 119, 0.65);
  --primary: #214c77;
  --primary-dark: #1a3b5d;
  --accent: #214c77;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(33, 76, 119, 0.12);
  --shadow-lg: 0 8px 28px rgba(33, 76, 119, 0.14);
  /* Visible hover/active on white surfaces */
  --hover-fill: rgba(33, 76, 119, 0.08);
  --hover-fill-strong: rgba(33, 76, 119, 0.12);
  --overlay-scrim: rgba(33, 76, 119, 0.4);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #ffffff;
  color: #214c77;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Normal text selection and clipboard behavior in editable controls */
input,
textarea,
select,
[contenteditable='true'] {
  user-select: text;
  -webkit-user-select: text;
}

.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============ MAIN HEADER - After Left Sidebar ============ */
.main-header {
  flex-shrink: 0;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: none;
  background: #ffffff;
  color: #214c77;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  grid-row: 1;
}

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

.login-btn, .logout-btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: #ffffff;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.login-btn:hover {
  background: #ffffff;
  color: #214c77;
  border-width: 2px;
  border-color: #214c77;
  box-shadow: 0 0 0 1px rgba(33, 76, 119, 0.15);
}

.logout-btn {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.product-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Header search / command palette trigger */
.header-search {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

.command-palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: none;
}

.command-palette-trigger-icon {
  font-size: 1rem;
}

.command-palette-trigger-label {
  font-weight: 500;
}

.command-palette-trigger-hint {
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: rgba(33, 76, 119, 0.7);
}

.command-palette-trigger:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
  transform: translateY(-1px);
}

.product-tab {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-tab:hover {
  background: #ffffff;
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.product-tab.active {
  background: #ffffff;
  border: 2px solid #214c77;
  color: #214c77;
  font-weight: 600;
  box-shadow: none;
}

/* ============ MAIN LAYOUT (3 COLUMNS) ============ */
.main-layout {
  display: grid;
  grid-template-columns: 90px 1fr 280px;
  grid-template-rows: auto 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 100vh;
}

/* ============ LEFT SIDEBAR - Perplexity Style (Full Height from Top) ============ */
.left-sidebar.perplexity-style {
  background: #ffffff;
  color: #214c77;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  min-height: 0;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  height: 100vh;
  width: 90px;
  grid-row: 1 / -1;
  align-self: start;
  z-index: 100; /* Above sidebar-content panel */
}

/* Company Logo at Top */
.sidebar-logo {
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.company-logo-circle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.3rem;
  color: #214c77;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.2s;
  pointer-events: auto;
  border: 2px solid rgba(33, 76, 119, 0.45);
}

.company-logo-circle:hover {
  transform: scale(1.05);
}

/* Icon Buttons - Vertical Layout */
.sidebar-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ffffff;
  border: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0.4rem 0;
  position: relative;
  transition: all 0.2s ease;
}

.sidebar-icon-btn:hover {
  background: #ffffff;
  color: #214c77;
  transform: scale(1.05);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

.sidebar-icon-btn.active {
  background: #ffffff;
  color: #214c77;
  box-shadow: inset 0 0 0 2px rgba(33, 76, 119, 0.35);
}

.sidebar-icon-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
  stroke: currentColor;
  filter: none;
}

/* Icon Label Below */
.icon-label {
  font-size: 0.7rem;
  margin-top: 0.3rem;
  text-align: center;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.2;
  text-shadow: none;
  pointer-events: none; /* Allow clicks on button */
  white-space: nowrap;
}

/* Tooltip on Hover - Disabled CSS tooltips, using JS instead */
.sidebar-icon-btn[data-tooltip] {
  position: relative;
}

/* Disable CSS tooltips to prevent sidebar hiding - using JS tooltips instead */
.sidebar-icon-btn[data-tooltip]:hover::before {
  display: none; /* Disabled */
}

.sidebar-icon-btn[data-tooltip]:hover::after {
  display: none; /* Disabled */
}

@keyframes fadeInTooltip {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Dynamic tooltip styles */
.dynamic-tooltip {
  background: #ffffff;
  color: #214c77;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 2px 14px rgba(33, 76, 119, 0.15);
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 2000;
  animation: fadeInTooltip 0.2s ease;
}

/* Navigation Icons Container */
.sidebar-nav-icons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin: 0.5rem 0 0.25rem 0;
  z-index: 10;
}

.sidebar-nav-icons .sidebar-icon-btn {
  position: relative;
  z-index: 10;
}

/* Secondary / optional icons label */
.sidebar-more-label {
  margin: 0.75rem 0 0.25rem 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Secondary icons slightly de‑emphasized */
.sidebar-icon-secondary {
  opacity: 0.85;
}

.sidebar-icon-secondary:hover {
  opacity: 1;
}

/* New Chat Button */
.new-chat-btn {
  background: #ffffff !important;
}

.new-chat-btn:hover {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

/* Notifications Button */
.notifications-btn {
  margin-top: 0.5rem;
}

/* Account Section */
.sidebar-account {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.sidebar-account .account-btn {
  position: relative;
  z-index: 10;
}

.account-btn {
  width: 44px;
  height: auto;
  flex-direction: column;
  position: relative;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #214c77 !important;
  font-weight: 600;
  font-size: 1.2rem;
  position: relative;
  margin-bottom: 0.3rem;
  box-shadow: none;
  border: 2px solid rgba(33, 76, 119, 0.4);
  pointer-events: none; /* Let parent button handle clicks */
}

.status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(33, 76, 119, 0.25);
}

.account-btn .chevron-down {
  margin-top: 0.25rem;
  opacity: 0.7;
}

.account-btn:hover .chevron-down {
  opacity: 1;
}

/* Login/Signup Buttons Below Account */
.sidebar-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  width: 100%;
  padding: 0 0.25rem;
}

.sidebar-login-btn,
.sidebar-signup-btn {
  width: 100%;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.65rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-login-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.sidebar-signup-btn {
  background: #ffffff;
  border-color: #214c77;
  color: #214c77;
}

.sidebar-signup-btn:hover {
  background: #ffffff;
  transform: scale(1.02);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

/* Hide auth buttons when logged in */
.sidebar-auth-buttons.hidden {
  display: none;
}

.sidebar-content {
  position: fixed;
  left: 90px; /* Start right after left sidebar (updated width) */
  top: 0; /* Start from top, will be pushed down by header */
  bottom: 0;
  width: 320px;
  background: #ffffff;
  color: #214c77;
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  padding-top: calc(80px + 1.5rem); /* Add header height to padding-top */
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 100vh;
  z-index: 50; /* Below left sidebar, above main content */
  opacity: 0; /* Closed: invisible */
  visibility: hidden; /* Hidden from interaction */
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: none;
  pointer-events: none; /* Don't block clicks when hidden */
}

/* Left sidebar content visible ONLY when explicitly opened via JS (.open) */
.sidebar-content.open {
  opacity: 1; /* Open: fade in */
  visibility: visible; /* Visible for interaction */
  pointer-events: auto; /* Allow clicks when visible */
}

.sidebar-panel {
  display: none;
}

.sidebar-panel.active {
  display: block;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
  color: #214c77;
}

.history-item:hover {
  background: #ffffff;
  border-color: #214c77;
}

.history-item-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.history-item-menu {
  position: relative;
  flex-shrink: 0;
}

.history-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.history-item:hover .history-menu-btn {
  opacity: 1;
}

.history-menu-btn:hover {
  background: #ffffff;
  color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

.history-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  min-width: 120px;
  overflow: hidden;
}

.history-menu-item {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.history-menu-item:hover {
  background: #ffffff;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.35);
}

.history-menu-item svg {
  flex-shrink: 0;
}

.history-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.history-item-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-history {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Clear All button removed - now using individual thread deletion */

.setting-item {
  margin-bottom: 1.5rem;
}

.setting-item label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.setting-item select,
.setting-item input[type="checkbox"] {
  width: 100%;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.85rem;
}

/* ============ CENTER CONTENT ============ */
.center-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
  color: #214c77;
  grid-row: 2;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.product-header {
  flex-shrink: 0;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
}

.product-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.product-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.chat-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.65rem 1rem 1rem;
  background: #ffffff;
}

/* One horizontal row: persona + level + format; scroll on small screens */
.chat-controls-bar {
  flex-shrink: 0;
  padding: 0.15rem 0 0.35rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.chat-controls-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.15rem;
}

.chat-control-segment {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.chat-control-persona {
  gap: 0.35rem;
}

.persona-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.persona-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.28rem;
  align-items: center;
}

.persona-pill {
  box-sizing: border-box;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: rgba(33, 76, 119, 0.88);
  font-size: 0.7rem;
  line-height: 1.25;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.persona-pill:hover {
  border-color: #214c77;
  color: #214c77;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.08);
}

.persona-pill.active {
  border: 2px solid #214c77;
  background: #ffffff;
  color: #214c77;
  font-weight: 600;
}

.chat-pref-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.chat-pref-label {
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-pref-group select {
  background: #ffffff;
  color: #214c77;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.16rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.25;
  max-width: min(52vw, 14rem);
  cursor: pointer;
  flex-shrink: 0;
}

/* Product context card: inside #messages, single scroll with chat (never sticky/fixed) */
.message-row.product-context {
  display: block;
  width: 100%;
  flex-shrink: 0;
  position: relative;
}

.product-context-card {
  margin: 0 0 0.5rem 0;
  padding: 1rem 1.1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: #214c77;
  max-width: 100%;
}

.product-context-source-wrap {
  margin: 0 0 0.45rem 0;
}

.product-context-source-wrap .product-context-official-link {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(33, 76, 119, 0.82);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-context-source-wrap .product-context-official-link:hover {
  color: #163a5c;
}

.product-hero-inner {
  display: grid;
  grid-template-columns: minmax(100px, 140px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 640px) {
  .product-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .product-hero-media {
    margin: 0 auto;
  }
  .hero-product-chips {
    justify-content: center;
  }

  .chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-hero-inner {
    grid-template-columns: 48px minmax(0, 1fr);
    text-align: left;
  }
  .chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-hero-media {
    margin: 0;
  }
}

.product-hero-media {
  position: relative;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
}

.hero-product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #214c77;
  letter-spacing: 0.02em;
}

.hero-product-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  color: #214c77;
}

.hero-product-title .product-context-title-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(33, 76, 119, 0.35);
}

.hero-product-title .product-context-title-link:hover {
  border-bottom-color: #214c77;
}

.product-context-page-label {
  margin: -0.15rem 0 0.45rem 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(33, 76, 119, 0.62);
}

.product-context-trust-line {
  margin: 0 0 0.55rem 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(33, 76, 119, 0.58);
}

.hero-product-intro {
  margin: 0 0 0.65rem 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(33, 76, 119, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-product-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.hero-chip-apps {
  display: contents;
}

.hero-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  background: #ffffff;
  color: #214c77;
  border: 1px solid rgba(33, 76, 119, 0.35);
}

.hero-chip-app {
  background: #ffffff;
  border-color: rgba(33, 76, 119, 0.3);
}

.hero-details-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hero-details-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.hero-chat-hint {
  margin: 0.75rem 0 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: rgba(33, 76, 119, 0.75);
  text-align: center;
}

/* Product Knowledge Actions + Product Range (visible even when hero is compact) */
.product-knowledge-panel {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(33, 76, 119, 0.12);
}

.product-knowledge-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(33, 76, 119, 0.65);
  margin-bottom: 0.4rem;
}

.product-knowledge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.product-knowledge-action-btn,
.product-knowledge-suggest-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(33, 76, 119, 0.35);
  background: rgba(33, 76, 119, 0.04);
  color: #214c77;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.product-knowledge-action-btn:hover,
.product-knowledge-suggest-btn:hover {
  border-color: #214c77;
  background: rgba(33, 76, 119, 0.08);
}

.product-knowledge-meta,
.product-knowledge-variant-line {
  margin: 0 0 0.4rem 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: rgba(33, 76, 119, 0.82);
}

.product-knowledge-variant-line {
  font-style: italic;
}

.product-range-heading {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(33, 76, 119, 0.7);
  margin: 0.35rem 0 0.3rem 0;
}

.product-range-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.product-range-chip {
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(33, 76, 119, 0.28);
  background: #fff;
  color: #214c77;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-range-chip:hover {
  border-color: #214c77;
  box-shadow: 0 1px 4px rgba(33, 76, 119, 0.12);
}

.product-knowledge-section-view {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(33, 76, 119, 0.2);
  background: #ffffff;
}

.product-knowledge-section-head {
  font-size: 0.95rem;
  font-weight: 600;
  color: #214c77;
  margin: 0 0 0.45rem 0;
}

.product-knowledge-section-body {
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(33, 76, 119, 0.9);
  white-space: pre-wrap;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  margin-bottom: 0.55rem;
}

.product-knowledge-suggest-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(33, 76, 119, 0.55);
  margin-bottom: 0.35rem;
}

.product-knowledge-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.product-knowledge-close-btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.74rem;
  border-radius: 8px;
  border: 1px dashed rgba(33, 76, 119, 0.35);
  background: #ffffff;
  color: #214c77;
  cursor: pointer;
}

.product-knowledge-close-btn:hover {
  border-style: solid;
  border-color: #214c77;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-knowledge-panel {
  display: block !important;
}

.product-context-toggle {
  display: none;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px dashed rgba(33, 76, 119, 0.35);
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  color: #214c77;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.product-context-toggle:hover {
  border-color: #214c77;
  background: rgba(33, 76, 119, 0.04);
}

.chat-container:not(.chat-started) .product-context-toggle {
  display: none !important;
}

.chat-container.chat-started .product-context-toggle {
  display: block;
}

/* After first user message: compact strip; full card still available via scroll up + Expand */
.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) {
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-context-source-wrap {
  margin: 0 0 0.2rem 0;
}

.chat-container.chat-started
  .message-row.product-context
  .product-context-card:not(.is-expanded)
  .product-context-source-wrap
  .product-context-official-link {
  font-size: 0.68rem;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-hero-inner {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-hero-media {
  max-width: 52px;
  width: 52px;
  aspect-ratio: 1;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-image-placeholder {
  font-size: 0.95rem;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-product-intro,
.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-product-chips,
.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-details-btn,
.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-chat-hint.product-context-hint {
  display: none !important;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .hero-product-title {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-container.chat-started .message-row.product-context .product-context-card:not(.is-expanded) .product-context-toggle {
  margin-top: 0.35rem;
}

.chat-container.chat-started .message-row.product-context .product-context-card.is-expanded .product-context-toggle {
  margin-top: 0.65rem;
}

.message-row.chat-context-notice {
  justify-content: center;
}

.chat-context-notice-inner {
  max-width: 90%;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px dashed rgba(33, 76, 119, 0.35);
  color: rgba(33, 76, 119, 0.8);
  font-size: 0.78rem;
  text-align: center;
}

.messages {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.2rem 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #ffffff;
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.bot {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 75%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

.message-bubble.user {
  background: #ffffff;
  color: #214c77;
  border: 1px solid var(--border);
  border-bottom-right-radius: 0.25rem;
}

.message-bubble.bot {
  background: #ffffff;
  color: #214c77;
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
}

.message-meta {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  opacity: 0.7;
  font-weight: 500;
}

.message-body {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-bubble {
  position: relative;
  transition: all 0.2s;
}

.message-bubble:hover .message-actions {
  opacity: 1 !important;
}

.message-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  pointer-events: auto;
}

.message-action-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #214c77;
  backdrop-filter: none;
  transition: all 0.2s;
}

.message-action-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  transform: scale(1.05);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.message-bubble.user .message-action-btn {
  background: #ffffff;
}

.message-bubble.user .message-action-btn:hover {
  background: #ffffff;
  border-color: #214c77;
}

.message-edit-input {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 0.5rem;
}

.message-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.edit-save-btn,
.edit-cancel-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.edit-save-btn {
  background: #ffffff;
  color: #214c77;
  border: 2px solid #214c77;
}

.edit-save-btn:hover {
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

.edit-cancel-btn {
  background: #ffffff;
  color: #214c77;
  border: 1px solid var(--border);
}

.edit-cancel-btn:hover {
  background: #ffffff;
  color: #214c77;
  border-color: #214c77;
}

/* ============ GOOGLE LOGIN BUTTON ============ */
.google-login-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.google-login-btn:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.google-login-btn svg {
  flex-shrink: 0;
}

.streaming-body.typing {
  animation: typing-pulse 1.2s ease-in-out infinite;
}
@keyframes typing-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.input-container {
  flex-shrink: 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.attach-pdf-btn {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.attach-pdf-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

#chat-input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  min-height: 48px;
  max-height: 120px;
}

#chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.15);
}

#send-btn {
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid #214c77;
  background: #ffffff;
  color: #214c77;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s;
  flex-shrink: 0;
}

#send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(33, 76, 119, 0.12);
}

#send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-pdf-status {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-height: 1.5rem;
}

.empty-state {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.empty-state h2 {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.empty-state .welcome-sub {
  margin: 0.5rem auto 0;
  max-width: 28rem;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.92;
}

.empty-state ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.empty-state li {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #214c77;
}

/* ============ RIGHT SIDEBAR ============ */
/* ============ RIGHT SIDEBAR - Traditional Style (Below Header) ============ */
.right-sidebar {
  background: #ffffff;
  color: #214c77;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  grid-row: 2;
  align-self: start;
}

/* Custom scrollbar for right sidebar */
.right-sidebar::-webkit-scrollbar {
  width: 8px;
}

.right-sidebar::-webkit-scrollbar-track {
  background: rgba(33, 76, 119, 0.06);
  border-radius: 4px;
}

.right-sidebar::-webkit-scrollbar-thumb {
  background: rgba(33, 76, 119, 0.28);
  border: 2px solid rgba(33, 76, 119, 0.08);
  border-radius: 4px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(33, 76, 119, 0.4);
  border-color: rgba(33, 76, 119, 0.2);
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.related-products-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.related-product {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  color: #214c77;
}

.related-product:hover {
  background: #ffffff;
  border-color: #214c77;
  transform: translateX(4px);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.08);
}

.related-product-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.related-product-specs {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cta-section {
  background: #ffffff;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  font-size: 0.85rem;
  color: #214c77;
}

.cta-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.cta-btn {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.75rem;
}

.cta-btn.whatsapp {
  background: #ffffff;
  color: #214c77;
  border: 2px solid #214c77;
}

.cta-btn.whatsapp:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(33, 76, 119, 0.1);
}

.cta-btn.phone {
  background: #ffffff;
  color: #214c77;
  border: 1px solid var(--border);
}

.cta-btn.phone:hover {
  background: #ffffff;
  border-color: #214c77;
}

/* ============ PDF UPLOAD SECTION ============ */
.pdf-upload-simple {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #214c77;
}

.pdf-upload-simple input[type="file"] {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.85rem;
}

.pdf-upload-simple button {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid #214c77;
  background: #ffffff;
  color: #214c77;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.85rem;
}

.pdf-upload-simple button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdf-upload-simple #upload-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

/* ============ VOICE INPUT BUTTON ============ */
.voice-btn {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.voice-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.voice-btn.active {
  background: #ffffff;
  color: #214c77;
  border: 2px solid #214c77;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============ MODAL ============ */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-scrim);
  backdrop-filter: none;
}

.modal-content {
  background: #ffffff;
  margin: 5% auto;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  color: #214c77;
}

.close {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: var(--text-primary);
}

.modal-form {
  margin-top: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.generate-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  border: 2px solid #214c77;
  background: #ffffff;
  color: #214c77;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(33, 76, 119, 0.12);
}

.generated-content {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.6;
  color: #214c77;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

.error {
  color: #b91c1c;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid rgba(185, 28, 28, 0.45);
  border-radius: var(--radius-sm);
}

.success {
  color: #214c77;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid rgba(33, 76, 119, 0.4);
  border-radius: var(--radius-sm);
}

.modal-content a {
  color: #214c77;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.modal-content a:hover {
  text-decoration: underline;
}

/* Product Search & Details (View full product details) — white panel only */
#product-description-modal .modal-content {
  background-color: #ffffff;
  background: #ffffff;
  color: #214c77;
}

#product-description-modal .modal-content h2 {
  color: #214c77;
}

#product-description-modal .form-group label {
  color: #214c77;
}

#product-description-modal .close {
  color: rgba(33, 76, 119, 0.55);
}

#product-description-modal .close:hover {
  color: #214c77;
}

#product-description-modal .product-list-container {
  background-color: #ffffff;
}

#product-description-modal .discover-product-details {
  background-color: #ffffff;
  color: #214c77;
}

#product-description-modal .discover-product-details h4 {
  color: #214c77;
}

#product-description-modal .discover-detail-specs {
  color: #214c77;
}

#product-description-modal .discover-detail-desc,
#product-description-modal .discover-detail-apps {
  color: rgba(33, 76, 119, 0.9);
}

#product-description-modal .product-item-name {
  color: #214c77;
}

#product-description-modal .product-item-desc {
  color: rgba(33, 76, 119, 0.82);
}

#product-description-modal .loading-products,
#product-description-modal .no-products {
  color: rgba(33, 76, 119, 0.75);
}

/* ============ PRODUCT SEARCH & LIST ============ */
.product-list-container {
  position: relative;
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  z-index: 10;
}

.product-list {
  display: flex;
  flex-direction: column;
}

.product-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s, border-color 0.2s;
  color: #214c77;
}

.product-item:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(33, 76, 119, 0.2);
}

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

.product-item-name {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.product-item-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-products,
.no-products {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

/* Discover: Product Search & Details */
.discover-search-wrap {
  margin: 0.75rem 0;
}
.discover-search-wrap input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
}
.discover-product-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  margin-bottom: 1rem;
}
.discover-product-list .product-item {
  border-bottom: 1px solid var(--border);
}
.discover-product-details {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  margin-top: 0.5rem;
  color: #214c77;
}
.discover-product-details h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.discover-detail-specs {
  font-size: 0.85rem;
  color: var(--primary);
  margin: 0.25rem 0;
}
.discover-detail-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
  line-height: 1.4;
}
.discover-detail-apps {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
}
.discover-detail-apps ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}
.discover-product-details .action-btn {
  margin-top: 0.75rem;
  width: 100%;
}

.selected-product-info {
  margin: 1rem 0;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: #214c77;
}

#product-search {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
}

#product-search:focus {
  border-color: var(--primary);
  outline: none;
}

/* ============ DASHBOARD ============ */
#dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: #214c77;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-btn {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.08);
}

/* ============ FEATURE BUTTONS ============ */
.feature-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  text-align: left;
}

.feature-btn:hover {
  background: #ffffff;
  border-color: #214c77;
  transform: translateX(4px);
}

.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recommendation-item {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  color: #214c77;
}

.recommendation-item:hover {
  background: #ffffff;
  border-color: #214c77;
}

/* ============ CUSTOM SCROLLBARS ============ */
/* Global scrollbar styling for all scrollable areas */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(33, 76, 119, 0.06);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(33, 76, 119, 0.28);
  border: 2px solid rgba(33, 76, 119, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(33, 76, 119, 0.4);
  border-color: rgba(33, 76, 119, 0.2);
}

/* ============ SOURCES ============ */
.sources {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: #214c77;
  background: #ffffff;
  padding: 0.25rem 0;
  border-radius: 0;
  display: inline;
}

.sources a {
  color: #214c77;
  font-weight: 600;
  text-decoration: underline;
  margin-right: 0.5rem;
}

.sources a:hover {
  text-decoration: underline;
}

/* ============ INLINE PRODUCT & SUGGESTION BUTTONS ============ */
.product-suggestions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.product-suggestion-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 2px solid #214c77;
  background: #ffffff;
  color: #214c77;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.product-suggestion-btn:hover {
  background: #ffffff;
  color: #214c77;
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.inline-product-link {
  display: inline-block;
  margin: 0 2px;
  padding: 0 0.1rem;
  border-radius: 4px;
  border-bottom: 1px dashed #214c77;
  color: #214c77;
  font-weight: 600;
  background: #ffffff;
  cursor: pointer;
}

.inline-product-link:hover {
  text-decoration: underline;
}

/* ============ COMMAND PALETTE (Cmd+K style) ============ */
.command-palette-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: var(--overlay-scrim);
  backdrop-filter: none;
  z-index: 1200;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.command-palette-modal.open {
  display: flex;
  opacity: 1;
}

.command-palette-card {
  width: min(640px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: commandPaletteIn 0.18s ease-out;
}

.command-palette-header {
  padding: 0.9rem 1rem 0.35rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.command-palette-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.command-palette-input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #214c77;
  font-size: 0.95rem;
  outline: none;
}

.command-palette-input::placeholder {
  color: rgba(33, 76, 119, 0.45);
}

.command-palette-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.12);
}

.command-palette-hint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.command-palette-results {
  max-height: 340px;
  overflow-y: auto;
  padding: 0.4rem 0.2rem 0.4rem;
}

.command-palette-section-title {
  padding: 0.4rem 1.1rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(33, 76, 119, 0.55);
}

.command-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #214c77;
  border-radius: 10px;
  margin: 0.05rem 0.7rem;
  transition: box-shadow 0.12s ease, transform 0.08s ease, border-color 0.12s ease;
  border: 1px solid transparent;
}

.command-palette-item:hover {
  background: #ffffff;
  border-color: rgba(33, 76, 119, 0.2);
}

.command-palette-item.active {
  background: #ffffff;
  color: #214c77;
  transform: translateY(-1px);
  border-color: #214c77;
  box-shadow: 0 0 0 2px rgba(33, 76, 119, 0.1);
}

.command-palette-item-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.command-palette-item-title {
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.command-palette-item-subtitle {
  font-size: 0.8rem;
  color: rgba(33, 76, 119, 0.7);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.command-palette-item.active .command-palette-item-subtitle {
  color: rgba(33, 76, 119, 0.75);
}

.command-palette-item-meta {
  font-size: 0.75rem;
  color: rgba(33, 76, 119, 0.5);
  margin-left: 0.5rem;
}

.command-palette-item-action {
  font-size: 0.85rem;
  color: rgba(33, 76, 119, 0.65);
}

.command-palette-item.active .command-palette-item-action {
  color: rgba(33, 76, 119, 0.75);
}

@keyframes commandPaletteIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 90px 1fr 280px;
  }
}

@media (max-width: 968px) {
  .main-layout {
    grid-template-columns: 0 1fr 0;
  }
  
  .main-layout {
    grid-template-columns: 90px 1fr;
  }
  
  .left-sidebar.perplexity-style {
    width: 90px;
  }
  
  .sidebar-content {
    width: 300px;
    left: 90px;
  }
  
  .right-sidebar {
    width: 280px;
  }
  
  .left-sidebar,
  .right-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .left-sidebar.perplexity-style {
    transform: translateX(0);
  }
  
  .left-sidebar.open {
    transform: translateX(0);
  }
  
  .right-sidebar {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }
  
  .right-sidebar.open {
    transform: translateX(0);
  }
}

@media (max-width: 640px) {
  .main-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .product-tabs {
    width: 100%;
    overflow-x: auto;
  }
  
  .chat-container {
    padding: 1rem;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}

/* ============ Readability: hover / focus / active on white surfaces ============ */
.login-btn:hover,
.command-palette-trigger:hover,
.product-tab:hover,
.sidebar-icon-btn:hover,
.new-chat-btn:hover,
.sidebar-login-btn:hover,
.sidebar-signup-btn:hover,
.history-item:hover,
.history-menu-btn:hover,
.persona-pill:hover,
.hero-details-btn:hover,
.message-action-btn:hover,
.message-bubble.user .message-action-btn:hover,
.edit-save-btn:hover,
.edit-cancel-btn:hover,
.attach-pdf-btn:hover,
.related-product:hover,
.voice-btn:hover,
.action-btn:hover,
.feature-btn:hover,
.recommendation-item:hover,
.product-item:hover,
.product-suggestion-btn:hover,
.google-login-btn:hover,
.cta-btn.whatsapp:hover,
.cta-btn.phone:hover,
.generate-btn:hover {
  background: var(--hover-fill) !important;
}

.history-menu-item:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.35);
}

.product-tab.active,
.persona-pill.active,
.sidebar-icon-btn.active,
.command-palette-item.active {
  background: var(--hover-fill-strong) !important;
}

.command-palette-item:hover {
  background: var(--hover-fill) !important;
}

#send-btn:hover:not(:disabled) {
  background: var(--hover-fill);
}

.setting-item select:focus,
.chat-pref-group select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
#chat-input:focus,
.command-palette-input:focus {
  background: #ffffff;
  color: #214c77;
}

#chat-input::placeholder,
textarea::placeholder,
input::placeholder {
  color: rgba(33, 76, 119, 0.5);
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled,
#send-btn:disabled {
  opacity: 0.72;
  color: rgba(33, 76, 119, 0.72);
}

/* Flask /admin and /superadmin pages normally use inline CSS only; if this file is ever linked there, keep modals opaque. */
html.admin-portal,
html.superadmin-portal {
  color-scheme: light !important;
}
body.admin-portal .admin-root .modal.show > .modal-content,
body.admin-portal .admin-root .admin-modal-panel,
body.superadmin-portal .superadmin-root .modal.show > .modal-content,
body.superadmin-portal .superadmin-root .admin-modal-panel {
  position: relative !important;
  isolation: isolate !important;
  background-color: #ffffff !important;
  background-image: none !important;
  color: #214c77 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body.admin-portal .admin-root .admin-modal-inner,
body.superadmin-portal .superadmin-root .admin-modal-inner {
  position: relative;
  z-index: 1;
  background-color: #ffffff !important;
  color: #214c77 !important;
}
body.admin-portal .admin-root .modal-content.admin-modal-panel,
body.superadmin-portal .superadmin-root .modal-content.admin-modal-panel {
  max-height: none !important;
  overflow: visible !important;
}
body.admin-portal .admin-root .admin-modal-inner.admin-modal-scroll,
body.superadmin-portal .superadmin-root .admin-modal-inner.admin-modal-scroll {
  max-height: 90vh !important;
  overflow-y: auto !important;
  background-color: #ffffff !important;
}

/* Phase 3: compact trust / mode cues under bot reply */
.response-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0.4rem 0 0;
  padding: 0 0.15rem;
}
.meta-chip {
  display: inline-block;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--hover-fill);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
