/* 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;
  flex-shrink: 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 var(--border);
}

.sidebar-section--sessions {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar-section--sessions h3 {
  flex-shrink: 0;
}

.sidebar-section--sessions > .sidebar-nav-label,
.sidebar-section--sessions > .btn {
  flex-shrink: 0;
}

.session-carousel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  gap: 0.28rem;
  outline: none;
}

.session-carousel:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
  border-radius: 10px;
}

.session-carousel-btn {
  flex-shrink: 0;
  width: 100%;
  height: 1.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.session-carousel-btn[hidden] {
  display: none;
}

.session-carousel-btn:hover:not(:disabled) {
  color: var(--primary);
  border-color: rgba(30, 184, 168, 0.35);
  background: rgba(30, 184, 168, 0.1);
}

.session-carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.session-carousel-viewport {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.session-carousel.has-overflow .session-carousel-viewport::before,
.session-carousel.has-overflow .session-carousel-viewport::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 0.65rem;
  pointer-events: none;
  z-index: 1;
}

.session-carousel.has-overflow .session-carousel-viewport::before {
  top: 0;
  margin-bottom: -0.65rem;
  background: linear-gradient(180deg, var(--sidebar-bg), transparent);
}

.session-carousel.has-overflow .session-carousel-viewport::after {
  bottom: 0;
  margin-top: -0.65rem;
  background: linear-gradient(0deg, var(--sidebar-bg), transparent);
}

.session-carousel-viewport::-webkit-scrollbar {
  display: none;
}

.sidebar-section h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.68rem;
  color: var(--muted);
  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 var(--border);
  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:not(.sidebar-section--sessions),
  .sidebar-nav-group:not(#sidebarModulesGroup):not(#sidebarAdminGroup) {
    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;
  }

  .app-sidebar:has(#adminSidebarNav) {
    flex-wrap: wrap;
    overflow-y: auto;
  }

  .app-sidebar:has(#adminSidebarNav) #sidebarAdminGroup {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.15rem 0 0;
    margin: 0;
    border: 0;
  }

  .app-sidebar:has(#adminSidebarNav) #sidebarAdminGroup .sidebar-nav-label {
    display: none;
  }

  .sidebar-section--sessions {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    max-height: 10rem;
    overflow: auto;
    padding: 0.25rem 0 0;
    margin: 0;
  }

  .sidebar-section--sessions > .sidebar-nav-label,
  .sidebar-section--sessions h3 {
    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.12rem 0.1rem;
  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(--text-secondary);
}

.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;
  color: var(--text);
}

.session-product {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 14rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #0e7490;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  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: color-mix(in srgb, var(--primary) 16%, var(--card));
  color: #0f766e;
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
}

.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.55rem;
}

.chat-main:has(.assist-empty-state:not([hidden])) .page-head--compact {
  padding: 0.65rem 1rem 0.5rem;
}

.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-steps {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  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 1.75rem;
  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;
  max-width: 34rem;
  position: relative;
  overflow: hidden;
  padding: 0.95rem 1.05rem 1rem;
  border-radius: 1rem;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--card) 96%, var(--primary) 4%), var(--card)) padding-box,
    linear-gradient(120deg, rgba(30, 184, 168, 0.45), rgba(61, 214, 200, 0.25), rgba(30, 184, 168, 0.4))
    border-box;
  box-shadow:
    0 10px 28px rgba(30, 184, 168, 0.12),
    0 0 0 1px rgba(30, 184, 168, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  animation: thinking-card-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both, thinking-card-breathe 3.2s ease-in-out 0.45s infinite;
}

.msg.assistant-thinking::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 80% at 0% 50%, rgba(30, 184, 168, 0.1), transparent 58%);
  pointer-events: none;
  z-index: 0;
  animation: thinking-aurora-drift 4.5s ease-in-out infinite alternate;
}

.msg.assistant-thinking::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 42%,
    rgba(61, 214, 200, 0.18) 50%,
    rgba(255, 255, 255, 0.04) 58%,
    transparent 100%
  );
  transform: translateX(-120%);
  animation: thinking-shimmer 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.thinking-row {
  position: relative;
  z-index: 1;
  display: block;
}

.thinking-stage {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.thinking-orb {
  position: relative;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
}

.thinking-orb-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(30, 184, 168, 0.22) 0%, transparent 68%);
  animation: thinking-halo-pulse 2.4s ease-in-out infinite;
}

.thinking-orb-sweep {
  position: absolute;
  inset: 0.2rem;
  border-radius: 50%;
  border: 2px solid rgba(30, 184, 168, 0.18);
  background: conic-gradient(
    from 0deg,
    transparent 0deg 250deg,
    rgba(61, 214, 200, 0.95) 300deg,
    rgba(30, 184, 168, 0.15) 330deg,
    transparent 360deg
  );
  mask: radial-gradient(circle, transparent 58%, #000 59%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%);
  animation: thinking-sweep-spin 1.35s linear infinite;
}

.thinking-orb-orbit {
  position: absolute;
  inset: 0;
  animation: thinking-orbit-spin 3.6s linear infinite;
}

.thinking-orb-orbit i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.34rem;
  height: 0.34rem;
  margin: -0.17rem;
  border-radius: 50%;
  background: #3dd6c8;
  box-shadow: 0 0 10px rgba(61, 214, 200, 0.75);
}

.thinking-orb-orbit i:nth-child(1) {
  transform: rotate(0deg) translateX(1.15rem);
}

.thinking-orb-orbit i:nth-child(2) {
  transform: rotate(120deg) translateX(1.15rem);
  opacity: 0.75;
  animation: thinking-particle-pulse 1.8s ease-in-out infinite;
}

.thinking-orb-orbit i:nth-child(3) {
  transform: rotate(240deg) translateX(1.15rem);
  opacity: 0.55;
  animation: thinking-particle-pulse 1.8s ease-in-out 0.6s infinite;
}

.thinking-orb-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #fff 0%, #3dd6c8 45%, #1eb8a8 100%);
  box-shadow:
    0 0 12px rgba(30, 184, 168, 0.8),
    0 0 24px rgba(61, 214, 200, 0.35);
  animation: thinking-core-glow 1.8s ease-in-out infinite;
}

.thinking-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1;
}

.thinking-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--text);
}

.thinking-subtitle {
  display: block;
  min-height: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--primary);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.thinking-subtitle.is-changing {
  opacity: 0;
  transform: translateY(4px);
}

.thinking-progress {
  position: relative;
  height: 0.22rem;
  margin-top: 0.2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--border));
  overflow: hidden;
}

.thinking-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #1eb8a8, #3dd6c8, transparent);
  animation: thinking-progress-slide 1.65s ease-in-out infinite;
}

.thinking-stream.msg-body {
  opacity: 0;
  transform: none;
  transition:
    opacity 0.55s ease,
    filter 0.55s ease;
}

.msg.assistant-streaming .thinking-stream.msg-body,
.msg.assistant-streaming > .msg-body {
  opacity: 0.72;
  transform: none;
  filter: saturate(0.92);
}

.msg.assistant-streaming--active .thinking-stream.msg-body,
.msg.assistant-streaming--active > .msg-body {
  opacity: 0.9;
  transform: none;
  filter: saturate(0.98);
}

.msg.assistant-streaming--ready .thinking-stream.msg-body,
.msg.assistant-streaming--ready > .msg-body {
  opacity: 1;
  transform: none;
  filter: none;
}

@keyframes thinking-card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes thinking-card-breathe {
  0%,
  100% {
    box-shadow:
      0 10px 28px rgba(30, 184, 168, 0.1),
      0 0 0 1px rgba(30, 184, 168, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.65);
  }
  50% {
    box-shadow:
      0 14px 34px rgba(30, 184, 168, 0.18),
      0 0 0 1px rgba(61, 214, 200, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.78);
  }
}

@keyframes thinking-aurora-drift {
  from {
    opacity: 0.55;
    transform: translateX(-2%);
  }
  to {
    opacity: 1;
    transform: translateX(4%);
  }
}

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

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

@keyframes thinking-halo-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@keyframes thinking-particle-pulse {
  0%,
  100% {
    opacity: 0.45;
    box-shadow: 0 0 6px rgba(61, 214, 200, 0.35);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 14px rgba(61, 214, 200, 0.95);
  }
}

@keyframes thinking-core-glow {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.88);
    opacity: 0.85;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 1;
  }
}

@keyframes thinking-progress-slide {
  0% {
    left: -45%;
  }
  100% {
    left: 100%;
  }
}

@keyframes thinking-shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

body.theme-dark .msg.assistant-thinking {
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(61, 214, 200, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.theme-dark .thinking-subtitle {
  color: #5eead4;
}

@media (prefers-reduced-motion: reduce) {
  .msg.assistant-thinking,
  .msg.assistant-thinking::before,
  .msg.assistant-thinking::after,
  .thinking-orb-halo,
  .thinking-orb-sweep,
  .thinking-orb-orbit,
  .thinking-orb-orbit i,
  .thinking-orb-core,
  .thinking-progress-bar {
    animation: none !important;
  }

  .thinking-subtitle {
    transition: none;
  }

  .thinking-subtitle.is-changing {
    opacity: 1;
    transform: none;
  }

  .thinking-stream.msg-body,
  .msg.assistant-streaming .thinking-stream.msg-body,
  .msg.assistant-streaming > .msg-body {
    transform: none;
    transition: opacity 0.2s ease;
  }
}

.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;
}

.curator-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.training-example-modal textarea {
  min-height: 10rem;
  font-family: inherit;
  line-height: 1.45;
}

.training-save-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 100%;
  font-size: 0.88rem;
}

.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;
}

.msg .sources li.source-fragment {
  list-style: none;
  margin-left: -1.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  scroll-margin-top: 5rem;
}

.msg .sources li.source-fragment .source-fragment-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
}

.msg .sources li.source-fragment .source-fragment-num {
  color: var(--fusion-accent);
  margin-right: 0.2rem;
}

.msg .sources li.source-fragment .source-fragment-excerpt {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-secondary);
  max-height: 18rem;
  overflow: auto;
  white-space: pre-wrap;
}

.msg .sources li.source-fragment:target,
.msg .sources li.source-fragment.is-active {
  background: rgba(43, 108, 176, 0.1);
  border-color: rgba(43, 108, 176, 0.28);
}

.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: 0.85rem 1.25rem 1rem;
  background: var(--card);
  border-top: 1px solid var(--border);
}

.composer-gpt {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.65rem;
  padding: 0.55rem 0.55rem 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--card) 94%, var(--bg) 6%);
  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: 1.5rem;
  max-height: 9.5rem;
  resize: none;
  padding: 0.4rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  overflow-y: auto;
}

.composer-gpt textarea:focus {
  outline: none;
  box-shadow: none;
}

.composer-gpt .composer-icon-btn {
  flex-shrink: 0;
  align-self: flex-end;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.composer-gpt .composer-icon-btn:hover {
  border-color: var(--primary);
}

.composer-gpt .composer-icon-btn.is-recording {
  border-color: #dc2626;
  background: color-mix(in srgb, #dc2626 12%, var(--card));
}

.assist-figures {
  margin-top: 1rem;
}

.assist-figures-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.assist-figures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.assist-figure {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}

.assist-figure-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #e5e7eb;
}

.assist-figure-cap {
  padding: 0 0.5rem 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.assist-mermaid {
  margin: 0.85rem 0;
  overflow-x: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--card) 92%, var(--bg) 8%);
}

.assist-speak-btn.is-playing {
  color: var(--primary);
}

.composer-gpt .composer-send-btn {
  flex-shrink: 0;
  align-self: flex-end;
  margin: 0;
  min-width: 6.25rem;
  height: 2.35rem;
  min-height: 2.35rem;
  padding: 0 1rem;
  border-radius: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.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--send-only {
  justify-content: flex-end;
}

.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: 0;
  min-width: 6.25rem;
  height: 2.35rem;
  min-height: 2.35rem;
  padding: 0 1rem;
  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: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0.65rem;
}

.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-field textarea:focus-visible,
.composer-row textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 184, 168, 0.2);
}

.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);
}

.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;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.assist-empty-state[hidden] {
  display: none !important;
}

.assist-empty-state:not([hidden]) {
  display: block;
  pointer-events: auto;
  background: var(--bg);
}

.assist-studio {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
  color: #e8eef6;
  background:
    radial-gradient(1200px 420px at 10% -10%, rgba(30, 184, 168, 0.16), transparent 55%),
    radial-gradient(900px 380px at 90% 0%, rgba(220, 38, 38, 0.1), transparent 50%),
    #0b1220;
}

.assist-studio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.assist-studio-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7dd3c7;
}

.assist-studio-title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  font-weight: 800;
  color: #fff;
}

.assist-studio-lead {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: #9fb0c3;
}

.assist-product-badge {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.7);
}

.assist-product-badge-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8aa0b8;
}

.assist-product-badge select {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
}

.assist-product-badge-meta {
  font-size: 0.75rem;
  color: #8aa0b8;
}

.assist-wizard-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.assist-wizard-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.assist-wizard-tab.is-active {
  border-color: rgba(30, 184, 168, 0.55);
  background: linear-gradient(180deg, rgba(30, 184, 168, 0.18), rgba(255, 255, 255, 0.03));
}

.assist-wizard-tab-kicker {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3c7;
}

.assist-wizard-tab-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.assist-wizard-tab-meta {
  font-size: 0.75rem;
  color: #8aa0b8;
}

.assist-wizard-stage {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr) 15rem;
  gap: 0.7rem;
  min-height: 22rem;
}

.assist-wizard-col {
  border-radius: 1rem;
  overflow: hidden;
}

.assist-wizard-col--was {
  background: #fff7f7;
  color: #7f1d1d;
  border-top: 4px solid #ef4444;
}

.assist-wizard-col--now {
  background: #f8fffe;
  color: #0f172a;
  border-top: 4px solid #14b8a6;
}

.assist-wizard-col--effect {
  background: #f8fafc;
  color: #0f172a;
  border-top: 4px solid #2563eb;
}

.assist-wizard-col-inner {
  padding: 0.85rem 0.9rem 1rem;
}

.assist-wizard-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.assist-wizard-pill--was { background: #ef4444; }
.assist-wizard-pill--now { background: #14b8a6; }
.assist-wizard-pill--effect { background: #2563eb; }

.assist-wizard-col h3 {
  margin: 0.45rem 0 0.55rem;
  font-size: 1.02rem;
}

.assist-wizard-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.assist-wizard-points li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.4;
}

.assist-wizard-col--was .assist-wizard-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ef4444;
}

.assist-wizard-col--now .assist-wizard-points li::before,
.assist-wizard-col--effect .assist-wizard-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.38rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #14b8a6;
}

.assist-wizard-visual {
  margin: 0.7rem 0 0.85rem;
  min-height: 9.5rem;
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 30% 40%, rgba(20, 184, 166, 0.18), transparent 45%),
    linear-gradient(135deg, #0f172a, #134e4a);
  color: #ecfeff;
  display: grid;
  place-items: center;
  padding: 0.8rem;
}

.assist-wizard-visual svg {
  width: min(100%, 28rem);
  height: auto;
}

.assist-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.assist-wizard-actions .btn,
.assist-wizard-ask {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.55rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.assist-wizard-ask {
  background: #0f766e;
  color: #fff;
}

.assist-wizard-nav {
  background: #e2e8f0;
  color: #0f172a;
}

.assist-wizard-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.assist-wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.assist-wizard-step {
  width: 1.55rem;
  height: 1.55rem;
  border: 0;
  border-radius: 50%;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.assist-wizard-step.is-active {
  background: #14b8a6;
  color: #fff;
}

@media (max-width: 1100px) {
  .assist-wizard-stage {
    grid-template-columns: 1fr;
  }
  .assist-wizard-tabs,
  .assist-studio-head {
    grid-template-columns: 1fr;
    display: grid;
  }
}

.assist-home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.assist-home-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.assist-home-rail {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-left: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--card) 96%, var(--primary) 4%) 0%,
    color-mix(in srgb, var(--card) 90%, var(--bg) 10%) 100%
  );
  overflow: hidden;
}

.assist-rail-head {
  flex-shrink: 0;
  padding: 0.7rem 0.75rem 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.assist-rail-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}

.assist-product-picker {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  padding: 0.35rem 0.55rem 0.55rem;
}

.assist-product-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  gap: 0.28rem;
  outline: none;
}

.assist-product-list:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
  border-radius: 12px;
}

.assist-product-list-btn {
  flex-shrink: 0;
  width: 100%;
  height: 1.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.assist-product-list-btn[hidden] {
  display: none;
}

.assist-product-list-btn:hover:not(:disabled) {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
}

.assist-product-list-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.assist-product-list-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding: 0.12rem 0.1rem;
  scrollbar-width: none;
}

.assist-product-list.has-overflow .assist-product-list-viewport::before,
.assist-product-list.has-overflow .assist-product-list-viewport::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 0.65rem;
  pointer-events: none;
  z-index: 1;
  flex-shrink: 0;
}

.assist-product-list.has-overflow .assist-product-list-viewport::before {
  top: 0;
  margin-bottom: -0.65rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--card) 92%, var(--bg) 8%), transparent);
}

.assist-product-list.has-overflow .assist-product-list-viewport::after {
  bottom: 0;
  margin-top: -0.65rem;
  align-self: stretch;
  background: linear-gradient(0deg, color-mix(in srgb, var(--card) 92%, var(--bg) 8%), transparent);
}

.assist-product-list-viewport::-webkit-scrollbar {
  display: none;
}

.assist-product-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.12rem;
  flex-shrink: 0;
  width: 100%;
  min-height: 2.55rem;
  padding: 0.48rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 94%, var(--bg) 6%);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.assist-product-list-item:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--card) 88%, var(--primary) 12%);
}

.assist-product-list-item.is-active {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
  background: color-mix(in srgb, var(--card) 72%, var(--primary) 28%);
  box-shadow:
    inset 3px 0 0 var(--primary),
    0 6px 18px color-mix(in srgb, var(--primary) 12%, transparent);
}

.assist-product-list-name {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  word-break: break-word;
}

.assist-product-list-meta {
  font-size: 0.6rem;
  line-height: 1.3;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.assist-product-list-item.is-active .assist-product-list-name {
  color: var(--primary);
}

.assist-product-list-item.is-active .assist-product-list-meta {
  color: color-mix(in srgb, var(--primary) 55%, var(--text-secondary));
}

.assist-product-empty {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
}

.page-product-logo {
  display: none !important;
}

.assist-digest-card {
  pointer-events: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  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-home-layout .assist-digest-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "topics topics"
    "daily top"
    "assistant top";
  gap: 0.7rem;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  align-items: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}

#assist-section-topics {
  grid-area: topics;
}

#assist-section-daily {
  grid-area: daily;
}

#assist-section-top {
  grid-area: top;
}

#assist-section-assistant {
  grid-area: assistant;
}

.assist-home-layout .assist-digest-section {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.9rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 6%, transparent);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.assist-home-layout .assist-digest-section:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 10%, transparent);
}

.assist-home-layout .assist-digest-section--feature {
  padding: 1rem 1rem 0.95rem;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--card) 88%, var(--primary) 12%) 0%,
    var(--card) 55%
  );
}

.assist-home-layout .assist-section-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assist-home-layout .assist-section-mark {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.assist-home-layout .assist-section-mark--topics {
  color: #0d9488;
  background: #14b8a6;
}

.assist-home-layout .assist-section-mark--daily {
  color: #2563eb;
  background: #3b82f6;
}

.assist-home-layout .assist-section-mark--top {
  color: #db2777;
  background: #ec4899;
}

.assist-home-layout .assist-section-mark--assistant {
  color: #7c3aed;
  background: #8b5cf6;
}

.assist-home-layout .assist-section-lead {
  margin: 0.3rem 0 0.65rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.assist-home-layout .assist-digest-section .chips-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  flex: 0 0 auto;
  min-height: 0;
}

.assist-home-layout .chips-list--feature {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.assist-home-layout .assist-digest-section .chip {
  width: 100%;
  max-width: none;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  border-radius: 11px;
  padding: 0.62rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  border: 1px solid transparent;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.assist-home-layout .assist-digest-section .chip::before {
  content: "";
  width: 0.22rem;
  align-self: stretch;
  border-radius: 999px;
  flex-shrink: 0;
  margin-right: 0.1rem;
  opacity: 0.9;
}

.assist-home-layout .assist-digest-section .chip-daily {
  background: color-mix(in srgb, #3b82f6 10%, var(--card));
  border-color: color-mix(in srgb, #3b82f6 18%, transparent);
}

.assist-home-layout .assist-digest-section .chip-daily::before {
  background: #3b82f6;
}

.assist-home-layout .assist-digest-section .chip-assistant {
  background: color-mix(in srgb, #8b5cf6 10%, var(--card));
  border-color: color-mix(in srgb, #8b5cf6 18%, transparent);
}

.assist-home-layout .assist-digest-section .chip-assistant::before {
  background: #8b5cf6;
}

.assist-home-layout .assist-digest-section .chip-top {
  background: color-mix(in srgb, #ec4899 10%, var(--card));
  border-color: color-mix(in srgb, #ec4899 18%, transparent);
}

.assist-home-layout .assist-digest-section .chip-top::before {
  background: #ec4899;
}

.assist-home-layout .assist-digest-section .chip-topic {
  min-height: 4.6rem;
  align-items: center;
  background: color-mix(in srgb, #14b8a6 12%, var(--card));
  border-color: color-mix(in srgb, #14b8a6 24%, transparent);
}

.assist-home-layout .assist-digest-section .chip-topic::before {
  background: linear-gradient(180deg, #2dd4bf, #0d9488);
}

.assist-home-layout .assist-digest-section .chip::after {
  content: "→";
  margin-left: auto;
  font-size: 0.9rem;
  line-height: 1;
  color: color-mix(in srgb, var(--text-secondary) 55%, transparent);
  transition: transform 0.16s ease, color 0.16s ease;
}

.assist-home-layout .assist-digest-section .chip:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 10%, transparent);
}

.assist-home-layout .assist-digest-section .chip:hover::after {
  transform: translateX(2px);
  color: var(--primary);
}

.assist-home-layout .assist-digest-section .chip-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
}

.assist-home-layout .assist-section-empty {
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
}

.assist-home-layout .assist-product-highlights .chip {
  border-radius: 8px;
  padding: 0.48rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 70%, var(--card) 30%);
  box-shadow: none;
}

.assist-home-layout .assist-product-highlights .chip:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--primary) 24%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
}

.assist-digest-sections {
  display: grid;
  grid-template-columns: repeat(2, 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-home-rail {
  background: color-mix(in srgb, var(--card) 88%, #000 12%);
}

.theme-dark .assist-home-layout .assist-digest-section {
  background: color-mix(in srgb, var(--card) 92%, #000 8%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.theme-dark .assist-home-layout .assist-digest-section--feature {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--card) 82%, #14b8a6 18%) 0%,
    color-mix(in srgb, var(--card) 94%, #000 6%) 60%
  );
}

.theme-dark .assist-home-layout .assist-digest-section .chip-daily,
.theme-dark .assist-home-layout .assist-digest-section .chip-assistant,
.theme-dark .assist-home-layout .assist-digest-section .chip-top,
.theme-dark .assist-home-layout .assist-digest-section .chip-topic {
  color: var(--text);
}

.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: 1100px) {
  .assist-home-layout {
    grid-template-columns: minmax(0, 1fr) 14.5rem;
  }
}

@media (max-width: 900px) {
  .assist-home-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .assist-home-main {
    padding: 0.65rem 0.65rem 0.35rem;
  }

  .assist-home-rail {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
    justify-content: flex-start;
  }

  .assist-product-picker {
    padding: 0.4rem 0.5rem 0.55rem;
    min-height: 12rem;
    max-height: min(46vh, 24rem);
  }

  .assist-home-layout .assist-digest-sections {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topics"
      "daily"
      "top"
      "assistant";
    overflow: visible;
  }

  .assist-home-layout .chips-list--feature {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .assist-home-layout .assist-digest-sections {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
}

@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: none;
    margin: 0;
  }
}

.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 {
  flex: 0 0 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.chat-feed:has(.assist-empty-state:not([hidden])) .messages--empty {
  display: none;
}

.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;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 1.25rem 2rem;
}

.admin-page .card {
  min-width: 0;
}

.admin-page .table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.admin-page .users-table--rich {
  min-width: 920px;
}

.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-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.knowledge-toolbar-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.toolbar-row--filters {
  align-items: center;
}

.toolbar-row--actions {
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}

.toolbar-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 18rem;
}

.toolbar-upload-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toolbar-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar-field--narrow .upload-version-input {
  width: 5rem;
  min-width: 4.5rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

#knowledgeToolbar .btn {
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
}

#knowledgeToolbar .filter-select,
#knowledgeToolbar .search-input {
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  border-radius: 8px;
  min-height: 2.1rem;
}

#knowledgeToolbar .refresh-status {
  margin: 0;
  font-size: 0.78rem;
  text-align: right;
}

.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;
  min-width: 220px;
  max-width: 360px;
}
.knowledge-table .col-name .doc-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-table .col-description {
  min-width: 220px;
  max-width: 420px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}

.knowledge-table .col-description .doc-description {
  display: block;
}

.knowledge-table .col-description .muted {
  color: var(--muted);
}

.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;
}

.documentation-layout {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.page-panel.documentation-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.documentation-page .page-head {
  margin-bottom: 0.5rem;
}

.documentation-page.is-reading .page-head {
  display: none;
}

.documentation-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.sidebar-section--docs {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  gap: 0.32rem;
}

.sidebar-section--docs > .sidebar-nav-label {
  flex-shrink: 0;
  padding-bottom: 0.15rem;
}

.sidebar-section--docs .documentation-menu-product {
  position: relative;
  display: block;
  flex-shrink: 0;
  margin: 0.05rem 0 0.15rem;
}

.documentation-product-card {
  display: grid;
  grid-template-columns: 2.05rem minmax(0, 1fr) auto 0.7rem;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.15rem;
  padding: 0.48rem 0.5rem 0.48rem 0.48rem;
  border-radius: 12px;
  border: 1px solid rgba(91, 103, 216, 0.16);
  background:
    linear-gradient(135deg, rgba(238, 242, 255, 0.95) 0%, rgba(248, 250, 252, 0.92) 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  pointer-events: none;
}

.documentation-product-mark {
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 9px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
  background: #5b67d8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.documentation-product-copy {
  min-width: 0;
}

.documentation-product-copy strong {
  display: block;
  overflow: hidden;
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.documentation-product-copy em {
  display: block;
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.documentation-product-count {
  min-width: 1.55rem;
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  background: rgba(91, 103, 216, 0.12);
  color: #4338ca;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.documentation-product-chevron {
  width: 0.42rem;
  height: 0.42rem;
  margin-top: -0.18rem;
  border-right: 1.8px solid #64748b;
  border-bottom: 1.8px solid #64748b;
  opacity: 0.55;
  transform: rotate(45deg);
}

.documentation-product-select {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 1rem;
}

.documentation-menu-product:focus-within .documentation-product-card,
.documentation-menu-product:hover .documentation-product-card {
  border-color: rgba(91, 103, 216, 0.32);
  box-shadow: 0 6px 16px rgba(91, 103, 216, 0.1);
}

.documentation-menu-product.is-atmeye .documentation-product-card {
  border-color: rgba(8, 145, 178, 0.2);
  background: linear-gradient(135deg, #ecfeff 0%, #f0f9ff 100%);
}

.documentation-menu-product.is-atmeye .documentation-product-mark {
  background: linear-gradient(180deg, #22d3ee 0%, #0891b2 100%);
}

.documentation-menu-product.is-atmeye .documentation-product-copy strong {
  color: #155e75;
}

.documentation-menu-product.is-atmeye .documentation-product-count {
  background: rgba(8, 145, 178, 0.12);
  color: #0e7490;
}

.documentation-menu-product.is-vynamic .documentation-product-card {
  border-color: rgba(79, 70, 229, 0.2);
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.documentation-menu-product.is-vynamic .documentation-product-mark {
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
}

.documentation-menu-product.is-vynamic .documentation-product-copy strong {
  color: #3730a3;
}

.documentation-menu-product.is-vynamic .documentation-product-count {
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
}

.documentation-menu-product.is-cash .documentation-product-card {
  border-color: rgba(5, 150, 105, 0.2);
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 100%);
}

.documentation-menu-product.is-cash .documentation-product-mark {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
}

.documentation-menu-product.is-cash .documentation-product-copy strong {
  color: #065f46;
}

.documentation-menu-product.is-cash .documentation-product-count {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
}

.documentation-menu-product.is-pulse .documentation-product-card {
  border-color: rgba(225, 29, 72, 0.18);
  background: linear-gradient(135deg, #fff1f2 0%, #fff7ed 100%);
}

.documentation-menu-product.is-pulse .documentation-product-mark {
  background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%);
}

.documentation-menu-product.is-pulse .documentation-product-copy strong {
  color: #9f1239;
}

.documentation-menu-product.is-pulse .documentation-product-count {
  background: rgba(225, 29, 72, 0.1);
  color: #be123c;
}

.documentation-menu-product.is-fusion .documentation-product-card {
  border-color: rgba(91, 103, 216, 0.22);
  background: linear-gradient(135deg, #eef0fb 0%, #f5f3ff 100%);
}

.documentation-menu-product.is-fusion .documentation-product-mark {
  background: linear-gradient(180deg, #818cf8 0%, #5b67d8 100%);
}

.documentation-menu-product.is-fusion .documentation-product-copy strong {
  color: #3730a3;
}

.documentation-menu-product.is-fusion .documentation-product-count {
  background: rgba(91, 103, 216, 0.12);
  color: #4338ca;
}

.documentation-menu-product.is-event .documentation-product-card {
  border-color: rgba(217, 119, 6, 0.22);
  background: linear-gradient(135deg, #fff7ed 0%, #fefce8 100%);
}

.documentation-menu-product.is-event .documentation-product-mark {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.documentation-menu-product.is-event .documentation-product-copy strong {
  color: #92400e;
}

.documentation-menu-product.is-event .documentation-product-count {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.documentation-menu-product.is-social .documentation-product-card {
  border-color: rgba(124, 58, 237, 0.22);
  background: linear-gradient(135deg, #f5f3ff 0%, #faf5ff 100%);
}

.documentation-menu-product.is-social .documentation-product-mark {
  background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
}

.documentation-menu-product.is-social .documentation-product-copy strong {
  color: #5b21b6;
}

.documentation-menu-product.is-social .documentation-product-count {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

.sidebar-section--docs .search-input {
  width: 100%;
  min-width: 0;
  padding: 0.32rem 0.45rem;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-active);
  font-size: 0.75rem;
}

.sidebar-section--docs .search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.sidebar-section--docs .documentation-product-select option {
  color: #1f2937;
}

body.theme-dark .documentation-product-card {
  border-color: rgba(148, 163, 184, 0.16);
  background: linear-gradient(135deg, rgba(51, 65, 85, 0.55) 0%, rgba(30, 41, 59, 0.7) 100%);
}

body.theme-dark .documentation-product-copy strong {
  color: #f8fafc;
}

body.theme-dark .documentation-product-copy em {
  color: #94a3b8;
}

body.theme-dark .documentation-product-count {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

body.theme-dark .documentation-product-chevron {
  border-color: #cbd5e1;
}

body.theme-dark .documentation-menu-product.is-atmeye .documentation-product-card {
  border-color: rgba(34, 211, 238, 0.22);
  background: linear-gradient(135deg, rgba(8, 47, 73, 0.72) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-atmeye .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-atmeye .documentation-product-count {
  color: #67e8f9;
}

body.theme-dark .documentation-menu-product.is-vynamic .documentation-product-card,
body.theme-dark .documentation-menu-product.is-fusion .documentation-product-card {
  border-color: rgba(165, 180, 252, 0.22);
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.5) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-vynamic .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-vynamic .documentation-product-count,
body.theme-dark .documentation-menu-product.is-fusion .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-fusion .documentation-product-count {
  color: #c7d2fe;
}

body.theme-dark .documentation-menu-product.is-cash .documentation-product-card {
  border-color: rgba(52, 211, 153, 0.22);
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.55) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-cash .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-cash .documentation-product-count {
  color: #6ee7b7;
}

body.theme-dark .documentation-menu-product.is-pulse .documentation-product-card {
  border-color: rgba(251, 113, 133, 0.22);
  background: linear-gradient(135deg, rgba(136, 19, 55, 0.42) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-pulse .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-pulse .documentation-product-count {
  color: #fda4af;
}

body.theme-dark .documentation-menu-product.is-event .documentation-product-card {
  border-color: rgba(251, 191, 36, 0.28);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.48) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-event .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-event .documentation-product-count {
  color: #fcd34d;
}

body.theme-dark .documentation-menu-product.is-social .documentation-product-card {
  border-color: rgba(167, 139, 250, 0.28);
  background: linear-gradient(135deg, rgba(76, 29, 149, 0.48) 0%, rgba(15, 23, 42, 0.55) 100%);
}

body.theme-dark .documentation-menu-product.is-social .documentation-product-copy strong,
body.theme-dark .documentation-menu-product.is-social .documentation-product-count {
  color: #ddd6fe;
}

.documentation-reader {
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  min-height: 0;
}

.documentation-doc-list {
  list-style: none;
  margin: 0;
  padding: 0 0.05rem;
  overflow: auto;
  flex: 1;
}

.documentation-doc-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1.35rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem;
  text-align: left;
  padding: 0.26rem 0.38rem;
  margin: 0.04rem 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  position: relative;
}

.documentation-doc-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

.documentation-doc-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.documentation-doc-item.is-active {
  background: linear-gradient(
    90deg,
    rgba(45, 212, 191, 0.22) 0%,
    rgba(45, 212, 191, 0.06) 72%,
    transparent 100%
  );
  color: #fff;
}

.documentation-doc-item.is-active::before {
  background: #5eead4;
}

.documentation-doc-num {
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  color: rgba(255, 255, 255, 0.34);
}

.documentation-doc-item.is-active .documentation-doc-num {
  color: #5eead4;
}

.documentation-doc-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.25;
}

.documentation-doc-kind {
  flex-shrink: 0;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.08rem 0.26rem;
  border-radius: 4px;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
}

.documentation-doc-kind.is-pdf {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.documentation-doc-kind.is-doc {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

.documentation-doc-kind.is-html {
  background: rgba(45, 212, 191, 0.18);
  color: #5eead4;
}

.documentation-doc-kind.is-xls {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.documentation-doc-kind.is-ppt {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
}

.sidebar-section--docs .documentation-empty {
  color: rgba(255, 255, 255, 0.38);
  padding: 0.45rem 0.35rem;
  font-size: 0.75rem;
}

.documentation-reader {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.documentation-reader-empty {
  margin: auto;
  padding: 2rem;
  color: var(--muted, #667085);
}

.documentation-reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.documentation-reader-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 140px;
}

.documentation-reader-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documentation-pager,
.documentation-reader-search,
.documentation-zoom {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.documentation-zoom span {
  min-width: 3.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.documentation-page-label input {
  width: 4.2rem;
}

.documentation-hits {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.75rem;
  max-height: 8rem;
  overflow: auto;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.documentation-hit {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.35rem 0;
  cursor: pointer;
}

.documentation-page-view {
  overflow: auto;
  padding: 1rem;
  flex: 1;
}

.documentation-page-stage {
  position: relative;
  width: calc(100% * var(--doc-zoom, 1));
  margin: 0 auto 1rem;
}

.documentation-page-image {
  display: block;
  width: 100%;
  max-width: none;
  background: #fff;
  box-shadow: 0 1px 8px rgba(16, 24, 40, 0.08);
}

.documentation-page-loading {
  display: none;
}

.documentation-page-stage.is-loading,
.documentation-html-sizer.is-loading {
  position: relative;
  min-height: min(62vh, 560px);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 58%, #e8eef6 100%);
  box-shadow: 0 1px 8px rgba(16, 24, 40, 0.08);
}

.documentation-page-stage.is-loading .documentation-page-loading,
.documentation-html-sizer.is-loading .documentation-page-loading {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
}

.documentation-page-skeleton {
  position: absolute;
  inset: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  pointer-events: none;
}

.documentation-page-skeleton span {
  display: block;
  height: 0.72rem;
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 0%, #f8fafc 46%, #e2e8f0 100%);
  background-size: 220% 100%;
  animation: documentation-skeleton-shimmer 1.45s ease-in-out infinite;
}

.documentation-page-skeleton span:nth-child(1) {
  width: 38%;
  height: 1.15rem;
}

.documentation-page-skeleton span:nth-child(2) {
  width: 92%;
}

.documentation-page-skeleton span:nth-child(3) {
  width: 76%;
}

.documentation-page-skeleton span:nth-child(4) {
  width: 88%;
}

.documentation-page-skeleton span:nth-child(5) {
  width: 64%;
  flex: 1;
  min-height: 8rem;
}

.documentation-page-loading-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 14.5rem;
  padding: 1.15rem 1.35rem 1.2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow:
    0 10px 28px rgba(30, 184, 168, 0.12),
    0 0 0 1px rgba(30, 184, 168, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  animation: thinking-card-breathe 2.4s ease-in-out infinite;
}

.documentation-page-loading-orb {
  position: relative;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.15rem;
}

.documentation-page-loading-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(30, 184, 168, 0.24) 0%, transparent 68%);
  animation: thinking-halo-pulse 2.4s ease-in-out infinite;
}

.documentation-page-loading-sweep {
  position: absolute;
  inset: 0.2rem;
  border-radius: 50%;
  border: 2px solid rgba(30, 184, 168, 0.18);
  background: conic-gradient(
    from 0deg,
    transparent 0deg 250deg,
    rgba(61, 214, 200, 0.95) 300deg,
    rgba(30, 184, 168, 0.15) 330deg,
    transparent 360deg
  );
  mask: radial-gradient(circle, transparent 58%, #000 59%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%);
  animation: thinking-sweep-spin 1.35s linear infinite;
}

.documentation-page-loading-orbit {
  position: absolute;
  inset: 0;
  animation: thinking-orbit-spin 3.6s linear infinite;
}

.documentation-page-loading-orbit i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.34rem;
  height: 0.34rem;
  margin: -0.17rem;
  border-radius: 50%;
  background: #3dd6c8;
  box-shadow: 0 0 10px rgba(61, 214, 200, 0.75);
}

.documentation-page-loading-orbit i:first-child {
  transform: rotate(0deg) translateX(1.15rem);
}

.documentation-page-loading-orbit i:last-child {
  transform: rotate(180deg) translateX(1.15rem);
}

.documentation-page-loading-title {
  margin: 0.2rem 0 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text, #1e293b);
  animation: documentation-title-pulse 1.6s ease-in-out infinite;
}

.documentation-page-loading-step {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--muted, #667085);
}

.documentation-page-loading-bar {
  width: 10rem;
  height: 4px;
  margin-top: 0.25rem;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(30, 184, 168, 0.12);
}

.documentation-page-loading-bar > span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1eb8a8, #3dd6c8);
  animation: documentation-bar-slide 1.25s ease-in-out infinite;
}

.documentation-page-stage.is-loading .documentation-page-image,
.documentation-html-sizer.is-loading .documentation-html-zoom {
  opacity: 0;
  pointer-events: none;
}

@keyframes documentation-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@keyframes documentation-title-pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@keyframes documentation-bar-slide {
  0% {
    transform: translateX(-40%);
  }
  100% {
    transform: translateX(280%);
  }
}

body.theme-dark .documentation-page-stage.is-loading,
body.theme-dark .documentation-html-sizer.is-loading {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

body.theme-dark .documentation-page-skeleton span {
  background: linear-gradient(90deg, #374151 0%, #4b5563 46%, #374151 100%);
  background-size: 220% 100%;
}

body.theme-dark .documentation-page-loading-card {
  background: rgba(17, 24, 39, 0.9);
  box-shadow:
    0 10px 28px rgba(30, 184, 168, 0.12),
    0 0 0 1px rgba(30, 184, 168, 0.16);
}

.documentation-html-sizer {
  position: relative;
  width: calc(100% * var(--doc-zoom, 1));
  margin: 0 auto;
  overflow: hidden;
}

.documentation-html-zoom {
  width: calc(100% / var(--doc-zoom, 1));
  transform: scale(var(--doc-zoom, 1));
  transform-origin: top left;
}

.documentation-html-frame {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
  min-height: 70vh;
}

.documentation-page-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: calc(0.95rem * var(--doc-zoom, 1));
  line-height: 1.55;
  margin: 0;
}

.documentation-page-text-wrap {
  margin-top: 1rem;
}

.documentation-page-text-wrap summary {
  cursor: pointer;
  color: var(--muted, #667085);
  margin-bottom: 0.5rem;
}

.documentation-page-text mark {
  background: #fde68a;
}

.documentation-empty {
  padding: 0.75rem;
  color: var(--muted, #667085);
}

@media (max-width: 900px) {
  .app-sidebar:has(.sidebar-section--docs) {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    max-height: none;
  }

  .sidebar-section--docs {
    display: flex !important;
    max-height: 42vh;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
}
