/* Fusion AI.iQ — Figma Fusion-AI (dark sidebar + teal accent) */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --sidebar-bg: #2b2f36;
  --sidebar-hover: #353a43;
  --sidebar-active: #3d434d;
  --sidebar-text: #a8b0bd;
  --sidebar-text-active: #ffffff;
  --primary: #1eb8a8;
  --primary-hover: #17a394;
  --primary-soft: #e3f6f4;
  --accent: #f472b6;
  --bg: #f4f5f7;
  --bg-subtle: #fafbfc;
  --card: #ffffff;
  --text: #2d3139;
  --text-secondary: #4b5563;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --user-bg: #1eb8a8;
  --bot-bg: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(45, 49, 57, 0.06);
  --shadow: 0 1px 3px rgba(45, 49, 57, 0.08);
  --sidebar-w: 312px;
  --topbar-h: 52px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --transition: 0.15s ease;
}

/* HTML [hidden] must win over component display rules (e.g. .modal { display:flex }) */
[hidden] {
  display: none !important;
}

.theme-dark {
  --bg: #1a1d23;
  --bg-subtle: #22262e;
  --card: #2b2f36;
  --text: #f3f4f6;
  --text-secondary: #d1d5db;
  --muted: #9ca3af;
  --border: #3d434d;
  --bot-bg: #2b2f36;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* —— App shell (Figma) —— */
.app-shell {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  padding: 1rem 0.75rem;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 1rem;
  text-decoration: none;
  color: var(--sidebar-text-active);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.75rem;
}

.sidebar-brand-visual {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.sidebar-brand-visual .brand-mark {
  position: absolute;
  inset: 0;
}

.sidebar-brand-visual .brand-mark[hidden] {
  display: none !important;
}

.sidebar-product-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.sidebar-product-logo[hidden] {
  display: none !important;
}

.sidebar-product-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.sidebar-product-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 4px;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: #2d3139;
  word-break: break-word;
}

.sidebar-product-name {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--sidebar-text-active);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-product-name[hidden] {
  display: none !important;
}

.sidebar-brand:has(.sidebar-product-name:not([hidden])) {
  flex-wrap: nowrap;
  align-items: center;
}

.sidebar-brand:has(.sidebar-product-name:not([hidden])) .brand-text {
  display: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, #3dd6c8 100%);
  flex-shrink: 0;
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.brand-tag {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.7;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-nav-group {
  padding-bottom: 0.35rem;
}

.sidebar-nav-group + .sidebar-nav-group {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-nav-group.is-current-module .sidebar-nav-label {
  color: rgba(94, 234, 212, 0.95);
}

.sidebar-nav-label {
  display: block;
  padding: 0.15rem 0.75rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  padding: 0.5rem 0.75rem 0.5rem 0.85rem;
  margin: 0.1rem 0;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.sidebar-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0.4);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: transparent;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav-item:hover::before {
  opacity: 0.45;
  transform: translateY(-50%) scaleY(0.65);
  background: rgba(94, 234, 212, 0.5);
}

.sidebar-nav-item.active {
  background: linear-gradient(
    90deg,
    rgba(45, 212, 191, 0.22) 0%,
    rgba(45, 212, 191, 0.06) 72%,
    transparent 100%
  );
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.12);
}

.sidebar-nav-item.active::before {
  opacity: 1;
  transform: translateY(-50%) scaleY(1);
  background: linear-gradient(180deg, #5eead4 0%, #2dd4bf 100%);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.45);
}

/* legacy: plain links without .sidebar-nav-item */
.sidebar-nav a:not(.sidebar-nav-item) {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar-nav a:not(.sidebar-nav-item).active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-section h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-clear-all {
  margin-top: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  color: var(--sidebar-text);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-clear-all:hover {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.35);
  background: rgba(220, 38, 38, 0.12);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  gap: 0.5rem;
}

.toggle-row input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--sidebar-hover);
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-row input[type="checkbox"]:checked {
  background: var(--primary);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.app-topbar {
  min-height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumbs strong {
  color: var(--text);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-user {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.page-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.btn-block {
  width: 100%;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    padding: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .sidebar-brand,
  .sidebar-footer,
  .sidebar-section,
  .sidebar-nav-group:not(#sidebarModulesGroup) {
    display: none !important;
  }

  .sidebar-nav,
  #sidebarModulesGroup {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    margin: 0;
    border: 0;
  }

  #sidebarModulesGroup .sidebar-nav-label {
    display: none;
  }

  .sidebar-nav-item {
    white-space: nowrap;
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
  }

  .app-main {
    height: auto;
    flex: 1 1 auto;
  }

  .app-topbar {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }

  .breadcrumbs {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.session-list li {
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  margin-bottom: 0.2rem;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.session-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.session-list li {
  color: var(--sidebar-text);
}

.session-list li:hover,
.session-list li.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.session-del {
  margin-left: auto;
  margin-top: -0.05rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.session-del:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  color: var(--primary-hover);
}

.session-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  max-width: none;
}

.session-product {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 14rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: rgba(30, 184, 168, 0.12);
  color: rgba(220, 252, 248, 0.92);
  font-size: 0.68rem;
  line-height: 1.25;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-list li.active .session-product,
.session-list li:hover .session-product {
  background: rgba(30, 184, 168, 0.22);
  color: #ffffff;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.page-head {
  flex-shrink: 0;
  padding: 1rem 1.25rem 0.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.page-head--compact {
  padding-bottom: 0.75rem;
}

.page-head--compact .page-title {
  margin: 0;
}

.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.page-head-brand {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0;
}

.page-product-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  max-width: min(56vw, 24rem);
}

.page-product-brand[hidden] {
  display: none !important;
}

.learning-dash-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .learning-dash-split {
    grid-template-columns: 1fr;
  }
}

.program-detail-tabs {
  margin: 0 0 0.75rem;
}

.exam-session-host {
  display: block;
  width: 100%;
}

.exam-session {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.exam-session-head h2 {
  margin: 0.35rem 0 0;
}

.exam-session-hint {
  margin: 0.5rem 0 0;
  font-size: 0.86rem;
}

.exam-session--only-test .exam-questions-only {
  max-width: 52rem;
}

.exam-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 11.5rem);
}

.exam-study-panel,
.exam-questions-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 2px 12px rgba(15, 39, 68, 0.04);
  overflow: hidden;
}

.exam-panel-head {
  flex-shrink: 0;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: linear-gradient(180deg, rgba(30, 184, 168, 0.1), transparent);
  border-bottom: 1px solid var(--border);
}

.exam-study-scroll,
.exam-questions-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem;
}

.exam-study-empty {
  padding: 1rem 1.1rem;
  margin: 0;
}

.exam-lesson {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}

.exam-lesson:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.exam-lesson h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.exam-lesson-body h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.05rem;
}

.exam-lesson-body h4 {
  margin: 0.6rem 0 0.25rem;
  font-size: 0.95rem;
}

.exam-lesson-body p,
.exam-lesson-body ul {
  margin: 0.35rem 0;
  line-height: 1.5;
  color: var(--text-secondary);
}

.exam-questions-panel .learning-q-card,
.exam-q-card {
  margin-bottom: 0.85rem;
}

.exam-q-title {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.exam-q-text {
  margin: 0 0 0.65rem;
  line-height: 1.45;
  color: var(--text);
}

.exam-q-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.exam-q-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  line-height: 1.4;
  color: var(--text-secondary);
}

.exam-q-option:hover {
  border-color: rgba(30, 184, 168, 0.45);
  background: rgba(30, 184, 168, 0.06);
}

.exam-q-option input[type="radio"] {
  flex-shrink: 0;
  margin: 0.2rem 0 0;
}

.exam-q-option span {
  flex: 1;
  min-width: 0;
}

.exam-submit-row {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 0.25rem;
  margin-top: 0.5rem;
  background: linear-gradient(180deg, transparent, var(--card) 35%);
}

@media (max-width: 1024px) {
  .exam-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .exam-study-panel,
  .exam-questions-panel {
    max-height: 22rem;
  }
}

.page-product-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(36vw, 14rem);
}

.page-head-brand .page-product-logo {
  justify-content: flex-start;
  margin-left: 0;
  min-width: 0;
  max-width: none;
  min-height: 0;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.login-welcome-card {
  margin-top: 0.8rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(30, 184, 168, 0.24);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(30, 184, 168, 0.11), rgba(244, 114, 182, 0.07)),
    var(--card);
  box-shadow: 0 8px 24px rgba(30, 184, 168, 0.1);
}

.login-welcome-card[hidden] {
  display: none !important;
}

.login-welcome-card strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.login-welcome-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
}

.login-welcome-card .btn-ghost {
  flex-shrink: 0;
  line-height: 1;
  font-size: 1.1rem;
  padding: 0.1rem 0.35rem;
}

.page-product-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 2.5rem;
  min-width: 5rem;
  max-width: min(48vw, 16rem);
}

.page-product-logo[hidden] {
  display: none !important;
}

.page-product-logo-pad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 39, 68, 0.06);
}

.page-product-logo-img {
  display: block;
  height: 2rem;
  width: auto;
  max-width: 12rem;
  object-fit: contain;
}

.page-product-logo-fallback {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.product-chip-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 2px;
  background: #fff;
}

#openAssistToc,
.chat-toolbar {
  display: none !important;
}
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 0.5rem;
}

.chat-toolbar label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.chat-toolbar select,
.chat-toolbar input {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  background: var(--card);
}

.messages {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.msg {
  max-width: min(85%, 720px);
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-lg);
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 0.9375rem;
}

.msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(30, 184, 168, 0.35);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  white-space: normal;
}

.assist-follow-ups {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md, 12px);
  background: rgba(43, 108, 176, 0.06);
  border: 1px solid rgba(43, 108, 176, 0.14);
}

.assist-follow-ups-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.assist-follow-ups-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.assist-follow-up-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(30, 184, 168, 0.22);
  border-radius: var(--radius-md, 10px);
  background: var(--card, #fff);
  color: var(--text-strong, #1e293b);
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.assist-follow-up-chip:hover {
  border-color: rgba(30, 184, 168, 0.45);
  box-shadow: 0 4px 14px rgba(30, 184, 168, 0.12);
  transform: translateY(-1px);
}

.theme-dark .assist-follow-up-chip {
  background: linear-gradient(180deg, #32373f 0%, #2b2f36 100%);
  border-color: rgba(148, 163, 184, 0.22);
  color: #f3f4f6;
}

.product-switch-offer {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(
    135deg,
    rgba(30, 184, 168, 0.1),
    rgba(244, 114, 182, 0.06)
  );
  border: 1px solid rgba(30, 184, 168, 0.22);
}

.product-switch-offer.is-used {
  opacity: 0.72;
}

.product-switch-offer-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
}

.product-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding: 0.5rem 1rem 0.5rem 0.65rem;
  border: 1px solid rgba(30, 184, 168, 0.35);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(30, 184, 168, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.product-switch-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30, 184, 168, 0.35);
}

.product-switch-btn:disabled {
  cursor: default;
  opacity: 0.75;
}

.product-switch-btn-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px;
}

.msg .msg-body {
  white-space: normal;
}

.msg .msg-body > :first-child {
  margin-top: 0;
}

.msg .msg-body > :last-child {
  margin-bottom: 0;
}

.msg .msg-body p,
.msg .msg-body ul,
.msg .msg-body ol {
  margin: 0.45rem 0;
}

.msg .msg-body h1,
.msg .msg-body h2,
.msg .msg-body h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1rem;
  line-height: 1.35;
}

.msg .msg-body .table-wrap {
  overflow-x: auto;
  margin: 0.65rem 0;
  -webkit-overflow-scrolling: touch;
}

.msg .msg-body table {
  width: 100%;
  min-width: 12rem;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.msg .msg-body th {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
}

.msg .msg-body td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.msg .msg-body tr:last-child td {
  border-bottom: none;
}

.msg.assistant-thinking {
  min-width: 18rem;
  position: relative;
  overflow: visible;
  border-radius: var(--radius-lg);
  isolation: isolate;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(
      120deg,
      rgba(30, 184, 168, 0.45),
      rgba(244, 114, 182, 0.28),
      rgba(61, 214, 200, 0.42)
    )
    border-box;
  box-shadow:
    0 10px 28px rgba(30, 184, 168, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.msg.assistant-thinking::before {
  content: "";
  position: absolute;
  inset: -40%;
  border-radius: inherit;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(30, 184, 168, 0.07) 80deg,
    rgba(244, 114, 182, 0.08) 160deg,
    transparent 240deg
  );
  animation: thinking-aura 4.5s linear infinite;
  pointer-events: none;
}

.msg.assistant-thinking::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(30, 184, 168, 0.04) 42%,
    rgba(30, 184, 168, 0.14) 50%,
    rgba(30, 184, 168, 0.04) 58%,
    transparent 100%
  );
  transform: translateX(-120%);
  animation: thinking-shimmer 2.2s ease-in-out infinite;
  pointer-events: none;
}

.thinking-row {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.thinking-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.thinking-orbit {
  --orbit-size: 2.5rem;
  position: relative;
  width: var(--orbit-size);
  height: var(--orbit-size);
  flex-shrink: 0;
  padding: 4px;
  margin: -4px;
  overflow: visible;
}

.thinking-orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.thinking-orbit-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 0.18rem),
    #000 calc(100% - 0.1rem)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 0.18rem),
    #000 calc(100% - 0.1rem)
  );
}

.thinking-orbit-ring--cw {
  animation: thinking-spin-cw 1.35s linear infinite;
}

.thinking-orbit-ring--cw::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 205deg,
    rgba(30, 184, 168, 0.05) 235deg,
    rgba(30, 184, 168, 0.22) 275deg,
    rgba(61, 214, 200, 0.72) 315deg,
    #1eb8a8 335deg,
    #3dd6c8 360deg
  );
}

.thinking-orbit-ring--ccw {
  inset: 0.42rem;
  animation: thinking-spin-ccw 1.9s linear infinite;
}

.thinking-orbit-ring--ccw::before {
  background: conic-gradient(
    from 180deg,
    transparent 0deg,
    transparent 215deg,
    rgba(244, 114, 182, 0.06) 245deg,
    rgba(244, 114, 182, 0.28) 285deg,
    rgba(251, 182, 206, 0.75) 320deg,
    #f472b6 340deg,
    #fb9ecd 360deg
  );
}

.thinking-orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 35%, #fff, #1eb8a8 55%, #14a394 100%);
  box-shadow:
    0 0 10px rgba(30, 184, 168, 0.55),
    0 0 18px rgba(244, 114, 182, 0.25);
  animation: thinking-core-pulse 1.6s ease-in-out infinite;
}

@keyframes thinking-spin-cw {
  to {
    transform: rotate(360deg);
  }
}

@keyframes thinking-spin-ccw {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes thinking-core-pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.88);
    opacity: 0.75;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 1;
  }
}

@keyframes thinking-aura {
  to {
    transform: rotate(360deg);
  }
}

@keyframes thinking-shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

.msg .sources-wrap {
  margin-top: 0.65rem;
}

.source-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}

.source-badge--doc {
  background: rgba(34, 139, 87, 0.12);
  color: #1f7a4f;
  border: 1px solid rgba(34, 139, 87, 0.25);
}

.source-badge--expert {
  background: rgba(210, 153, 34, 0.14);
  color: #9a6b00;
  border: 1px solid rgba(210, 153, 34, 0.35);
}

.source-badge.badge-ok {
  background: rgba(34, 139, 87, 0.12);
  color: #1f7a4f;
  border: 1px solid rgba(34, 139, 87, 0.25);
}

.source-badge.badge-fail {
  background: rgba(200, 60, 60, 0.1);
  color: #a83232;
  border: 1px solid rgba(200, 60, 60, 0.25);
}

.source-badge.badge-warn {
  background: rgba(210, 153, 34, 0.14);
  color: #9a6b00;
  border: 1px solid rgba(210, 153, 34, 0.35);
}

.learning-q-card {
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.learning-q-card ul {
  margin: 0.35rem 0 0.35rem 1.1rem;
}

.feedback-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
}

.feedback-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

.feedback-status {
  font-size: 0.75rem;
}

.data-table .row-ok td:last-child {
  color: #1f7a4f;
}

.data-table .row-fail td:last-child {
  color: #b42318;
}

.msg .sources-toggle {
  font-size: 0.8rem;
  padding: 0.2rem 0;
  color: var(--muted);
}

.msg .sources-toggle:hover {
  color: var(--primary-hover);
}

.msg .sources-panel {
  margin-top: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.msg .sources {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0;
  list-style: disc;
  padding-left: 1.1rem;
}

.msg .sources li {
  margin: 0.25rem 0;
}

.screenshots-wrap {
  margin-top: 0.65rem;
}

.msg .screenshots-toggle {
  font-size: 0.8rem;
  padding: 0.2rem 0;
  color: var(--primary);
  font-weight: 600;
}

.msg .screenshots-toggle:hover {
  color: var(--primary-hover);
}

.screenshots-panel {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem;
}

.screenshot-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  text-align: left;
  cursor: zoom-in;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.screenshot-card:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 184, 168, 0.38);
  box-shadow: 0 8px 22px rgba(30, 184, 168, 0.14);
}

.screenshot-card img {
  width: 100%;
  max-height: 11rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
}

.screenshot-card span {
  font-size: 0.76rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal.screenshot-modal {
  z-index: 160;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.screenshot-modal .screenshot-modal-card {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.screenshot-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.screenshot-modal-head h2 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-modal-counter {
  color: var(--text-secondary);
  font-size: 0.86rem;
  white-space: nowrap;
}

.screenshot-modal-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  white-space: nowrap;
}

.screenshot-modal-tools .btn-ghost {
  min-width: 2rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.screenshot-modal-tools span {
  min-width: 3.2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
}

.screenshot-modal-close {
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}

.screenshot-modal-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
}

.screenshot-modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
}

.screenshot-modal-prev {
  left: 1.25rem;
}

.screenshot-modal-next {
  right: 1.25rem;
}

.screenshot-modal-nav:hover {
  background: #fff;
  border-color: rgba(30, 184, 168, 0.55);
  color: var(--primary);
}

.screenshot-modal-body img {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
}

.learning-progress-wrap {
  margin-top: 0.85rem;
}

.learning-progress-line {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.learning-progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width var(--transition);
}

.learning-material-read {
  display: block;
}

.exam-test-list {
  display: grid;
  gap: 0.75rem;
}

.exam-test-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.exam-test-row h3 {
  margin-bottom: 0.25rem;
}

.exam-test-row p {
  margin: 0.2rem 0;
}

.exam-test-row-main {
  min-width: 0;
}

.exam-test-row .card-actions {
  flex: 0 0 auto;
  margin-top: 0;
}

.academ-test-register h2 {
  margin-bottom: 0.25rem;
}

.academ-test-table {
  min-width: 860px;
}

.academ-materials-table {
  min-width: 1040px;
}

.academ-test-table th {
  background: var(--bg-subtle);
}

.academ-test-table td {
  vertical-align: middle;
}

.academ-test-table tbody tr {
  transition: background var(--transition), box-shadow var(--transition);
}

.academ-test-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.06);
  box-shadow: inset 3px 0 0 var(--primary);
}

.academ-test-num {
  width: 3rem;
  color: var(--muted);
  font-weight: 700;
}

.academ-test-title {
  min-width: 240px;
  color: var(--text-strong);
}

.academ-test-title strong,
.academ-test-title span {
  display: block;
}

.academ-test-title span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.academ-test-action {
  text-align: right;
  white-space: nowrap;
}

.assignment-modal-card {
  width: min(94vw, 760px);
  max-width: none;
}

.assignment-modal-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.assignment-modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

.assignment-modal-form select,
.assignment-modal-form input,
.assignment-modal-form textarea {
  width: 100%;
}

.assignment-modal-form textarea {
  min-height: 7rem;
  resize: vertical;
}

.analytics-report {
  display: grid;
  gap: 1rem;
}

.analytics-kicker {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analytics-hero {
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 32rem),
    linear-gradient(135deg, var(--card), var(--bg));
}

.analytics-hero-grid,
.analytics-grid-2 {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.6fr);
  gap: 1rem;
  align-items: stretch;
  margin-top: 1rem;
}

.analytics-health {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.5);
}

.analytics-health-ring {
  --score: 0;
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
  background:
    conic-gradient(from -90deg, var(--primary) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.2) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.75));
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
}

.analytics-health-ring::after {
  content: "";
  position: absolute;
  inset: 0.8rem;
  border-radius: inherit;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.1);
}

.analytics-health-ring strong,
.analytics-health-ring span {
  position: relative;
  z-index: 1;
}

.analytics-health-ring strong {
  font-size: 2.4rem;
  line-height: 1;
}

.analytics-health-ring span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.analytics-health.good .analytics-health-ring {
  background:
    conic-gradient(from -90deg, var(--success, #0d9488) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.2) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.75));
}

.analytics-health.warn .analytics-health-ring {
  background:
    conic-gradient(from -90deg, var(--warning, #d97706) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.2) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.75));
}

.analytics-health.bad .analytics-health-ring {
  background:
    conic-gradient(from -90deg, var(--danger, #b42318) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.2) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.75));
}

.analytics-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.analytics-metric,
.analytics-action,
.analytics-score-buckets article {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 0.85rem;
}

.analytics-metric span,
.analytics-metric em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.analytics-metric strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.65rem;
  color: var(--text-strong);
}

.analytics-metric.good {
  border-color: rgba(13, 148, 136, 0.35);
}

.analytics-metric.warn {
  border-color: rgba(217, 119, 6, 0.35);
}

.analytics-metric.bad {
  border-color: rgba(180, 35, 24, 0.35);
}

.analytics-bar {
  width: 100%;
  min-width: 7rem;
  height: 0.35rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.analytics-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.academ-analytics-table {
  min-width: 900px;
}

.analytics-actions,
.analytics-funnel,
.analytics-print-tiles {
  display: grid;
  gap: 0.75rem;
}

.analytics-action strong,
.analytics-action p {
  display: block;
  margin: 0;
}

.analytics-action p {
  margin-top: 0.35rem;
  color: var(--text-secondary);
}

.analytics-action.good {
  background: rgba(13, 148, 136, 0.08);
}

.analytics-action.warn {
  background: rgba(217, 119, 6, 0.08);
}

.analytics-action.bad {
  background: rgba(180, 35, 24, 0.08);
}

.analytics-funnel > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.analytics-funnel .analytics-bar {
  grid-column: 1 / -1;
}

.analytics-leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.analytics-leaderboard li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) max-content;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.06), var(--card));
}

.analytics-leaderboard li span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.analytics-leaderboard li strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-leaderboard li em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.analytics-leaderboard.danger li {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), var(--card));
  border-color: rgba(217, 119, 6, 0.25);
}

.analytics-leaderboard.danger li span {
  background: var(--warning, #d97706);
}

@media (max-width: 680px) {
  .analytics-leaderboard li {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .analytics-leaderboard li em {
    grid-column: 2;
    text-align: left;
    white-space: normal;
  }
}

.analytics-score-buckets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.analytics-score-buckets strong,
.analytics-score-buckets span {
  display: block;
}

.analytics-score-buckets strong {
  font-size: 2rem;
}

.analytics-score-buckets .good {
  background: rgba(13, 148, 136, 0.08);
}

.analytics-score-buckets .warn,
.analytics-score-buckets .ok {
  background: rgba(217, 119, 6, 0.08);
}

.analytics-score-buckets .bad {
  background: rgba(180, 35, 24, 0.08);
}

.assist-reports {
  display: grid;
  gap: 1rem;
}

.assist-report-hero {
  background:
    radial-gradient(circle at top right, rgba(30, 184, 168, 0.18), transparent 30rem),
    linear-gradient(135deg, var(--card), var(--bg));
}

.assist-report-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.assist-report-head .panel-title {
  margin-bottom: 0.25rem;
}

.assist-report-controls {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(220px, 1fr);
  gap: 0.75rem;
  max-width: 640px;
  margin-top: 1rem;
}

.assist-report-controls label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.assist-report-controls select {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
}

.assist-print-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.assist-print-panel button {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(30, 184, 168, 0.3);
  border-radius: var(--radius-md);
  background: rgba(30, 184, 168, 0.07);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.assist-print-panel button:hover {
  border-color: var(--primary);
  background: rgba(30, 184, 168, 0.12);
  transform: translateY(-1px);
}

.assist-print-panel strong,
.assist-print-panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assist-print-panel span {
  color: var(--muted);
  font-size: 0.76rem;
}

.assist-report-hero-grid,
.assist-report-grid-2,
.assist-report-grid-3 {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  align-items: stretch;
}

.assist-report-hero-grid {
  grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.85fr);
}

.assist-report-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assist-report-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.assist-health {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
}

.assist-health-ring {
  --score: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8.25rem;
  height: 8.25rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background:
    conic-gradient(var(--primary) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.18) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16), 0 0.9rem 2rem rgba(15, 23, 42, 0.08);
}

.assist-health-ring::after {
  content: "";
  position: absolute;
  inset: 0.95rem;
  border-radius: inherit;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.assist-health-ring-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.16rem;
  place-items: center;
  line-height: 1;
}

.assist-health-ring strong {
  font-size: 2.15rem;
  line-height: 1;
}

.assist-health-ring span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.assist-health.warn .assist-health-ring {
  background:
    conic-gradient(var(--warning) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.18) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
}

.assist-health.bad .assist-health-ring {
  background:
    conic-gradient(var(--danger) calc(var(--score) * 3.6deg), rgba(148, 163, 184, 0.18) 0),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
}

.assist-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 0.6rem;
}

.assist-report-kpi,
.assist-action {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 0.72rem;
}

.assist-report-kpi span,
.assist-report-kpi em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.assist-report-kpi strong {
  display: block;
  margin: 0.25rem 0;
  color: var(--text-strong);
  font-size: 1.25rem;
}

.assist-report-kpi.good,
.assist-action.good {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.07);
}

.assist-report-kpi.warn,
.assist-action.warn {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
}

.assist-report-kpi.bad,
.assist-action.bad {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
}

.assist-report-bar {
  width: 100%;
  height: 0.35rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.assist-report-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.assist-actions,
.assist-breakdown-list {
  display: grid;
  gap: 0.7rem;
}

.assist-action strong,
.assist-action p {
  display: block;
  margin: 0;
}

.assist-action p {
  margin-top: 0.35rem;
  color: var(--text-secondary);
}

.assist-breakdown-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.assist-breakdown-list .assist-report-bar {
  grid-column: 1 / -1;
}

.assist-sparkline {
  width: 100%;
  height: 8rem;
  margin: 0.45rem 0 0.9rem;
  color: var(--primary);
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(30, 184, 168, 0.08), rgba(30, 184, 168, 0.02)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(148, 163, 184, 0.14) 28px);
  overflow: visible;
}

.assist-sparkline-axis {
  stroke: rgba(100, 116, 139, 0.32);
  stroke-width: 1;
}

.assist-sparkline-area {
  fill: rgba(30, 184, 168, 0.1);
  stroke: none;
}

.assist-sparkline-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.assist-sparkline-dots circle {
  fill: var(--card);
  stroke: currentColor;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.assist-sparkline.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.assist-leaderboard ol {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.assist-leaderboard li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.assist-leaderboard li span {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.assist-leaderboard li strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assist-leaderboard li em {
  grid-column: 2;
  color: var(--muted);
  font-style: normal;
  text-align: left;
  white-space: normal;
}

.assist-leaderboard--questions li {
  grid-template-columns: 2rem minmax(0, 1fr) max-content;
  align-items: start;
  gap: 0.7rem;
  padding: 0.72rem 0.85rem;
}

.assist-leaderboard--questions li strong {
  overflow: visible;
  text-overflow: initial;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.assist-leaderboard--questions li em {
  grid-column: auto;
  align-self: start;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(30, 184, 168, 0.09);
  color: var(--text-secondary);
  white-space: nowrap;
}

.assist-leaderboard--questions li.muted {
  display: block;
}

.assist-report-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.assist-report-table th,
.assist-report-table td {
  white-space: normal;
  word-break: break-word;
}

.assist-report-table .assist-report-bar {
  min-width: 0;
}

@media (max-width: 1120px) {
  .assist-report-hero-grid,
  .assist-report-grid-2,
  .assist-report-grid-3,
  .assist-kpi-grid {
    grid-template-columns: 1fr;
  }

  .assist-print-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .assist-report-head,
  .assist-report-controls,
  .assist-print-panel {
    grid-template-columns: 1fr;
  }

  .assist-report-head #assistAnalyticsRefresh {
    justify-self: start;
  }
}

@media (max-width: 980px) {
  .analytics-hero-grid,
  .analytics-grid-2,
  .analytics-metrics-grid,
  .analytics-score-buckets {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-sidebar,
  .app-topbar,
  .academai-tabs,
  .analytics-print-actions,
  .btn,
  .btn-ghost {
    display: none !important;
  }

  .app-main,
  .app-content,
  .admin-page {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #d0d7de !important;
  }

  .analytics-report {
    gap: 0.6rem;
  }

  table {
    font-size: 0.72rem;
  }
}

.exam-test-modal {
  z-index: 150;
}

.exam-test-card {
  width: min(96vw, 920px);
  max-width: none;
  max-height: min(92vh, 760px);
  overflow: auto;
}

.exam-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.exam-modal-head h2 {
  margin: 0;
}

.exam-timer {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.exam-modal-question-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.exam-modal-options {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.exam-modal-actions {
  justify-content: space-between;
}

.composer {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-top: 1px solid var(--border);
}

.composer-gpt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 1.125rem;
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.composer-gpt:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.12);
}

.composer-gpt textarea {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 52px;
  max-height: 160px;
  resize: none;
  padding: 0.85rem 1rem 0.4rem;
  border: none;
  border-radius: 1.125rem 1.125rem 0 0;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.composer-gpt textarea:focus {
  outline: none;
  box-shadow: none;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.25rem 0.55rem 0.5rem 0.5rem;
}

.composer-toolbar-left {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.product-chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 11rem;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.product-chip:hover {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
  color: var(--text);
}

.product-chip.is-active {
  background: rgba(30, 184, 168, 0.1);
  border-color: rgba(30, 184, 168, 0.35);
  color: var(--primary);
  font-weight: 600;
}

.product-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-chip-icon--text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: rgba(30, 184, 168, 0.12);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.product-chip-remove {
  flex-shrink: 0;
  opacity: 0;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--muted);
  transition: opacity var(--transition), color var(--transition);
}

.product-chip:hover .product-chip-remove,
.product-chip.is-active .product-chip-remove {
  opacity: 0.5;
}

.product-chip-remove:hover {
  opacity: 1 !important;
  color: #c44;
}

.product-chip--add {
  min-width: 1.65rem;
  justify-content: center;
  padding: 0.18rem 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.product-chip-add-wrap {
  position: relative;
}

.product-chips-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 12rem;
  max-width: 18rem;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 0.3rem;
  z-index: 35;
}

.product-chips-menu[hidden] {
  display: none;
}

.product-chips-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

.product-chips-menu-item:hover {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.05));
}

.product-chips-menu-item span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-chips-menu-count {
  font-size: 0.68rem;
  color: var(--muted);
}

.composer .composer-send-btn {
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1px;
  min-width: 6.5rem;
  height: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.85rem;
  font-size: 0.85rem;
}

.composer-row {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
}

.composer-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.composer-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.15);
}


.composer-context {
  position: relative;
  flex-shrink: 0;
  padding: 0.15rem 0.75rem 0.4rem;
}

.composer-context-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
  cursor: default;
  border-radius: 4px;
}

.composer-context-btn.is-selectable {
  cursor: pointer;
}

.composer-context-btn.is-selectable:hover {
  color: var(--text-secondary, var(--text));
}

.composer-context-btn.is-selectable:hover .composer-context-name {
  color: var(--primary-hover, var(--primary));
}

.composer-context-prefix {
  opacity: 0.85;
}

.composer-context-sep {
  opacity: 0.45;
}

.composer-context-name {
  color: var(--text-secondary, var(--muted));
  font-weight: 500;
}

.composer-context-caret {
  font-size: 0.62rem;
  opacity: 0.45;
  margin-left: 0.05rem;
}

.composer-context-btn:not(.is-selectable) .composer-context-caret {
  display: none;
}

.composer-context-menu {
  position: absolute;
  left: 0.65rem;
  bottom: calc(100% + 4px);
  min-width: 11rem;
  max-width: 16rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.3rem;
  z-index: 30;
}

.composer-context-menu[hidden] {
  display: none;
}

.composer-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

.composer-context-menu button:hover {
  background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
}

.composer-context-menu button[aria-selected="true"] {
  color: var(--primary);
  font-weight: 600;
}

.composer-action-btn {
  box-sizing: border-box;
  flex-shrink: 0;
  width: auto;
  min-width: 7.5rem;
  height: 2.875rem;
  min-height: 2.875rem;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 0.85rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.composer-send-btn {
  align-self: flex-end;
  margin-bottom: 2px;
  background: var(--primary);
  color: #fff;
  border: none;
}

.composer-send-btn:hover {
  background: var(--primary-hover);
}

.composer-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.composer-field textarea {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 56px;
  max-height: 160px;
  resize: none;
  padding: 0.75rem 0.9rem 0.35rem;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
}

.composer-field textarea:focus {
  outline: none;
  box-shadow: none;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  width: auto;
  min-height: 72px;
  max-height: 160px;
  resize: vertical;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.voice-btn {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.voice-btn-label {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
}

.voice-icon {
  flex-shrink: 0;
}

.voice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.voice-btn.is-listening {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.25);
  animation: voice-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(30, 184, 168, 0.35);
  }
}

.voice-status {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.voice-status.is-active {
  color: var(--primary-hover);
}

.voice-status.is-error {
  color: var(--danger);
}

.composer textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), opacity var(--transition);
  text-decoration: none;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.chat-feed {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.assist-empty-state {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  overflow-y: auto;
  pointer-events: none;
  z-index: 1;
}

.assist-empty-state[hidden] {
  display: none !important;
}

.assist-empty-state:not([hidden]) {
  display: flex;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(30, 184, 168, 0.07), transparent 62%),
    radial-gradient(ellipse 55% 35% at 85% 100%, rgba(244, 114, 182, 0.06), transparent 58%);
}

.assist-digest-card {
  pointer-events: auto;
  width: 100%;
  max-width: 72rem;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.assist-digest-card--modal {
  max-width: 36rem;
  max-height: min(85vh, 720px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
  padding: 1.25rem 1.4rem;
}

.assist-digest-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.assist-digest-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.assist-digest-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.assist-digest-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.assist-digest-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.assist-digest-lead {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 28rem;
}

.assist-toc-jump {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  background: rgba(43, 108, 176, 0.08);
}

.assist-toc-jump:hover {
  background: rgba(43, 108, 176, 0.14);
}

.assist-toc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  padding: 0.65rem 0 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--fusion-border);
}

.assist-toc-nav a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.2rem 0;
}

.assist-toc-nav a:hover {
  color: var(--primary);
}

.assist-digest-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.assist-digest-section {
  scroll-margin-top: 1rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 1.05rem;
  box-shadow:
    0 1px 2px rgba(45, 49, 57, 0.05),
    0 10px 28px rgba(45, 49, 57, 0.08);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.assist-digest-section:hover {
  transform: translateY(-2px);
  box-shadow:
    0 2px 4px rgba(45, 49, 57, 0.06),
    0 16px 36px rgba(45, 49, 57, 0.1);
}

.assist-digest-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.95;
}

#assist-section-daily::before {
  background: linear-gradient(90deg, #1eb8a8, #3dd6c8);
}

#assist-section-top::before {
  background: linear-gradient(90deg, #f472b6, #fb9ecd);
}

#assist-section-topics::before {
  background: linear-gradient(90deg, #14b8a6, #5eead4);
}

.assist-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: -0.01em;
}

.assist-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 10px rgba(30, 184, 168, 0.28);
}

#assist-section-top .assist-section-num {
  box-shadow: 0 4px 10px rgba(244, 114, 182, 0.28);
}

#assist-section-topics .assist-section-num {
  box-shadow: 0 4px 10px rgba(20, 184, 166, 0.28);
}

.assist-digest-section .chips-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.55rem;
  width: 100%;
}

.assist-digest-section .chip {
  width: 100%;
  max-width: none;
  border-radius: 10px;
  padding: 0.72rem 0.85rem 0.72rem 0.95rem;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  box-shadow:
    0 1px 2px rgba(45, 49, 57, 0.05),
    0 4px 14px rgba(45, 49, 57, 0.06);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.assist-digest-section .chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  opacity: 0.9;
}

.assist-digest-section .chip-daily {
  border-color: rgba(30, 184, 168, 0.16);
}

.assist-digest-section .chip-daily::before {
  background: linear-gradient(180deg, #1eb8a8, #3dd6c8);
}

.assist-digest-section .chip-top {
  border-color: rgba(244, 114, 182, 0.18);
}

.assist-digest-section .chip-top::before {
  background: linear-gradient(180deg, #f472b6, #fb9ecd);
}

.assist-digest-section .chip-topic {
  border-color: rgba(20, 184, 166, 0.18);
}

.assist-digest-section .chip-topic::before {
  background: linear-gradient(180deg, #14b8a6, #5eead4);
}

.assist-digest-section .chip-assistant {
  border-color: rgba(14, 165, 233, 0.22);
}

.assist-digest-section .chip-assistant::before {
  background: linear-gradient(180deg, #0ea5e9, #38bdf8);
}

.assist-digest-section .chip:hover {
  transform: translateY(-2px);
  color: var(--text);
  border-color: rgba(30, 184, 168, 0.28);
  box-shadow:
    0 4px 8px rgba(45, 49, 57, 0.06),
    0 12px 28px rgba(30, 184, 168, 0.14);
}

.assist-digest-section .chip-top:hover {
  border-color: rgba(244, 114, 182, 0.32);
  box-shadow:
    0 4px 8px rgba(45, 49, 57, 0.06),
    0 12px 28px rgba(244, 114, 182, 0.14);
}

.assist-digest-section .chip-topic:hover {
  border-color: rgba(20, 184, 166, 0.32);
  box-shadow:
    0 4px 8px rgba(45, 49, 57, 0.06),
    0 12px 28px rgba(20, 184, 166, 0.14);
}

.assist-digest-section .chip-text {
  display: block;
}

.assist-digest-section .chip-top .chip-count {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f472b6, #ec4899);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  line-height: 1.25;
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.35);
}

.theme-dark .assist-digest-section {
  background: var(--card);
  border-color: var(--border);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 12px 32px rgba(0, 0, 0, 0.28);
}

.theme-dark .assist-digest-section .chip {
  background: linear-gradient(180deg, #32373f 0%, #2b2f36 100%);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.18);
}

.theme-dark .assist-digest-section .chip:hover {
  color: #f3f4f6;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.24),
    0 14px 30px rgba(30, 184, 168, 0.12);
}

@media (max-width: 1200px) {
  .assist-digest-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .assist-digest-sections {
    grid-template-columns: 1fr;
    max-width: 28rem;
    margin: 0 auto;
  }
}

.assist-section-hint,
.assist-section-empty {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}

.chip-topic {
  color: var(--text);
}

.chip-topic:hover {
  color: var(--accent);
}

.messages--empty {
  /* legacy: empty state layout handled by .chat-feed--empty */
}

.chips-cascade {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
  align-items: start;
  max-width: 56rem;
  width: 100%;
  padding: 0 1.25rem 2rem;
  background: transparent;
}

.chips-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.chips-group--daily {
  align-items: flex-start;
  text-align: left;
}

.chips-group--top {
  align-items: flex-end;
  text-align: right;
}

.chips-group--top .chips-heading {
  align-self: flex-end;
}

.chips-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.chips-group--daily .chips-list {
  align-items: flex-start;
}

.chips-group--top .chips-list {
  align-items: flex-end;
}

.chip {
  border: 1px solid var(--fusion-border);
  background: var(--surface-muted, rgba(43, 108, 176, 0.06));
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: color 0.18s ease, transform 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  max-width: 100%;
}

.chip-daily {
  background: rgba(43, 108, 176, 0.08);
  border-color: rgba(43, 108, 176, 0.18);
}

.chip-top {
  background: rgba(244, 114, 182, 0.08);
  border-color: rgba(244, 114, 182, 0.2);
}

.chip-topic {
  background: rgba(94, 234, 212, 0.1);
  border-color: rgba(45, 178, 162, 0.22);
}

.chip-release {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(217, 119, 6, 0.28);
  color: var(--text);
}

.chip-release-meta {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border-radius: var(--radius-pill);
  padding: 0.08rem 0.4rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.assist-section-releases .assist-section-num {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  font-size: 0.8rem;
}

.chip:hover {
  color: var(--primary);
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

@media (max-width: 768px) {
  .chips-cascade {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    max-width: 28rem;
  }

  .chips-group--top {
    align-items: flex-start;
    text-align: left;
  }

  .chips-group--top .chips-heading {
    align-self: flex-start;
  }

  .chips-group--top .chips-list {
    align-items: flex-start;
  }
}

.chip-top .chip-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(244, 114, 182, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.45rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.chip-text {
  display: inline;
}

.theme-dark .chip {
  color: var(--sidebar-text);
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
}

.theme-dark .chip-daily {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.28);
}

.theme-dark .chip-top {
  background: rgba(244, 114, 182, 0.16);
  border-color: rgba(244, 114, 182, 0.3);
}

.theme-dark .chip-topic {
  background: rgba(94, 234, 212, 0.14);
  border-color: rgba(94, 234, 212, 0.3);
}

.theme-dark .chip-release {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.34);
  color: var(--sidebar-text);
}

.theme-dark .chip-release-meta {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.24);
}

.theme-dark .chip:hover {
  color: #6ee7d6;
  border-color: #6ee7d6;
}

.theme-dark .chip-top .chip-count {
  background: rgba(244, 114, 182, 0.2);
}

/* —— Admin —— */
.admin-page {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.25rem 2rem;
}

.admin-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.admin-toolbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.api-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0.65rem 1.25rem;
  background: var(--danger-soft, rgba(180, 35, 24, 0.1));
  border-bottom: 1px solid rgba(180, 35, 24, 0.25);
  color: var(--danger, #b42318);
  font-size: 0.9rem;
}

.api-error-banner[hidden] {
  display: none !important;
}

#topbarRefreshBtn {
  font-weight: 600;
}

.refresh-status {
  margin: 0;
  max-width: 280px;
  text-align: right;
}

.upload-progress {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  background: var(--primary-soft);
  border: 1px solid rgba(30, 184, 168, 0.35);
  border-radius: var(--radius);
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.upload-progress-head strong {
  font-size: 0.95rem;
}

.upload-progress-track {
  height: 8px;
  background: var(--card);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  transition: width 0.25s ease;
}

.upload-progress-text {
  margin: 0.55rem 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.upload-progress-log {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
  max-height: 120px;
  overflow-y: auto;
}

.upload-progress-log li {
  margin: 0.2rem 0;
}

.knowledge-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
}

#knowledgeToolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.admin-toolbar-tabs {
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.875rem;
  background: var(--card);
  color: var(--text);
}

.upload-version-input {
  width: 5.5rem;
  min-width: 4.5rem;
}

.upload-product-input {
  min-width: 11rem;
  max-width: 14rem;
}

.notice-unassigned {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--warning-soft);
  border: 1px solid #fcd34d;
  color: var(--text);
  font-size: 0.9rem;
}

.col-product .filter-select,
.doc-product-input {
  min-width: 9rem;
  max-width: 12rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}

.doc-product-inline {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-danger {
  border-color: #fecaca;
  background: var(--danger-soft);
}

.card-danger h2 {
  color: var(--danger);
}

.search-input {
  min-width: 220px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  background: var(--card);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.15);
}

.btn-outline {
  background: var(--card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
  min-width: 2rem;
}

.dropdown {
  position: relative;
}

.dropdown-menu[hidden] {
  display: none !important;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 0.35rem 0;
}

.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.dropdown-menu button:hover {
  background: var(--primary-soft);
}

.card-flat {
  padding-top: 0.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.card-grid > .card {
  margin-bottom: 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.learning-action-status {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: var(--radius-md);
  background: rgba(20, 184, 166, 0.08);
  color: var(--text-strong);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.knowledge-table .col-name {
  font-weight: 500;
  max-width: 280px;
}

.knowledge-table .col-date {
  white-space: nowrap;
  font-size: 0.8rem;
  min-width: 7.5rem;
}

.knowledge-table .embed-col {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 160px;
}

.knowledge-table .muted-col {
  color: var(--muted);
}

.table-footer {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.modal-card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.modal-card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  flex: 1;
  background: var(--card);
  padding: 0 0.5rem;
}

.admin-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1rem;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--muted);
  font-family: inherit;
  transition: color var(--transition), border-color var(--transition);
}

.admin-tab:hover {
  color: var(--text);
}

.admin-tab.active {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-meta {
  font-size: 0.72rem;
  opacity: 0.9;
}

.admin-panel {
  display: block;
}

.panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subheading {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.25rem;
  margin-top: 0.35rem;
  color: var(--text);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Settings — top-level section tabs */
.settings-shell {
  max-width: 1080px;
}

.settings-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.35rem;
  padding: 0.55rem;
  background: linear-gradient(
    165deg,
    var(--card) 0%,
    var(--bg-subtle, rgba(0, 0, 0, 0.02)) 100%
  );
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 4px 22px rgba(15, 23, 42, 0.09),
    0 1px 2px rgba(15, 23, 42, 0.05);
}

@media (max-width: 900px) {
  .settings-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .settings-nav {
    grid-template-columns: 1fr;
  }
}

.settings-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 3.25rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}

.settings-nav-tab:hover {
  border-color: rgba(22, 163, 74, 0.45);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.settings-nav-tab.active {
  border-color: var(--primary);
  color: var(--text);
  background: var(--card);
  box-shadow:
    0 6px 18px rgba(22, 163, 74, 0.22),
    0 2px 6px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.settings-nav-tab--danger.active {
  border-color: #dc2626;
  box-shadow:
    0 6px 18px rgba(220, 38, 38, 0.2),
    0 2px 6px rgba(15, 23, 42, 0.08);
}

.settings-nav-tab-label {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.settings-pane-lead {
  margin: 0 0 1rem;
  max-width: 42rem;
  line-height: 1.5;
}

.settings-pane > .card {
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.07);
}

.settings-pane[hidden] {
  display: none !important;
}

/* Integrations (settings) */
.integ-head {
  margin-bottom: 0.25rem;
}

.integ-lead {
  max-width: 42rem;
  margin: 0.35rem 0 0;
}

.integ-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 0.85rem;
}

.integ-subtab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.integ-subtab:hover {
  border-color: var(--primary);
  color: var(--text);
}

.integ-subtab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.integ-pane {
  padding-top: 0.25rem;
}

.integ-hint {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
}

.integ-hint strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.integ-hint p {
  margin: 0;
}

.integ-howto {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.integ-howto summary {
  cursor: pointer;
  font-weight: 600;
}

.integ-howto ul {
  margin: 0.65rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.55;
  color: var(--muted);
  font-size: 0.875rem;
}

.integ-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 0.65rem;
  margin: 0.5rem 0 1rem;
}

.integ-status-chip {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.integ-status-chip.is-ok {
  border-color: rgba(22, 163, 74, 0.45);
}

.integ-status-chip.is-off {
  border-color: var(--border);
  opacity: 0.92;
}

.integ-status-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.integ-status-state {
  font-size: 0.8rem;
  color: var(--muted);
}

.integ-form-status {
  min-height: 1.25rem;
  margin-top: 0.35rem;
}

.sys-monitor-card {
  max-width: 960px;
}

.sys-monitor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sys-monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.sys-meter {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.sys-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sys-meter-label {
  font-weight: 600;
  color: var(--text);
}

.sys-meter-value {
  font-size: 1.35rem;
  color: var(--text);
}

.sys-meter-bar {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.sys-meter-fill {
  height: 100%;
  background: var(--accent, #2563eb);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.sys-meter-fill.warn {
  background: #d97706;
}

.sys-meter-fill.crit {
  background: #dc2626;
}

.sys-meter-detail {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.sys-swap-line {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.sys-disk-table code {
  font-size: 0.85em;
}

.sys-docker-table code {
  font-size: 0.78em;
  white-space: nowrap;
}

.docker-summary {
  margin: -0.15rem 0 0.75rem;
  font-size: 0.85rem;
}

.docker-container-id {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
}

.docker-badge {
  display: inline-flex;
  align-items: center;
  min-width: 4.8rem;
  justify-content: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.docker-badge.ok {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}

.docker-badge.warn {
  color: #b45309;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.25);
}

.docker-badge.bad {
  color: #b42318;
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(180, 35, 24, 0.25);
}

.docker-badge.muted {
  color: var(--muted);
  background: var(--bg-subtle);
  border-color: var(--border);
}

.docker-unavailable {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  color: var(--muted);
  background: var(--bg-subtle);
}

.stats-detail {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.doc-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.2rem;
}

.doc-repair-hint {
  font-size: 0.72rem;
  color: var(--warning);
  margin-top: 0.15rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
}

.docs-table {
  margin-top: 0.5rem;
}

.jql-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.jql-field textarea {
  width: 100%;
  min-height: 4rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.card code {
  font-size: 0.8rem;
  background: var(--bg-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  align-items: end;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.form-row label.checkbox-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  align-self: center;
}

.form-row label.checkbox-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.15);
}

.form-row textarea {
  min-width: 280px;
  resize: vertical;
}

.indexing-settings-form label {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.form-actions-row {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* —— Login —— */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--sidebar-bg);
  position: relative;
}

.login-lang-host {
  position: absolute;
  top: 1.35rem;
  right: 1.35rem;
  z-index: 20;
  padding: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.login-lang-host .lw-wrap {
  height: 34px;
  gap: 0.25rem;
  padding: 0 0.48rem;
  border: 1px solid rgba(209, 213, 219, 0.86);
  border-radius: var(--radius-pill);
  background: rgba(250, 251, 252, 0.92);
  box-shadow: 0 8px 20px rgba(45, 49, 57, 0.08);
}

.login-lang-host .lw-globe {
  width: 15px;
  height: 15px;
}

.login-lang-host .lw-select {
  min-width: 2.45rem;
  width: 2.45rem;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.login-lang-host .lw-select:focus {
  outline: none;
  box-shadow: none;
}

.login-lang-host .lw-caret {
  position: static;
  color: var(--muted);
  font-size: 0.62rem;
}

.login-card {
  background: var(--card);
  padding: 2rem 2.25rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.login-brand .brand-mark {
  width: 44px;
  height: 44px;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-card .hint-demo {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.12);
}

.login-tab {
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 0.5rem 0.65rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.login-tab.active {
  background: var(--primary);
  color: #fff;
}

.login-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.login-select-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.login-card input,
.login-card select {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  background: var(--card);
  color: var(--text);
}

.login-card select {
  margin-bottom: 0;
}

.login-card input:focus,
.login-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.2);
}

.login-card .btn {
  width: 100%;
  margin-top: 0.25rem;
}

.login-help {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.login-secondary-action {
  margin-top: 0.55rem !important;
}

.login-link {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.login-link:hover {
  color: var(--primary-hover);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.error.hint-warn {
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.badge.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.indexed {
  background: var(--success-soft);
  color: var(--success);
}

.badge.degraded {
  background: rgba(210, 120, 30, 0.15);
  color: #b45309;
}

.notice-embedding {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(210, 120, 30, 0.35);
  background: rgba(210, 120, 30, 0.08);
  font-size: 0.9rem;
  line-height: 1.45;
}

.notice-embedding a {
  margin-left: 0.35rem;
}

.notice-embedding .btn {
  margin: 0 0.35rem;
  vertical-align: middle;
}

.col-name .doc-name {
  cursor: help;
  word-break: break-word;
}

.doc-name-trunc {
  font-weight: 500;
}

.stat-warn {
  color: #b45309;
}

.col-vectors {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

.vectors-count {
  font-weight: 600;
}

.vectors-count.vectors-ok {
  color: var(--success, #1f7a4f);
}

.vectors-count.vectors-partial {
  color: #b45309;
}

.vectors-count.vectors-none {
  color: var(--danger, #b42318);
}

.badge.pending,
.badge.processing {
  background: var(--warning-soft);
  color: var(--warning);
}

.btn-danger {
  background: var(--card);
  color: var(--danger);
  border: 1px solid #fecaca;
  box-shadow: none;
}

.btn-danger:hover {
  background: var(--danger-soft);
  box-shadow: none;
  transform: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3 {
  font-size: 1rem;
  margin: 0.5rem 0;
}

.msg.assistant code {
  background: var(--bg-subtle);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.rag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.rag-dot.ready {
  background: var(--success);
}

.rag-dot.indexing,
.rag-dot.processing {
  background: var(--warning);
}

.rag-dot.degraded,
.rag-dot.failed,
.rag-dot.empty {
  background: var(--danger);
}

/* AI Quality Center */
.qa-center .qa-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.qa-center .qa-lead {
  max-width: 42rem;
  margin: 0.35rem 0 0;
}

.qa-howto {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.03));
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.qa-howto summary {
  cursor: pointer;
  font-weight: 600;
}

.qa-steps {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.55;
}

.qa-mode-legend {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.qa-legend-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.qa-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.qa-stat-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.qa-stat-card.qa-stat-alert {
  border-color: #e8a0a0;
  background: #fff8f8;
}

.qa-stat-card.qa-stat-alert .qa-stat-value {
  color: #c0392b;
}

.qa-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.qa-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.qa-section {
  margin-top: 1.75rem;
}

.qa-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.qa-run-picker select {
  min-width: 220px;
}

.qa-mode-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.06));
  border: 1px solid var(--border);
  white-space: nowrap;
}

.qa-mode-documentation {
  background: rgba(13, 148, 136, 0.12);
  border-color: rgba(13, 148, 136, 0.35);
  color: #0d9488;
}

.qa-mode-expert_fallback,
.qa-mode-expert_advisory {
  background: rgba(234, 88, 12, 0.1);
  border-color: rgba(234, 88, 12, 0.35);
  color: #c2410c;
}

.qa-mode-insufficient,
.qa-mode-refused {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.3);
  color: #b42318;
}

.qa-q-cell {
  max-width: 280px;
  line-height: 1.4;
}

.qa-fail-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--danger, #b42318);
}

.text-fail {
  color: var(--danger, #b42318);
}

.qa-progress {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
}

.qa-progress-inner {
  background: var(--card);
  padding: 1.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  text-align: center;
}

/* Knowledge gaps panel */
.gap-reason-cell .gap-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 280px;
}

.warmth-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.warmth-pct {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 2.5rem;
  color: var(--muted);
}

.warmth-bar {
  flex: 1;
  max-width: 100px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.warmth-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.warmth-bar.warmth-ok span {
  background: var(--success, #0d9488);
}

.warmth-bar.warmth-warn span {
  background: var(--warning, #d97706);
}

.warmth-bar.warmth-bad span {
  background: var(--danger, #b42318);
}

.gaps-center .qa-section h3 {
  margin-bottom: 0.35rem;
}
