:root {
  --accent: #522eff;
  --accent-hover: #2d18c9;
  --ink: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: rgba(0, 0, 0, 0.07);
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --canvas: #fcfcfc;
  --green: #087e00;
  --green-bg: #f2fbf1;
  --yellow: #6b7280;
  --yellow-bg: #f5f5f5;
  --red: #6b7280;
  --red-bg: #f5f5f5;
  --blue: #555555;
  --blue-bg: #f5f5f5;
  --cyan-text: #555555;
  --cyan-bg: #f5f5f5;
  --radius: 6px;
  --shadow-card: 0 0 4px rgba(0, 0, 0, 0.02);
}

@font-face {
  font-family: 'Baikal';
  src: url('Baikal-VF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: 'Baikal', -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  font-weight: 350;
  letter-spacing: 0;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.app-shell {
  display: flex;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  width: 200px;
  min-width: 200px;
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: auto;
  margin-bottom: 22px;
  padding: 0 16px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 86px;
  height: auto;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 29px;
  padding: 6px 10px;
  color: #555555;
  background: transparent;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font-size: 14px;
  font-weight: 380;
}

.nav-item:hover,
.nav-item.is-active {
  color: #000000;
  background: #f3f4f6;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #8e8e8e;
}

.nav-icon iconify-icon {
  font-size: 20px;
  line-height: 1;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: auto 10px 0;
  padding: 9px 10px;
  color: var(--text-secondary);
  background: var(--surface-soft);
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 13px;
}

.sidebar-settings {
  margin: auto 10px 0;
  width: calc(100% - 20px);
}

.settings-content {
  max-width: 640px;
}

.settings-panel {
  padding: 20px 22px;
}

.settings-panel .panel-header {
  margin-bottom: 8px;
}

.settings-hint {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.settings-fetch-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-fetch-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 11px;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  font-size: 14px;
}

.settings-fetch-row input:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.3);
}

.settings-status {
  margin-bottom: 12px;
  padding: 9px 12px;
  color: #475467;
  background: #f5f7fa;
  border-radius: 8px;
  font-size: 13px;
}

.settings-status.is-error {
  color: #b42318;
  background: #fef3f2;
}

.settings-empty {
  color: #98a2b3;
  font-size: 13px;
}

.settings-profile {
  display: grid;
  gap: 10px;
}

.settings-profile-card {
  padding: 14px 16px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: 13px;
}

.settings-profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.settings-profile-head img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

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

.settings-profile-head strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.settings-profile-head span {
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-profile-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.settings-profile-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--text-secondary);
  background: transparent;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  cursor: pointer;
}

.settings-profile-delete:hover {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.3);
  background: #fef3f2;
}

.settings-profile-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-profile-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--text-secondary);
  background: transparent;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  font-size: 12.5px;
  cursor: pointer;
}

.settings-profile-toggle:hover {
  color: #111827;
  background: #f3f4f6;
}

.settings-profile-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}

.settings-profile-toggle.is-open svg {
  transform: rotate(180deg);
}

.settings-profile-details {
  margin-top: 12px;
}

.settings-profile-card p {
  margin-bottom: 8px;
  color: #475467;
  line-height: 1.5;
}

.settings-audience {
  font-style: italic;
}

.settings-profile-card h4 {
  margin: 12px 0 5px;
  font-size: 13px;
  font-weight: 500;
  color: #344054;
}

.settings-profile-remove {
  margin-top: 12px;
}

.settings-profile-card ul {
  margin: 0 0 4px;
  padding-left: 18px;
  color: #475467;
}

.settings-profile-card li {
  margin-bottom: 3px;
  line-height: 1.45;
}

.settings-profile-card .btn {
  margin-top: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 46, 255, 0.16);
}

.nav-icon svg,
.top-actions svg,
.detail-actions svg,
.filter-bar svg,
.panel-header h3 svg,
.btn svg,
.icon-btn svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  flex: 1;
  background: var(--canvas);
}

.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 24px;
  background: var(--canvas);
  border-bottom: 0.5px solid var(--border);
}

.topbar-title-row {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.detail-actions {
  display: none;
  flex-shrink: 0;
}

.topbar.is-detail .top-actions {
  display: none;
}

.topbar-eyebrow {
  display: none;
}

.topbar.is-trend-detail .topbar-search {
  display: none;
}

.topbar.is-empty-page .topbar-search,
.topbar.is-empty-page .top-actions {
  display: none;
}

.topbar.is-insights .topbar-search {
  display: none;
}

.topbar.is-chat {
  display: none;
}

.topbar.is-detail .detail-actions {
  display: none;
}

.topbar.is-trend-detail .detail-actions {
  display: flex;
}

.topbar.is-detail h1 {
  max-width: min(720px, calc(100vw - 430px));
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 300;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 380;
  white-space: nowrap;
}


.top-actions,
.detail-actions,
.filter-bar,
.view-toolbar,
.panel-header {
  display: flex;
  align-items: center;
}

.topbar:not(.is-detail) .detail-actions {
  display: none;
}

.top-actions {
  gap: 10px;
  flex-shrink: 0;
}

.control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
}

.control span {
  white-space: nowrap;
}

select {
  height: 36px;
  min-width: 148px;
  padding: 0 22px 0 10px;
  color: var(--ink);
  background-color: var(--surface);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

@media (max-width: 980px) {
  .top-actions .control > span {
    display: none;
  }

  .top-actions {
    gap: 8px;
  }

  .top-actions select {
    min-width: 138px;
  }

  .filter-bar .control-label {
    display: none;
  }

  .filter-bar {
    overflow-x: auto;
  }

  .filter-bar .result-count {
    display: none;
  }

}

select:focus {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(82, 46, 255, 0.18);
}

.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.top-back-button {
  display: none;
  flex-shrink: 0;
}

.topbar.is-detail .top-back-button {
  display: inline-flex;
}

.btn {
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 380;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  color: #ffffff;
  background: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  color: #374151;
  background: var(--surface);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover,
.icon-btn:hover {
  background: #f3f4f6;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.hook-card button:focus-visible,
.related-card:focus-visible {
  outline: 2px solid rgba(82, 46, 255, 0.42);
  outline-offset: 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  color: #555555;
  background: transparent;
  border-radius: 6px;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.view {
  display: none;
  min-height: 0;
  opacity: 0;
}

.view.is-active {
  display: block;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: viewIn 180ms ease-out both;
}

@keyframes viewIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.content {
  padding: 24px;
}

.empty-page {
  min-height: calc(100vh - 84px);
}

.empty-page h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 580;
}

.chat-content {
  display: flex;
  height: calc(100dvh - 58px);
  min-height: 0;
  padding: 0;
}

.topbar.is-chat ~ #chatView .chat-content {
  height: 100dvh;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-home,
.chat-thread {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.chat-home {
  display: grid;
  place-items: center;
  padding: 0 32px 42px;
}

.chat-home-center {
  width: min(820px, 100%);
}

.chat-home h2 {
  margin-bottom: 22px;
  color: #111827;
  font-size: 24px;
  font-weight: 460;
  text-align: center;
}

.chat-composer {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 7px 9px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.chat-composer:focus-within {
  border-color: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 2px rgba(82, 46, 255, 0.14);
}

.chat-composer-home {
  grid-template-rows: minmax(60px, 1fr) 34px;
  min-height: 140px;
  padding: 18px 22px 14px;
  align-items: stretch;
  gap: 10px;
  border-radius: 14px;
  box-shadow: none;
}

.chat-composer-home .chat-input-wrap {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: stretch;
  justify-content: flex-start;
  padding-top: 0;
}

/* Needs the extra .chat-input-wrap ancestor for specificity: the generic
   .chat-input-wrap textarea block later in this file (min 24px / max 120px)
   otherwise wins the tie and these home-only sizes never apply. */
.chat-composer-home .chat-input-wrap textarea {
  min-height: 54px;
  /* The home box is tall, give the autosizing input more room than the
     thread composer's 120px before it starts scrolling. */
  max-height: 200px;
  font-size: 16px;
}

.chat-composer-home .chat-upload-btn {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  justify-self: start;
}

.chat-composer-home .chat-send-btn {
  grid-column: 3;
  grid-row: 2;
  align-self: end;
  justify-self: end;
}

.chat-upload-btn,
.chat-send-btn,
.chat-attachment button,
.chat-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.chat-upload-btn,
.chat-send-btn {
  width: 30px;
  height: 30px;
}

.chat-upload-btn:hover,
.chat-send-btn:hover,
.chat-attachment button:hover,
.chat-edit-btn:hover {
  color: #374151;
  background: #f3f4f6;
}

.chat-upload-btn svg,
.chat-send-btn svg,
.chat-attachment svg,
.chat-link-row svg,
.chat-edit-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-input-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  align-self: center;
}

.chat-input-wrap textarea {
  width: 100%;
  min-height: 24px;
  max-height: 120px;
  resize: none;
  color: #111827;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 14px;
  line-height: 1.45;
}

.chat-input-wrap textarea::placeholder {
  color: #8a8f98;
}

.chat-attachment {
  order: -1;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: min(340px, 100%);
  min-height: 28px;
  margin: 2px 0 1px;
  padding: 0 6px 0 9px;
  color: #374151;
  background: #f5f7fa;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  font-size: 12px;
}

.chat-attachment-preview {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  width: auto !important;
  height: 26px !important;
  padding: 0 4px 0 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-attachment-preview:hover {
  background: transparent !important;
}

.chat-attachment-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: #7a8596;
}

.chat-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment em {
  flex: 0 0 auto;
  color: #98a2b3;
  font-size: 11px;
  font-style: normal;
}

.chat-attachment button {
  width: 22px;
  height: 22px;
}

.chat-video-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat-video-preview[hidden] {
  display: none;
}

.chat-video-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  border: 0;
}

.chat-video-preview-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.chat-video-preview-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 12px 10px 14px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.chat-video-preview-panel h3 {
  margin: 0;
  overflow: hidden;
  color: #111827;
  font-size: 14px;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-video-preview-panel p {
  margin: 2px 0 0;
  color: #7b8494;
  font-size: 12px;
}

.chat-video-preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: #7b8494;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.chat-video-preview-close:hover {
  color: #111827;
  background: #f3f4f6;
}

.chat-video-preview-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.chat-video-preview-panel video {
  display: block;
  width: 100%;
  max-height: min(680px, calc(100dvh - 140px));
  background: #0f172a;
}

.chat-home-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px;
  width: min(720px, 100%);
  margin: 28px auto 0;
}

.chat-home-lists h3 {
  margin-bottom: 11px;
  color: #7a8596;
  font-size: 12px;
  font-weight: 480;
}

.chat-link-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-link-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 5px 7px;
  color: #344054;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
}

.chat-link-scroll {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* 4 rows of 34px + 3 gaps */
  max-height: 148px;
  padding-right: 4px;
  overflow-y: auto;
}

.chat-link-row:hover {
  background: #f4f6f8;
}

.chat-link-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-link-row svg {
  color: #9aa4b2;
  width: 17px;
  height: 17px;
}

.chat-thread {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto;
}

.chat-thread.is-entering {
  animation: chatThreadIn 320ms ease-out both;
}

.chat-thread-header {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 7px 24px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.chat-title-menu {
  position: relative;
  min-width: 0;
}

.chat-title-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(520px, 62vw);
  min-height: 34px;
  padding: 0 6px;
  color: #344054;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 390;
}

.chat-title-button:hover,
.chat-title-button[aria-expanded="true"] {
  background: #f4f6f8;
}

.chat-title-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-button svg,
.chat-title-menu-item svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-title-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 236px));
  max-height: min(420px, calc(100vh - 86px));
  padding: 6px;
  overflow-y: auto;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.chat-title-menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  color: #344054;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
  font-weight: 370;
}

.chat-title-menu-item:hover {
  background: #f4f6f8;
}

.chat-title-menu-item.is-current {
  color: #111827;
  background: #f8fafc;
  font-weight: 420;
}

.chat-title-menu-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-menu-item svg {
  color: #8b97a8;
}

.chat-title-menu-divider {
  height: 1px;
  margin: 6px 2px;
  background: rgba(0, 0, 0, 0.08);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  overflow-y: auto;
  padding: 26px clamp(24px, 12vw, 180px) 34px;
}

.chat-message {
  display: flex;
}

.chat-message-user {
  justify-content: flex-end;
  padding-right: 30px;
}

.chat-message-assistant {
  justify-content: flex-start;
}

.chat-user-bubble {
  position: relative;
  max-width: min(620px, 82%);
  padding: 10px 14px;
  color: #111827;
  background: #f3f4f6;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.45;
}

.chat-user-bubble p {
  white-space: pre-wrap;
}

.chat-file-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-bottom: 7px;
  padding: 4px 7px;
  overflow: hidden;
  color: #344054;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 5px;
  font-size: 12px;
  font: inherit;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-chip:hover {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}

.chat-file-chip.is-unavailable {
  cursor: default;
  opacity: 0.72;
}

.chat-file-chip.is-unavailable:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.06);
}

.chat-edit-btn {
  position: absolute;
  top: 50%;
  right: -30px;
  width: 24px;
  height: 24px;
  opacity: 0;
  transform: translateY(-50%);
}

.chat-user-bubble:hover .chat-edit-btn,
.chat-edit-btn:focus-visible {
  opacity: 1;
}

.chat-edit-btn svg {
  width: 14px;
  height: 14px;
}

/* The editor reads as the user bubble expanded in place: same radius family,
   the card itself is the input surface (borderless textarea inside). No focus
   ring/darkening — the open editor is its own affordance. */
.chat-bubble-editor {
  width: min(620px, 100%);
  padding: 12px 12px 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.chat-bubble-editor textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 40vh;
  padding: 2px 2px 8px;
  overflow-y: auto;
  resize: none;
  color: #111827;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  line-height: 1.5;
}

.chat-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-edit-actions button {
  min-height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.chat-edit-actions .chat-edit-cancel {
  color: #4b5563;
  background: transparent;
  border: none;
}

.chat-edit-actions .chat-edit-cancel:hover {
  color: #111827;
  background: #f3f4f6;
}

.chat-edit-actions .chat-edit-send {
  color: #ffffff;
  background: #111827;
  border: none;
}

.chat-edit-actions .chat-edit-send:hover:not(:disabled) {
  background: #000000;
}

.chat-edit-actions .chat-edit-send:disabled {
  cursor: default;
  opacity: 0.35;
}

.chat-assistant-content {
  width: min(780px, 100%);
  color: #111827;
  font-size: 14px;
  line-height: 1.55;
}

.chat-assistant-content strong,
.chat-plain-text strong {
  font-weight: 480;
}

.chat-assistant-content.is-appearing {
  animation: chatResponseIn 260ms ease-out both;
}

@keyframes chatResponseIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatThreadIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-answer-lead {
  max-width: 680px;
}

.chat-plain-text {
  max-width: 660px;
  margin: 0;
  color: #475467;
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-answer-lead strong {
  display: inline;
  font-size: 14.5px;
  font-weight: 460;
}

.chat-answer-lead p {
  margin: 0;
  color: #475467;
  font-size: 13.5px;
  line-height: 1.5;
}

.chat-answer-lead p + p,
.chat-plain-text p + p {
  margin-top: 8px;
}

.chat-answer-lead p.chat-lead {
  margin-bottom: 6px;
}

.chat-answer-lead p.chat-lead strong {
  color: #344054;
  font-size: 13.5px;
  font-weight: 480;
}

.chat-answer-lead ul,
.chat-answer-lead ol,
.chat-plain-text ul,
.chat-plain-text ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #475467;
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-answer-lead li + li,
.chat-plain-text li + li {
  margin-top: 4px;
}

.chat-answer-lead h4,
.chat-plain-text h4 {
  margin: 12px 0 4px;
  color: #344054;
  font-size: 13.5px;
  font-weight: 560;
}

.chat-answer-lead code,
.chat-plain-text code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2f4f7;
  color: #344054;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.chat-degraded-note {
  margin-top: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #fffaeb;
  border: 1px solid #fedf89;
  color: #93540a;
  font-size: 12px;
  line-height: 1.4;
  max-width: 660px;
}

.chat-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.chat-metric-card {
  min-width: 0;
  min-height: 78px;
  padding: 10px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 7px;
}

.chat-metric-card span,
.chat-metric-card em {
  display: block;
  color: #7a8596;
  font-size: 11.5px;
  font-style: normal;
}

.chat-metric-card strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #111827;
  font-size: 15.5px;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-metric-card em {
  margin-top: 6px;
  line-height: 1.35;
}

.chat-answer-section {
  margin-top: 16px;
}

.chat-answer-section h4,
.chat-evidence h4,
.chat-recommendation-block h4,
.chat-comparison-block h4,
.chat-diagnosis-block h4 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 12.5px;
  font-weight: 580;
}

.chat-answer-section ul {
  margin: 0;
  padding-left: 18px;
  color: #475467;
}

.chat-answer-section li + li {
  margin-top: 6px;
}

.chat-recommendation-block,
.chat-comparison-block,
.chat-diagnosis-block {
  margin-top: 16px;
}

.chat-recommendation-row {
  padding: 10px 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.chat-recommendation-row:first-of-type {
  border-top: 0;
}

.chat-recommendation-row strong,
.chat-recommendation-row span {
  display: block;
}

.chat-recommendation-row strong {
  color: #111827;
  font-size: 13px;
  font-weight: 500;
}

.chat-recommendation-row span {
  margin-top: 3px;
  color: #667085;
  font-size: 12.5px;
  line-height: 1.4;
}

.chat-comparison-table {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) repeat(var(--comparison-value-columns), minmax(130px, 1fr));
  overflow: hidden;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 7px;
}

.chat-comparison-table > * {
  min-width: 0;
  padding: 9px 10px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.chat-comparison-table > :nth-child(-n + 3) {
  border-top: 0;
}

.chat-comparison-table strong,
.chat-comparison-table em {
  color: #111827;
  font-size: 12px;
  font-style: normal;
  font-weight: 520;
}

.chat-comparison-table em {
  color: #667085;
}

.chat-comparison-table span {
  color: #475467;
  font-size: 12.5px;
  line-height: 1.35;
}

.chat-comparison-visual {
  display: grid;
  gap: 11px;
  padding: 10px 0;
  background: #ffffff;
  border: 0;
  border-radius: 0;
}

.chat-visual-group > span {
  display: block;
  margin-bottom: 8px;
  color: #667085;
  font-size: 11.5px;
  font-weight: 500;
}

.chat-visual-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.chat-visual-row + .chat-visual-row {
  margin-top: 8px;
}

.chat-visual-row strong,
.chat-visual-row em {
  display: block;
}

.chat-visual-row strong {
  overflow: hidden;
  color: #111827;
  font-size: 12.5px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-visual-row em {
  margin-top: 2px;
  color: #7a8596;
  font-size: 11.5px;
  font-style: normal;
}

.chat-visual-track {
  height: 6px;
  overflow: hidden;
  background: #eef0f3;
  border-radius: 999px;
}

.chat-visual-track i {
  display: block;
  height: 100%;
  background: #6b7280;
  border-radius: inherit;
}

.chat-comparison-notes {
  margin-top: 9px;
}

.chat-comparison-notes p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12.5px;
  line-height: 1.4;
}

.chat-comparison-notes strong {
  color: #111827;
  font-weight: 520;
}

.chat-diagnosis-row {
  display: grid;
  grid-template-columns: 84px minmax(120px, 0.6fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.chat-diagnosis-row:first-of-type {
  border-top: 0;
}

.chat-diagnosis-row span {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  color: #475467;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.chat-diagnosis-row strong {
  color: #111827;
  font-size: 12.5px;
  font-weight: 520;
}

.chat-diagnosis-row em {
  color: #667085;
  font-size: 12.5px;
  font-style: normal;
  line-height: 1.4;
}

.chat-evidence {
  margin-top: 17px;
  /* Cards stream in inline as their videos resolve; fade them in so they settle
     into the answer rather than popping in abruptly. */
  animation: chatEvidenceIn 220ms ease-out both;
}

@keyframes chatEvidenceIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-evidence {
    animation: none;
  }
}

/* Separate an inline video card from the next hook or answer block. */
.chat-evidence:not(:last-child) {
  margin-bottom: 22px;
}

.chat-evidence button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 6px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
}

.chat-evidence button:hover {
  background: #f5f5f5;
}

.chat-evidence img,
.chat-evidence button > span {
  width: 44px;
  height: 44px;
  object-fit: cover;
  background: #f5f5f5;
  border-radius: 6px;
}

.chat-evidence strong {
  min-width: 0;
  overflow: hidden;
  color: #344054;
  font-size: 12.5px;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-evidence em {
  color: #7a8596;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.chat-evidence--solo button {
  grid-template-columns: 72px minmax(0, 1fr) auto;
  padding: 10px;
  background: #f8f9fb;
  border: 1px solid #e9ecf0;
  min-height: 72px;
}

.chat-evidence--solo button:hover {
  background: #f0f2f5;
}

.chat-evidence--solo img,
.chat-evidence--solo button > span {
  width: 72px;
  height: 72px;
  border-radius: 8px;
}

.chat-evidence--solo strong {
  font-size: 13.5px;
  white-space: normal;
}

.chat-evidence--solo em {
  font-size: 13px;
}

/* Creator cards from a find_creators answer — the people behind the videos. */
.chat-creators {
  margin-top: 17px;
  animation: chatEvidenceIn 220ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .chat-creators {
    animation: none;
  }
}

.chat-creators-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-creator-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e9ecf0;
  border-radius: 11px;
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

a.chat-creator-card:hover {
  background: #fcfcfd;
  border-color: #d7dbe2;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.chat-creator-avatar {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--avatar-bg, #eef2f7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.chat-creator-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-creator-avatar.is-fallback::after {
  content: attr(data-initial);
}

/* App cards under a chat answer reuse the creator-card layout; the logo is a
   rounded square (matching the Apps lens) instead of a circular avatar, and
   icons render on white padding so transparent logos don't sit on the color. */
.chat-app-logo {
  border-radius: 10px;
}

.chat-app-logo:not(.is-fallback) {
  padding: 3px;
  background: #fff;
  border: 1px solid #eef0f4;
}

.chat-app-logo img {
  border-radius: 7px;
  object-fit: contain;
}

.chat-creator-main {
  min-width: 0;
}

.chat-creator-main strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #101828;
  font-size: 13.5px;
  font-weight: 420;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-creator-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  min-width: 0;
  color: #7a8596;
  font-size: 11.5px;
}

.chat-creator-sub iconify-icon {
  flex: none;
  color: #98a2b3;
  font-size: 12px;
}

.chat-creator-sub .chat-creator-handle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-creator-sub > span:not(:last-child)::after {
  content: "·";
  margin-left: 5px;
  color: #c4cbd6;
}

.chat-creator-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}

.chat-creator-stats em {
  color: #667085;
  font-size: 11.5px;
  font-style: normal;
}

.chat-creator-stats .chat-creator-stat-main {
  color: #101828;
  font-size: 13px;
  font-weight: 420;
}

.chat-composer-thread {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto 14px;
}

.chat-composer-thread .chat-input-wrap {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.chat-composer-thread .chat-attachment {
  order: 0;
  flex: 0 1 min(300px, 48%);
  max-width: min(300px, 48%);
  min-width: 0;
  min-height: 28px;
  margin: 0;
}

.chat-composer-thread textarea {
  flex: 1 1 160px;
  min-width: 120px;
}

#feedView .content {
  padding-top: 24px;
  padding-bottom: 118px;
}

.trends-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1480px;
  padding-bottom: 56px;
}

.trends-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.trends-header h2 {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 380;
}

.trends-scope {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
}

.trends-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.trend-control select {
  min-width: 138px;
  height: 34px;
}

.trends-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.74fr) minmax(0, 1.26fr);
  gap: 12px;
  align-items: start;
}

/* Loading state — hide both panes and let the overlay (.trends-loading,
   which carries .search-loading's grid-column: 1 / -1 + flex centering)
   cover the whole grid so the spinner sits in the middle of the page. */
.trends-layout.is-loading > .trends-list-panel,
.trends-layout.is-loading > .trend-detail {
  display: none;
}

.trends-layout.is-list,
.trends-layout.is-detail {
  /* minmax(0, 1fr) — NOT bare 1fr — so the grid track ignores its child's
     intrinsic min-width. Without this, a wide flex child (the example rail
     with 24 thumbs = 3,300px) blows up the column and forces the whole page
     to scroll horizontally even though the rail itself has overflow-x:auto. */
  grid-template-columns: minmax(0, 1fr);
}

.trends-layout.is-list .trends-list-panel,
.trends-layout.is-detail .trend-detail {
  width: 100%;
  min-width: 0;
}

.trends-layout.is-detail .trends-list-panel,
.view.is-trend-detail .trends-header,
.view.is-trend-detail .trends-filter-bar {
  display: none;
}

.view.is-trend-detail .trends-content {
  max-width: 1180px;
  margin-right: auto;
  margin-left: auto;
}

.trends-list-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100dvh - 138px);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.trends-layout.is-list .trends-list-panel {
  position: static;
  max-height: none;
}

.trends-list-panel .panel-header {
  align-items: flex-start;
}

.trends-list-panel .panel-header p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.trend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  padding-right: 2px;
}

.trends-layout.is-list .trend-list {
  max-height: none;
}

.trend-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  transition: border-color 140ms ease, background 140ms ease;
}

.trend-card:hover,
.trend-card.is-active {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.14);
}

.trend-card-hit {
  min-width: 0;
  padding: 16px 0 16px 16px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.trend-card-hit:focus-visible,
.trend-thumb:focus-visible {
  outline: 2px solid rgba(82, 46, 255, 0.42);
  outline-offset: 2px;
}

.trend-card-main {
  display: block;
  min-width: 0;
}

.trend-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  color: #555555;
  background: #f2f4f7;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 380;
}

.trend-card h3 {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 420;
  line-height: 1.28;
  -webkit-box-orient: vertical;
}

.trend-card h3 {
  -webkit-line-clamp: 2;
}

.trend-card-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
}

.trend-card-stats span {
  display: inline-flex;
  align-items: center;
  color: #777777;
  font-size: 11.5px;
  white-space: nowrap;
}

.trend-card-stats .stat-growth {
  margin-left: 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 420;
}

.trend-card-stats .stat-growth.is-up {
  color: #1a7f37;
}

.trend-card-stats .stat-growth.is-down {
  color: #b3402a;
}

.trend-card-stats .stat-growth.is-flat {
  color: #aaaaaa;
}

.trend-card-gallery {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 14px 14px 0;
}

.trend-thumb {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: var(--thumb-bg, #eef2f7);
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 5px;
}

.trend-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trend-thumb-mini {
  width: 34px;
  height: 46px;
}

.trend-thumb-rail {
  flex: 0 0 130px;
  width: 130px;
  height: 180px;
}

.trend-thumb-rail span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  overflow: hidden;
  padding: 3px 6px;
  color: #111827;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 460;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-detail-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Belt-and-suspenders so the rail can never push this column wider than
     the .trend-detail grid item (which already has min-width:0). */
  min-width: 0;
  max-width: 100%;
}

.trend-example-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  /* Flex items default to min-width: auto, which means the rail tries to be
     as wide as ALL its thumbs combined (3,000px+) — that forces the whole
     page to scroll horizontally. min-width: 0 lets overflow-x: auto actually
     clip + scroll only within the rail. */
  min-width: 0;
}

.trend-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.trend-summary-card,
.trend-stats-card,
.trend-breakout-card,
.trend-breakdown-panel {
  min-width: 0;
  padding: 16px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
}

.trend-summary-card h4,
.trend-stats-card h4,
.trend-breakout-card h4,
.trend-breakdown-panel h4 {
  margin: 0;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 520;
}

.trend-summary-card p,
.trend-stats-card p,
.trend-breakout-card p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.trend-card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trend-card-section-header span {
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.trend-stat-chart {
  margin-top: 12px;
}

.trend-line-chart {
  width: 100%;
  height: auto;
}

.trend-stat-toggles {
  display: flex;
  gap: 4px;
}

.trend-stat-toggle {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.trend-stat-toggle.is-active {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}

.trend-stat-toggle:hover:not(.is-active) {
  background: rgba(0, 0, 0, 0.05);
}

.trend-app-row span {
  display: block;
  color: var(--text-muted);
  font-size: 10.5px;
}

.trend-app-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  margin-top: 10px;
  background: transparent;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
}

.trend-app-row {
  min-width: 0;
  padding: 10px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.trend-app-row:last-child {
  border-bottom: 0;
}

.trend-app-row strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 420;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-app-row span {
  margin-top: 4px;
}

.trend-breakdown-panel {
  margin: 0;
}

.trend-scene-list {
  margin-top: 10px;
}

.trend-detail-empty {
  min-height: 260px;
}

.trend-detail-empty h3 {
  font-size: 18px;
  font-weight: 380;
}

.trend-detail-empty p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.trend-empty {
  padding: 10px 0;
}

.panel.trends-list-panel {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}


.insights-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1440px;
  padding-bottom: 48px;
}

.insights-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.insights-header h2 {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 380;
}

.insights-scope {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
}

.insights-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.insight-kpi-card {
  min-width: 0;
  min-height: 92px;
  padding: 13px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.insight-kpi-card span,
.insight-kpi-card em {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
  font-style: normal;
}

.insight-kpi-card strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: var(--ink);
  font-size: 22px;
  font-weight: 380;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-kpi-card em {
  margin-top: 5px;
}

.insights-main-grid,
.insights-two-column,
.creator-insight-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.ai-pulse-panel,
.opportunity-panel,
.insight-builder-panel,
.insight-list-panel,
.velocity-panel,
.creator-insight-layout > .panel,
.insight-tab-panel > .panel {
  padding: 14px;
}

.insight-builder-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.insight-control {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.insight-control select {
  width: 100%;
  min-width: 0;
}

.custom-insight-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}

.custom-summary {
  min-height: 100%;
  padding: 13px;
  background: #f9fafb;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.custom-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
}

.custom-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
  font-weight: 420;
  line-height: 1.28;
}

.custom-summary p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.custom-chart {
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.custom-chart-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 1.1fr) 86px auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  background: #ffffff;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.custom-chart-row:last-child {
  border-bottom: 0;
}

.custom-chart-label {
  min-width: 0;
}

.custom-chart-label strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 420;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-chart-label span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-chart-bar {
  height: 8px;
  overflow: hidden;
  background: #eef2f7;
  border-radius: 999px;
}

.custom-chart-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.custom-chart-row > em {
  color: var(--ink);
  font-size: 12px;
  font-style: normal;
  font-weight: 420;
  text-align: right;
  white-space: nowrap;
}

.custom-chart-row .mini-evidence button {
  width: 28px;
  height: 38px;
}

.confidence-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: #087e00;
  background: #f2fbf1;
  border: 0.5px solid rgba(8, 126, 0, 0.12);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 380;
  white-space: nowrap;
}

.ai-pulse-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.ai-pulse-text strong {
  color: var(--ink);
  font-weight: 420;
}

.ai-evidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.ai-evidence-row span,
.segment-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #555555;
  background: #f5f5f5;
  border-radius: 999px;
  font-size: 11.5px;
  white-space: nowrap;
}

.opportunity-callout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px;
  background: #f9fafb;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.opportunity-callout strong {
  font-size: 14px;
  font-weight: 420;
  line-height: 1.3;
}

.opportunity-callout span {
  color: var(--text-secondary);
  font-size: 12px;
}

.opportunity-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  margin-top: 10px;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.opportunity-list div {
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  background: #ffffff;
  border-right: 0.5px solid rgba(0, 0, 0, 0.05);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.opportunity-list div:nth-child(2n) {
  border-right: 0;
}

.opportunity-list div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.opportunity-list span,
.creator-pattern-card span,
.segment-card-header span {
  display: block;
  color: var(--text-muted);
  font-size: 10.5px;
}

.opportunity-list strong {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 380;
  line-height: 1.32;
}

.insight-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  background: #eeeeef;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.insight-tab {
  min-height: 30px;
  padding: 0 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 380;
}

.insight-tab.is-active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

.insight-tab-panel {
  display: none;
}

.insight-tab-panel.is-active {
  display: block;
}

.market-signal-list,
.creator-pattern-grid,
.segment-grid {
  display: grid;
  gap: 10px;
}

.market-signal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  padding: 11px;
  background: #fbfbfc;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.market-signal span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.market-signal h4 {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 420;
}

.market-signal p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.mini-evidence {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mini-evidence button {
  width: 34px;
  height: 46px;
  overflow: hidden;
  padding: 0;
  background: #eef2f7;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 5px;
}

.mini-evidence img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.velocity-table {
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.velocity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 64px 88px 70px;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  background: #ffffff;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
  font-size: 12.5px;
}

.velocity-row:last-child {
  border-bottom: 0;
}

.velocity-row strong {
  overflow: hidden;
  font-weight: 380;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.velocity-row span {
  color: var(--text-secondary);
}

.velocity-head {
  min-height: 34px;
  background: #f9fafb;
  color: var(--text-muted);
  font-size: 11px;
}

.creator-pattern-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.creator-pattern-card {
  min-width: 0;
  padding: 11px;
  background: #fbfbfc;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.creator-pattern-card strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  font-weight: 420;
}

.creator-pattern-card p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.34;
}

.creator-pattern-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.creator-pattern-card em {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: #555555;
  background: #f5f5f5;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
}

.creator-matrix {
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.creator-matrix-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(130px, 0.9fr) minmax(100px, 0.8fr);
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  background: #ffffff;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.creator-matrix-row:last-child {
  border-bottom: 0;
}

.creator-matrix-row span,
.creator-matrix-row em,
.creator-matrix-row small {
  color: var(--text-secondary);
  font-size: 12px;
  font-style: normal;
}

.creator-matrix-row strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 420;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segment-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: #fbfbfc;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.segment-card-header strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 420;
  line-height: 1.32;
}

.segment-card p {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.segment-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.insight-video-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.insight-video-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  padding: 6px;
  color: inherit;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  text-align: left;
}

.insight-video-thumb {
  display: block;
  width: 38px;
  height: 52px;
  overflow: hidden;
  background: var(--thumb-bg, #eef2f7);
  border-radius: 5px;
}

.insight-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.insight-video-card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 380;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.insight-video-card em {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-style: normal;
}

.empty-insight {
  color: var(--text-muted);
  font-size: 13px;
}

.feed-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.feed-heading h2,
.view-toolbar h2 {
  font-size: 20px;
  font-weight: 380;
}

.feed-heading p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 14px;
}

.summary-strip {
  display: none;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  overflow: hidden;
  min-width: 300px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.summary-item {
  padding: 10px 13px;
  border-right: 0.5px solid var(--border);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-item span {
  display: block;
  font-size: 20px;
  font-weight: 380;
}

.summary-item small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.filter-bar {
  position: fixed;
  left: calc(200px + ((100vw - 200px) / 2));
  bottom: 18px;
  z-index: 30;
  flex-wrap: nowrap;
  gap: 8px;
  width: auto;
  max-width: calc(100vw - 248px);
  margin-bottom: 0;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.82);
  background: #1c1c1c;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
  transform: translateX(-50%);
}

.filter-bar .control {
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
}

.filter-bar select {
  width: auto;
  min-width: 0;
  height: 32px;
  color: #ffffff;
  background-color: #242424;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.topbar-search {
  position: relative;
  flex: 1 1 0;
  max-width: 420px;
}

.topbar.is-detail .topbar-search {
  display: none;
}

.search-bar-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  box-sizing: border-box;
}

.search-bar-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 9px;
  width: 5px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transform: rotate(45deg);
  transform-origin: 0 0;
}

.search-bar-input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 32px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-bar-input::placeholder {
  color: var(--text-muted);
}

.search-bar-input:focus {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 3px rgba(82, 46, 255, 0.15);
}

.search-bar-input::-webkit-search-cancel-button {
  display: none;
}

.search-bar-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.search-bar-clear:hover {
  color: var(--ink);
}

.search-bar-clear svg {
  width: 12px !important;
  height: 12px !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 2 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: calc(100vh - 200px);
  color: var(--text-muted);
  font-size: 15px;
}

/* Detail deep-dive loading — one centered spinner under the title (panels hidden). */
.detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
}

/* Spinner — matches the wade app's <Spinner /> (gray-300 ring, gray-500 arc). */
.spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 2.5px solid #d1d5db;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 2.5px; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Chat attachments — bar charts + markdown tables under a raw answer. */
.chat-chart {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--border, #e6e6e6);
  border-radius: 14px;
  background: var(--surface, #fafafa);
}
.chat-chart h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 560;
}
.chat-chart-row {
  margin: 10px 0;
}
.chat-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.chat-chart-label {
  font-size: 12px;
  color: var(--text-muted, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-chart-meta {
  flex: none;
  font-size: 12px;
  white-space: nowrap;
}
.chat-chart-meta strong {
  font-weight: 560;
}
.chat-chart-n {
  font-weight: 360;
  font-size: 11px;
  color: var(--text-muted, #9a9a9a);
  margin-left: 6px;
}
.chat-chart-track {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--border, #ececec);
  overflow: hidden;
}
.chat-chart-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #111;
}

.chat-stream-status {
  font-size: 13px;
}
.chat-stream-status:empty { display: none; }
.chat-shimmer {
  background: linear-gradient(90deg, #b4b4b4 0%, #b4b4b4 38%, #1f1f1f 50%, #b4b4b4 62%, #b4b4b4 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: chatShimmer 1.4s linear infinite;
}
@keyframes chatShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.chat-stream-text { line-height: 1.55; }
.chat-stream-text:empty { display: none; }

/* "What the chat is doing": one ongoing status line (current step, or "Worked for
   Ns" when done) with a caret that drops down the full step history on demand. */
.chat-steps { margin: 2px 0 12px; font-size: 13px; }
.chat-steps-head {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 2px 0; margin: 0;
  color: #8a8a8a; font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.chat-steps-head[disabled] { cursor: default; }
.chat-steps-head:not([disabled]):hover { color: #555; }
.chat-steps-summary { color: inherit; }
.chat-steps-caret { color: #c0c0c0; flex: none; transition: transform .2s ease-in-out; }
.chat-steps-open .chat-steps-caret { transform: rotate(90deg); }
/* Drawer: a very subtle ease-in-out reveal (grid 0fr->1fr animates to content height). */
.chat-steps-drawer {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .24s ease-in-out, opacity .18s ease-in-out;
}
.chat-steps-open .chat-steps-drawer { grid-template-rows: 1fr; opacity: 1; }
.chat-steps-list {
  list-style: none; margin: 0; padding: 6px 0 2px 2px;
  display: flex; flex-direction: column; gap: 5px;
  overflow: hidden; min-height: 0;
}
.chat-step { color: #a2a2a2; line-height: 1.45; }
/* The model's actual reasoning (extended-thinking) shown in the dropdown. */
.chat-steps-thinking {
  overflow: hidden; min-height: 0;
  white-space: pre-wrap; word-break: break-word;
  color: #9a9a9a; font-size: 12.5px; line-height: 1.55;
  padding: 7px 0 2px 2px; max-width: 70ch;
}

.chat-error {
  margin: 4px 0;
  padding: 12px 14px;
  border: 1px solid #f0c2c2;
  border-radius: 12px;
  background: #fdf2f2;
  color: #b42318;
  font-size: 14px;
}
.chat-error strong { color: #912018; }

.chat-table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}
.chat-table th,
.chat-table td {
  border: 1px solid var(--border, #e6e6e6);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.chat-table th {
  background: var(--surface, #f5f5f5);
  font-weight: 560;
}

.feed-load-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  color: var(--text-muted);
  font-size: 13px;
}

.match-reason {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.creator-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.creator-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 6px;
}

.creator-field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.creator-field-value {
  font-size: 13px;
  font-weight: 410;
  color: var(--ink);
}

.result-count {
  margin-right: 2px;
  margin-left: 6px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  white-space: nowrap;
}

.source-count {
  display: none;
  color: rgba(255, 255, 255, 0.54);
  font-size: 13px;
}

.hook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 16px 12px;
  align-items: start;
}

.hook-card,
.panel {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.hook-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  transition: transform 120ms ease;
}

.hook-card:hover {
  background: transparent;
  box-shadow: none;
}

.hook-card:hover .video-thumb,
.hook-card:hover .card-body {
  border-color: rgba(0, 0, 0, 0.12);
}

.hook-card button {
  display: block;
  width: 100%;
  min-height: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.hook-card-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.video-thumb {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 14.5;
  overflow: hidden;
  background: var(--thumb-bg, #eef2f7);
  border: 0.5px solid var(--border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  box-shadow: var(--shadow-card);
}

.video-thumb::before {
  content: none;
  position: absolute;
  inset: 7px;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.thumb-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f3f4f6;
  filter: none;
}

.thumb-overlay {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}

.thumb-app {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 360;
}

.app-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--thumb-bg, #eef2f7);
  color: #fff;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-icon.is-fallback::after {
  content: attr(data-initial);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
}

.thumb-meta {
  display: none !important;
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  justify-content: space-between;
  gap: 8px;
}

.thumb-chip {
  max-width: 100%;
  overflow: hidden;
  padding: 3px 5px;
  color: rgba(17, 24, 39, 0.8);
  background: rgba(255, 255, 255, 0.72);
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-bars {
  display: none !important;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 7px;
}

.thumb-bars span {
  height: 7px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
}

.play-button {
  display: none !important;
  position: absolute;
  inset: 50% auto auto 50%;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #111827;
  background: rgba(255, 255, 255, 0.82);
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.play-button svg {
  width: 13px;
  height: 13px;
  margin-left: 2px;
  fill: currentColor;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: var(--shadow-card);
}

.hook-text {
  display: -webkit-box;
  min-height: 32.5px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 380;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 16px;
  color: var(--text-secondary);
  font-size: 10.5px;
}

.source-line span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: inline-block;
}

.source-caption {
  display: none;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.card-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding-top: 6px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.05);
}

.metric-label,
.stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 10.5px;
}

.metric-value,
.stat-value {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 380;
}

/* Card metric values (Views/Likes/Age) read heavy against the app's light
   (~350) body type — lighten them. Detail-page .stat-value stays at 380. */
.metric-value { font-weight: 350; }

.velocity {
  color: var(--green);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  color: #666666;
  background: #f5f5f5;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 300;
}

.badge-format {
  color: #666666;
  background: #f5f5f5;
}

.badge-app {
  color: #087e00;
  background: #f2fbf1;
  border-color: rgba(8, 126, 0, 0.12);
}

.badge-fresh {
  color: #666666;
  background: #f5f5f5;
}

.badge-growing {
  color: #666666;
  background: #f5f5f5;
}

.badge-saturating {
  color: #666666;
  background: #f5f5f5;
}

.view-toolbar {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.view-toolbar > div {
  min-width: 0;
  flex: 1;
}

.view-toolbar h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-content > .view-toolbar {
  display: none;
}

.detail-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.detail-media-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.panel {
  overflow: hidden;
}

.preview-panel {
  width: 380px;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.preview-panel .video-thumb {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 16;
  border: 0.5px solid var(--border);
  border-radius: 6px;
}

.preview-panel .video-thumb::before {
  inset: 14px;
}

.preview-panel .thumb-meta {
  left: 14px;
  right: 14px;
  top: 14px;
}

.preview-panel .thumb-chip {
  padding: 5px 7px;
  font-size: 12px;
}

.preview-panel .play-button {
  width: 46px;
  height: 46px;
}

.preview-panel .play-button svg {
  width: 18px;
  height: 18px;
}

.detail-video-player {
  width: 100%;
  height: 676px;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  background: #000;
  cursor: pointer;
}

.detail-video-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}

.custom-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.ctrl-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #ffffff;
  background: transparent;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

.ctrl-play:hover {
  color: var(--accent);
}

.ctrl-play svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

.ctrl-time {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 72px;
}

.ctrl-progress {
  flex: 1;
  min-width: 54px;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.ctrl-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.42);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.ctrl-filled {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 80ms linear;
}

.ctrl-progress:hover .ctrl-track {
  height: 5px;
}

.ctrl-volume {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.ctrl-volume::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  bottom: 0;
  height: 132px;
}

.ctrl-vol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

.ctrl-vol:hover {
  color: var(--accent);
}

.ctrl-vol svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl-volume-slider {
  position: absolute;
  left: 50%;
  bottom: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 90px;
  padding: 9px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(3px);
  transition: opacity 120ms ease;
}

.ctrl-volume:hover .ctrl-volume-slider,
.ctrl-volume:focus-within .ctrl-volume-slider {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.ctrl-volume-slider:focus-visible {
  outline: 2px solid rgba(82, 46, 255, 0.52);
  outline-offset: 2px;
}

.ctrl-volume-track {
  position: relative;
  width: 3px;
  height: 68px;
  overflow: visible;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.ctrl-volume-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.ctrl-volume-thumb {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 11px;
  height: 11px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transform: translate(-50%, 50%);
}

.ctrl-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

.ctrl-fullscreen:hover {
  color: var(--accent);
}

.ctrl-fullscreen svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.open-video-pill {
  position: absolute;
  right: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #111827;
  background: rgba(255, 255, 255, 0.9);
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.open-video-pill svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.open-video-pill:hover {
  background: #ffffff;
}

.detail-company-stack {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 60px);
  z-index: 2;
}

.detail-company-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 32px;
  padding: 0 10px 0 8px;
  color: #111827;
  background: rgba(255, 255, 255, 0.9);
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.detail-company-pill span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 380;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.insight-grid .panel {
  min-width: 0;
}

.summary-panel,
.stats-panel,
.scene-panel,
.why-panel,
.caption-panel {
  padding: 14px;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 380;
}

.panel-header h3 svg {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.panel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  color: #374151;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 380;
}

.panel-action:hover {
  background: #f3f4f6;
}

.detail-summary-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.42;
}

.summary-panel .detail-summary-text {
  margin-top: -2px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.stat-card {
  min-height: 62px;
  padding: 10px;
  background: #ffffff;
  border: 0;
  border-right: 0.5px solid rgba(0, 0, 0, 0.05);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 0;
}

.stat-card-wide {
  grid-column: 1 / -1;
  border-right: 0;
}

.stat-value {
  overflow-wrap: anywhere;
}

.company-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.detail-company-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--thumb-bg, #eef2f7);
  color: #fff;
}

.detail-company-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-company-logo.is-fallback::after {
  content: attr(data-initial);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.stat-card:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.stat-card:nth-child(2n) {
  border-right: 0;
}

.detail-stack .stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-stack .stat-card {
  min-height: 58px;
}

.detail-stack .stat-card:nth-child(2n) {
  border-right: 0.5px solid rgba(0, 0, 0, 0.05);
}

.detail-stack .stat-card:nth-child(3n) {
  border-right: 0;
}

.detail-stack .stat-card:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.trend-note {
  display: none;
  margin-top: 8px;
  padding: 10px;
  color: var(--text-secondary);
  background: #f9fafb;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.42;
}

.scene-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

.anatomy-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 11px 16px;
  list-style: none;
  cursor: pointer;
  transition: background 140ms ease;
}

.anatomy-section > summary:hover {
  background: #fbfbfc;
}

.anatomy-section > summary::-webkit-details-marker {
  display: none;
}

.anatomy-section > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #9ca3af;
  border-bottom: 1.5px solid #9ca3af;
  transform: rotate(45deg);
  transition: transform 180ms ease;
  flex-shrink: 0;
}

.anatomy-section[open] > summary::after {
  transform: rotate(225deg);
}

.anatomy-section > summary strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 420;
}

.anatomy-section > summary em {
  margin-left: auto;
  padding: 3px 6px;
  color: #555555;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 11px;
  font-style: normal;
  font-weight: 380;
  white-space: nowrap;
}

.anatomy-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-right: -14px;
  margin-left: -14px;
}

.anatomy-section {
  overflow: hidden;
  background: transparent;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.07);
  border-radius: 0;
}

.anatomy-section:first-child {
  border-top: 0.5px solid rgba(0, 0, 0, 0.07);
}

.anatomy-section > summary {
  min-height: 44px;
}

.anatomy-section > summary .anatomy-number {
  color: var(--text-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.anatomy-section-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 220ms ease;
}

.anatomy-section[open] .anatomy-section-content {
  border-top: 0.5px solid rgba(0, 0, 0, 0.05);
}

.anatomy-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  background: #ffffff;
  border-top: 0.5px solid rgba(0, 0, 0, 0.05);
}

.anatomy-field {
  min-width: 0;
  min-height: 60px;
  padding: 11px 16px;
  border-right: 0.5px solid rgba(0, 0, 0, 0.05);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.anatomy-field:nth-child(2n) {
  border-right: 0;
}

.anatomy-field:nth-last-child(1),
.anatomy-field:nth-last-child(2):nth-child(odd) {
  border-bottom: 0;
}

.anatomy-field span {
  display: block;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 380;
}

.anatomy-field strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 380;
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.analysis-drawer {
  position: fixed;
  inset: 0;
  z-index: 78;
  display: grid;
  justify-items: end;
}

.analysis-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.26);
  opacity: 0;
  transition: opacity 160ms ease;
}

.analysis-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 28px));
  height: calc(100vh - 24px);
  margin: 12px;
  overflow: hidden;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.22);
  transform: translateX(22px) scale(0.985);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.analysis-drawer.is-open .analysis-backdrop {
  opacity: 1;
}

.analysis-drawer.is-open .analysis-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.analysis-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px;
}

.analysis-panel-header h2 {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 380;
}

.analysis-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.scene-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: #ffffff;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
}

.scene-item:last-child {
  border-bottom: 0;
}

.scene-item > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 380;
}

.scene-item strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 380;
}

.scene-item p {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.38;
}

.chart-wrap {
  width: 100%;
  min-height: 210px;
  padding: 8px 4px 0;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
}

.chart-axis {
  color: var(--text-muted);
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
}

.chart-area {
  fill: rgba(82, 46, 255, 0.12);
}

.example-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.example-card,
.related-card,
.reference-card {
  display: flex;
  gap: 10px;
  padding: 9px;
  background: #fbfbfc;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.preview-panel .example-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.preview-panel .example-card > div:last-child {
  min-height: 66px;
  padding: 7px;
  background: var(--surface);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}

.example-thumb,
.reference-thumb {
  width: 48px;
  min-width: 48px;
  height: 48px;
  background: var(--thumb-bg, #eef2f7);
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.preview-panel .example-thumb {
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 9 / 12;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.example-thumb img,
.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.example-card strong,
.reference-card strong,
.related-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 380;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-card span,
.reference-card span,
.related-card span {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}

.preview-panel .example-card span:last-child {
  display: none;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.related-card {
  display: block;
  width: 100%;
  text-align: left;
  border-color: rgba(0, 0, 0, 0.1);
  transition: background 150ms ease, transform 150ms ease;
}

.related-card:hover {
  background: #f4fbfc;
  transform: translateY(-1px);
}

.similar-section {
  margin-top: 16px;
}

.section-header {
  margin-bottom: 10px;
}

.section-header h3 {
  font-size: 15px;
  font-weight: 380;
}

.similar-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.similar-rail .example-card {
  display: flex;
  flex: 0 0 190px;
  flex-direction: column;
  gap: 0;
  width: 190px;
  min-width: 0;
  scroll-snap-align: start;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.similar-rail .example-card > div:last-child {
  min-height: 88px;
  padding: 8px;
  background: var(--surface);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}

.similar-rail .example-caption {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.similar-rail .example-thumb {
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 9 / 14.5;
  border: 0.5px solid rgba(0, 0, 0, 0.07);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.format-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.format-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.18);
  opacity: 0;
  transition: opacity 160ms ease;
}

.format-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - 36px));
  color: var(--ink);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.12);
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.format-drawer.is-generating-brief .format-panel {
  width: min(520px, calc(100vw - 24px));
}

.format-drawer.is-generating-brief .format-panel-body {
  padding: 20px 0 30px;
}

.format-drawer.is-open .format-backdrop,
.format-drawer.is-open .format-panel {
  opacity: 1;
}

.format-drawer.is-open .format-panel {
  transform: translateY(0);
}

.format-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--border);
}

.format-panel-header h2 {
  font-size: 14px;
  font-weight: 380;
}

.format-panel-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.format-cancel {
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  font-size: 13px;
}

.format-cancel:hover {
  color: var(--ink);
}

.format-stepper {
  display: none;
  gap: 14px;
  padding: 10px 14px 0;
}

.format-step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.format-step-pill span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--text-muted);
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  font-size: 10px;
}

.format-step-pill.is-active {
  color: var(--ink);
}

.format-step-pill.is-active span,
.format-step-pill.is-complete span {
  color: var(--ink);
  background: rgba(82, 46, 255, 0.18);
  border-color: rgba(82, 46, 255, 0.42);
}

.format-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 40px 0 0;
}

.format-output-card {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.format-output-card + .format-output-card {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.format-step {
  padding: 0 0 0;
}

.format-flow-step {
  min-height: 0;
  width: 100%;
  margin: 0;
}

.format-step-label,
.format-input-row,
.format-section-header,
.format-concept-list,
.format-result-header,
.format-output-card {
  width: min(430px, calc(100% - 48px));
  margin-right: auto;
  margin-left: auto;
}

.format-output-card label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.format-step-label {
  display: flex;
  margin-bottom: 8px;
}

.format-step-label strong {
  display: block;
  font-size: 13px;
  font-weight: 380;
}

.format-step-label p,
.format-output-card p,
.format-status {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.format-input-row {
  display: block;
}

.format-url-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 34px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  outline: none;
  font-size: 14px;
}

.format-url-input:focus {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(82, 46, 255, 0.18);
}

.format-input-row .btn:disabled {
  color: rgba(0, 0, 0, 0.48);
  cursor: default;
  opacity: 0.7;
}

.format-status {
  min-height: 18px;
  margin: 6px 14px 0;
}

.format-concepts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.format-concepts.is-loading {
  min-height: 220px;
  justify-content: center;
}

.format-concepts.is-loading .format-section-header {
  display: none;
}

.format-concepts.is-loading .format-concept-list {
  border-top: 0;
}

.format-section-header h3 {
  margin-top: 0;
  font-size: 14px;
  font-weight: 380;
}

.format-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.format-concept-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.format-loading {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--ink);
  font-size: 14px;
  font-weight: 380;
  line-height: 1.42;
  text-align: center;
}

.format-concept-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: start;
  width: 100%;
  min-height: 0;
  padding: 12px 8px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
}

.format-concept-card:hover,
.format-concept-card.is-selected {
  background: #fbfbfc;
}

.format-concept-card.is-selected {
  border-color: rgba(0, 0, 0, 0.14);
}

.format-concept-card.is-selected::after {
  grid-column: 3;
  color: var(--ink);
  content: "✓";
  font-size: 12px;
  line-height: 1.4;
}

.format-concept-card:disabled {
  cursor: default;
}

.format-concept-card[aria-busy="true"]::after {
  grid-column: 2;
  margin-top: 2px;
  color: var(--text-muted);
  content: "Expanding...";
  font-size: 11px;
}

.format-concept-card span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.format-concept-card strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 380;
  line-height: 1.38;
}

.format-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.format-result.is-loading {
  display: grid;
  min-height: 96px;
  place-items: start center;
}

.format-result.is-loading .format-result-header,
.format-result.is-loading .format-output-card,
.format-result.is-loading .format-footer {
  display: none;
}

.format-result.is-loading::after {
  color: var(--ink);
  content: "Generating brief...";
  font-size: 14px;
  font-weight: 380;
  margin-top: 22px;
  text-align: center;
}

.format-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 2px;
}

.format-result-header h3 {
  margin-top: 0;
  font-size: 14px;
  font-weight: 380;
  line-height: 1.32;
}

.format-result-header p {
  max-width: 440px;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.42;
}

.format-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 36px auto 0;
  padding: 14px 16px;
  background: var(--surface);
}

.format-footer .btn-primary {
  min-height: 32px;
  color: #ffffff;
  background: #000000;
  font-size: 13px;
}

.format-footer .btn-primary:hover {
  background: #111827;
}

.format-footer .btn-secondary {
  min-height: 30px;
  padding: 0 10px;
  color: #374151;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  font-size: 13px;
}

.format-output-card ol,
.format-output-card ul {
  margin: 0;
  padding-left: 20px;
  color: #374151;
  font-size: 12.5px;
  line-height: 1.48;
}

.format-output-card li + li {
  margin-top: 6px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  min-width: 170px;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .hook-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-shell {
    width: 100%;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .insights-kpi-grid,
  .segment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insights-main-grid,
  .insights-two-column,
  .creator-insight-layout,
  .custom-insight-layout,
  .trends-layout,
  .trend-detail-grid {
    grid-template-columns: 1fr;
  }

  .trends-list-panel {
    position: static;
    max-height: none;
  }

  .trend-list {
    max-height: none;
  }

  .insight-builder-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-panel {
    width: min(380px, 100%);
  }

}

@media (max-width: 520px) {
  .app-shell {
    display: block;
    overflow-y: auto;
  }

  .sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
  }

  .workspace {
    display: block;
    height: auto;
    overflow: visible;
  }

  .nav-list {
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar,
  .feed-heading,
  .view-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .topbar.is-insights {
    align-items: flex-start;
  }


  .topbar.is-detail {
    align-items: center;
    flex-direction: row;
  }

  .topbar.is-detail h1 {
    max-width: calc(100vw - 142px);
  }

  .topbar.is-detail .detail-actions .btn {
    width: 34px;
    min-height: 34px;
    padding: 0;
  }

  .topbar.is-detail .detail-actions .btn span {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .chat-content {
    height: auto;
    min-height: calc(100dvh - 58px);
    padding: 0;
  }

  .chat-shell {
    min-height: calc(100dvh - 58px);
    border-radius: 0;
  }

  .chat-home {
    padding: 28px 12px 44px;
  }

  .chat-home h2 {
    font-size: 21px;
  }

  .chat-home-lists {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .chat-thread {
    grid-template-rows: auto minmax(280px, 1fr) auto;
  }

  .chat-thread-header {
    align-items: stretch;
    padding: 10px;
  }

  .chat-title-button {
    max-width: calc(100vw - 24px);
  }

  .chat-title-dropdown {
    width: calc(100vw - 24px);
    max-height: min(380px, calc(100vh - 78px));
  }

  .chat-messages {
    padding: 18px 12px 24px;
  }

  .chat-user-bubble {
    max-width: 92%;
  }

  .chat-metric-grid {
    grid-template-columns: 1fr;
  }

  .chat-evidence button {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .chat-evidence em {
    grid-column: 2;
  }

  .chat-evidence img,
  .chat-evidence button > span {
    width: 38px;
    height: 38px;
    grid-row: span 2;
  }

  .chat-composer-thread {
    width: calc(100% - 20px);
    margin-bottom: 10px;
  }

  .insights-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .trends-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .trends-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .trend-control {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .trend-control select {
    width: 100%;
  }

  .trend-card {
    grid-template-columns: 1fr;
  }

  .trend-card-hit {
    padding: 14px 14px 0;
  }

  .trend-card-gallery {
    padding: 0 14px 14px;
  }

  .insights-kpi-grid,
  .creator-pattern-grid,
  .segment-grid,
  .insight-builder-controls,
  .insight-video-rail {
    grid-template-columns: 1fr;
  }

  .insight-tabs {
    width: 100%;
  }

  .insight-tab {
    flex: 1;
  }

  .market-signal {
    grid-template-columns: 1fr;
  }

  .custom-chart-row {
    grid-template-columns: 1fr;
    gap: 7px;
    align-items: stretch;
  }

  .custom-chart-row > em {
    text-align: left;
  }

  .mini-evidence {
    justify-content: flex-start;
  }

  .velocity-row {
    grid-template-columns: minmax(0, 1.2fr) 44px 68px 56px;
    gap: 6px;
    padding: 0 8px;
    font-size: 11.5px;
  }

  .creator-matrix-row {
    grid-template-columns: 1fr;
    gap: 3px;
    align-items: start;
    padding: 10px;
  }

  .opportunity-list {
    grid-template-columns: 1fr;
  }

  .opportunity-list div,
  .opportunity-list div:nth-child(2n) {
    border-right: 0;
  }

  .opportunity-list div:nth-last-child(-n + 2) {
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
  }

  .opportunity-list div:last-child {
    border-bottom: 0;
  }

  .detail-video-player {
    height: auto;
    aspect-ratio: 9 / 16;
  }

  .detail-stack .stat-grid,
  .anatomy-field-grid {
    grid-template-columns: 1fr;
  }

  .detail-stack .stat-card,
  .detail-stack .stat-card:nth-child(2n),
  .detail-stack .stat-card:nth-child(3n),
  .anatomy-field,
  .anatomy-field:nth-child(2n) {
    border-right: 0;
  }

  .detail-stack .stat-card:nth-last-child(-n + 3) {
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
  }

  .detail-stack .stat-card:last-child,
  .anatomy-field:last-child {
    border-bottom: 0;
  }

  .anatomy-section > summary {
    align-items: flex-start;
  }

  .anatomy-section > summary em {
    white-space: normal;
  }

  .analysis-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    margin: 10px;
  }

  .format-input-row {
    flex-direction: column;
  }

  .format-drawer {
    padding: 10px;
  }

  .format-panel {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 10px;
  }

  .format-panel-header,
  .format-stepper,
  .format-panel-body {
    padding-right: 12px;
    padding-left: 12px;
  }

  .format-stepper {
    grid-template-columns: 1fr;
  }

  .format-status {
    margin-right: 12px;
    margin-left: 12px;
  }

  .format-flow-step {
    min-height: 0;
  }

  .format-concept-list {
    grid-template-columns: 1fr;
  }

  .format-section-header,
  .format-result-header {
    flex-direction: column;
  }

  .format-result-actions {
    width: 100%;
  }

  .filter-bar {
    flex-wrap: wrap;
    right: 12px;
    left: 12px;
    bottom: 8px;
    width: auto;
    transform: none;
  }

  .control,
  .control select {
    width: 100%;
  }

  .summary-strip {
    width: 100%;
    min-width: 0;
  }

.hook-grid,
.example-row,
.related-list {
    grid-template-columns: 1fr;
  }

  .result-count {
    margin-left: 0;
  }

  .preview-panel .video-thumb {
    min-height: 220px;
  }

}

/* Companies */
.companies-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1480px;
  padding-bottom: 56px;
}

#competitorsView.is-company-detail .companies-filter-bar {
  display: none;
}

#competitorsView.is-company-detail .companies-content {
  max-width: 1180px;
  margin-right: auto;
  margin-left: auto;
}

.topbar.is-company-detail .detail-actions {
  display: none;
}

.company-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.company-empty {
  padding: 24px 0;
}

.company-card {
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  transition: border-color 140ms ease;
}

.company-card:hover {
  border-color: rgba(0, 0, 0, 0.14);
}

.company-card-hit {
  display: grid;
  grid-template-columns: minmax(190px, 0.85fr) minmax(0, 2.15fr);
  gap: 16px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 13px 16px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.company-card-hit:focus-visible {
  outline: 2px solid rgba(82, 46, 255, 0.42);
  outline-offset: 2px;
}

.company-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.company-logo {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  color: var(--ink);
  background: var(--thumb-bg, #eef2f7);
  border: 0.5px solid var(--border);
  border-radius: 8px;
}

.company-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.company-logo.is-fallback::after {
  content: attr(data-initial);
  font-size: 14px;
  font-weight: 460;
}

.company-logo-lg {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.company-logo-lg img {
  width: 100%;
  height: 100%;
}

.company-logo-lg.is-fallback::after {
  font-size: 19px;
}

.company-name-stack {
  min-width: 0;
}

.company-name-stack strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 440;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-name-stack h2 {
  overflow: hidden;
  font-size: 18px;
  font-weight: 440;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-niche {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.company-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.company-stat {
  min-width: 0;
}

.company-stat-label {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-stat-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 420;
  font-variant-numeric: tabular-nums;
}

.company-stat-value.is-up {
  color: var(--green);
}

.company-stat-value.is-down {
  color: #c0392b;
}

.company-delta {
  font-size: 9px;
  line-height: 1;
}

.company-delta.is-up {
  color: var(--green);
}

.company-delta.is-down {
  color: #c0392b;
}

.company-detail-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.company-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
}

.company-detail-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.company-platform-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #374151;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

.company-platform-pill svg {
  width: 16px;
  height: 16px;
}

.company-site-btn svg {
  width: 14px;
  height: 14px;
}

.company-site-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

.company-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.company-stat-card {
  min-width: 0;
  padding: 14px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
}

.company-stat-card .company-stat-label {
  font-size: 11px;
}

.company-stat-card .company-stat-value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 440;
}

.company-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.company-videos {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.company-videos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.company-videos-header h4 {
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
}

@media (max-width: 900px) {
  .company-card-hit {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .company-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Sidebar bottom group (Settings) ===== */
.sidebar-bottom {
  margin: auto 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Settings page (card styled) ===== */
.settings-content {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.settings-intro {
  margin-bottom: 20px;
}

.settings-intro h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 460;
}

.settings-intro p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.settings-card {
  padding: 26px 28px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.settings-card-head {
  margin-bottom: 16px;
}

.settings-card-head h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 480;
}

.settings-card-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.settings-card-title {
  margin: 0 0 16px;
  color: #344054;
  font-size: 15px;
  font-weight: 460;
}

.settings-card-titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-card-titlerow .settings-card-title {
  margin: 0;
}

.settings-card-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  background: transparent;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 7px;
  cursor: pointer;
}

.settings-card-add:hover {
  color: #111827;
  background: #f3f4f6;
}

.settings-card-add svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 140ms ease;
}

.settings-card-add.is-open svg {
  transform: rotate(45deg);
}

.settings-card-sub {
  margin: -8px 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* ===== Settings two-pane layout (sub-nav + content) ===== */
.settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  max-width: 960px;
}

.settings-nav {
  position: sticky;
  top: 24px;
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 11px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  font-weight: 380;
  cursor: pointer;
}

.settings-nav-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #9aa1ad;
}

.settings-nav-item:hover {
  color: #111827;
  background: #f3f4f6;
}

.settings-nav-item.is-active {
  color: #111827;
  background: #f3f4f6;
  font-weight: 460;
}

.settings-nav-item.is-active svg {
  color: #8e8e8e;
}

.settings-main {
  flex: 1;
  min-width: 0;
}

.settings-tab[hidden] {
  display: none;
}

.settings-tab + .settings-tab,
.settings-card + .settings-card {
  margin-top: 16px;
}

/* Plan & Usage */
.settings-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.settings-plan-info {
  min-width: 0;
}

.settings-plan-name {
  color: #111827;
  font-size: 16px;
  font-weight: 500;
}

.settings-plan-desc {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.settings-plan .btn {
  flex: 0 0 auto;
}

.settings-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.settings-card-rowtext {
  flex: 1;
  min-width: 0;
}

.settings-card-row .settings-card-title {
  margin-bottom: 4px;
}

.settings-card-row .settings-card-sub {
  margin: 0;
}

.lang-multiselect {
  position: relative;
  flex: 0 0 240px;
  width: 240px;
}

@media (max-width: 560px) {
  .settings-card-row {
    flex-direction: column;
    align-items: stretch;
  }
  .lang-multiselect {
    flex: none;
    width: 100%;
  }
}

.lang-multiselect-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  color: #111827;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.lang-multiselect-toggle:hover {
  border-color: rgba(0, 0, 0, 0.28);
}

.lang-multiselect-toggle[aria-expanded="true"] {
  border-color: #522EFF;
  box-shadow: 0 0 0 3px rgba(82, 46, 255, 0.15);
}

.lang-multiselect-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-multiselect-caret {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-secondary);
  transition: transform 140ms ease;
}

.lang-multiselect-toggle[aria-expanded="true"] .lang-multiselect-caret {
  transform: rotate(180deg);
}

.lang-multiselect-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.lang-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  font-size: 13.5px;
  color: #111827;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
}

.lang-opt:hover {
  background: #f3f4f6;
}

.lang-opt-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.lang-opt.is-checked .lang-opt-check {
  background: #522EFF;
  border-color: #522EFF;
}

.lang-opt.is-checked .lang-opt-check::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 1.6px solid #ffffff;
  border-bottom: 1.6px solid #ffffff;
  transform: translateY(-1px) rotate(-45deg);
}

.lang-opt-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-opt-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
}

.lang-opt-all {
  margin-bottom: 4px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 7px 7px 0 0;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.usage-stat {
  padding: 16px;
  background: var(--surface-soft);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

.usage-stat strong {
  display: block;
  color: #111827;
  font-size: 22px;
  font-weight: 480;
  line-height: 1.1;
}

.usage-stat span {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

@media (max-width: 760px) {
  .settings-layout {
    flex-direction: column;
  }
  .settings-nav {
    position: static;
    flex: none;
    flex-direction: row;
    width: 100%;
  }
  .usage-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Brand purple pass — lean #522EFF into the moments that carry brand
   (branch: purple-brand). Data rows & tables stay neutral on purpose.
   Self-contained: appended last so it wins by source order; delete to revert.
   ========================================================================== */
:root {
  --accent-wash: rgba(82, 46, 255, 0.08);
  --accent-wash-strong: rgba(82, 46, 255, 0.12);
  --accent-border: rgba(82, 46, 255, 0.22);
}

/* Nav stays fully neutral — active state is just contrast (grey pill +
   darker text), like Linear/Vercel/Notion. Brand color lives on buttons
   and interactions, not persistent sidebar chrome. No override needed. */

/* Selected trend card reads as deliberately brand-selected */
.trend-card.is-active {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px var(--accent-border),
              0 8px 20px -14px rgba(82, 46, 255, 0.4);
}

/* Stat toggles: the active pill is brand purple (was undefined --text-primary) */
.trend-stat-toggle.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.trend-stat-toggle:hover:not(.is-active) {
  color: var(--accent);
  background: var(--accent-wash);
}

/* Chat composer: a confident brand focus ring instead of a grey one */
.chat-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 46, 255, 0.16);
}

/* Send button turns into a real brand action on hover */
.chat-send-btn:hover {
  color: #ffffff;
  background: var(--accent);
}

/* Loading spinner spins in brand purple — a branded "thinking" moment */
.spinner {
  border-color: rgba(82, 46, 255, 0.18);
  border-top-color: var(--accent);
}
