:root {
  --lenovo-red: #f33b28;
  --plum: #6d1b62;
  --plum-2: #8c5ca3;
  --lavender: #f7f4fb;
  --lavender-2: #eee8f5;
  --ink: #24212a;
  --muted: #79717f;
  --line: #e8e1ee;
  --panel: #ffffff;
  --soft-red: #fff1ef;
  --green: #2f8f65;
  --yellow: #a86f00;
  --shadow: 0 16px 42px rgba(47, 28, 68, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fbfafc;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: 328px 1fr;
  min-height: 100vh;
}

.global-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 40px 28px 22px;
  background: linear-gradient(180deg, #faf7fd 0%, #f6f1fa 100%);
  border-right: 1px solid #f0eaf6;
}

.brand-row,
.user-row,
.reader-topbar,
.summary-head,
.modal-head {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark,
.mini-logo,
.avatar,
.empty-icon {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--lenovo-red);
  font-weight: 800;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
}

.brand-name {
  color: var(--lenovo-red);
  font-size: 31px;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  color: #9c8daf;
  background: transparent;
  border-radius: 8px;
}

.icon-button:hover {
  background: var(--lavender-2);
}

.new-chat {
  width: 168px;
  height: 52px;
  margin: 62px 0 76px;
  color: var(--plum);
  background: #fff;
  border: 1px solid #b45e85;
  border-radius: 28px;
  font-size: 16px;
  font-weight: 700;
}

.history-search {
  display: grid;
  grid-template-columns: 20px 1fr 30px;
  align-items: center;
  gap: 4px;
  height: 34px;
  color: #a298b0;
}

.history-search input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  color: var(--ink);
  background: #ede8f2;
  border: 0;
  border-radius: 18px;
  outline: 0;
}

.history-search button {
  display: grid;
  place-items: center;
  color: #9e91af;
  background: #ede8f2;
  border-radius: 50%;
  height: 30px;
}

.history-list {
  flex: 1;
  margin-top: 24px;
  overflow: auto;
}

.history-group {
  margin: 18px 0 8px;
  color: #a29aa8;
  font-size: 14px;
  font-weight: 700;
}

.history-item {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  padding: 0 12px;
  color: #332d38;
  background: transparent;
  border-radius: 9px;
  text-align: left;
  font-weight: 650;
}

.history-item.active,
.history-item:hover {
  background: #ebe5f0;
}

.sidebar-footer {
  display: grid;
  gap: 18px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  color: #332d38;
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.footer-link svg {
  color: #a28fbd;
  width: 28px;
  height: 28px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lenovo-red), #5b3fbd);
}

.user-row {
  gap: 12px;
  font-weight: 700;
}

.chevron {
  color: #aaa1b3;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  height: 100vh;
  padding: 28px;
  transition: grid-template-columns 0.2s ease;
}

.workspace.library-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.library-panel,
.reader-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid #f0eaf4;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(72, 46, 92, 0.05);
}

.library-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 26px;
  overflow: hidden;
  transition: padding 0.2s ease;
}

.library-panel.collapsed {
  align-items: center;
  padding: 14px 10px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-collapse {
  width: 32px;
  height: 32px;
  margin-left: 0;
  border: 1px solid #eee5f2;
}

.collapsed-rail {
  display: none;
}

.library-panel.collapsed .collapsed-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--plum);
}

.rail-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--plum);
  background: #fbf7fc;
  border: 1px solid #eadfec;
  border-radius: 8px;
}

.collapsed-rail span {
  writing-mode: vertical-rl;
  letter-spacing: 0;
  color: #5f5868;
  font-size: 13px;
  font-weight: 850;
}

.collapsed-rail strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 24px;
  color: var(--plum);
  background: #fbf7fc;
  border: 1px solid #eee5f2;
  border-radius: 999px;
  font-size: 12px;
}

.library-panel.collapsed .panel-heading,
.library-panel.collapsed .assistant-intro,
.library-panel.collapsed .search-box,
.library-panel.collapsed .tab-row,
.library-panel.collapsed .filter-row,
.library-panel.collapsed .library-meta,
.library-panel.collapsed .doc-list {
  display: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--plum-2);
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

.library-panel h1 {
  font-size: 26px;
}

h2 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.24;
}

h3 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.3;
}

.status-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--plum);
  background: #f8f5fa;
  border: 1px solid #eee5f2;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.assistant-intro {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 11px;
  margin: 20px 0 18px;
  padding: 14px 15px;
  background: #fff;
  border: 1px solid #eee7f1;
  border-radius: 8px;
  flex: 0 0 auto;
}

.mini-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
}

.assistant-intro p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.search-box {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  color: #9a90a7;
  background: #fff;
  border: 1px solid #e9e2ed;
  border-radius: 8px;
  flex: 0 0 auto;
  margin-top: 20px;
}

.search-box:focus-within {
  border-color: #d9c6e5;
  background: #fff;
}

.search-box input,
.composer input,
.lead-form input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.tab-row,
.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 0 0 auto;
}

.tab-row {
  margin-top: 14px;
}

.filter-row {
  margin: 8px 0 14px;
}

.chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  color: #655d6f;
  background: #fff;
  border: 1px solid #ece5f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.chip.active {
  color: var(--plum);
  background: #fbf7fc;
  border-color: #b982b7;
  box-shadow: inset 0 0 0 1px rgba(109, 27, 98, 0.08);
}

.library-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
}

.library-meta button {
  color: var(--plum);
  background: transparent;
  font-weight: 800;
}

.doc-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
  flex: 1 1 auto;
  min-height: 0;
}

.doc-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  transition: border-color 0.18s, background-color 0.18s;
}

.doc-card:hover,
.doc-card.active {
  border-color: #d6c4dc;
  background: #fffdfd;
}

.doc-card.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: var(--plum);
  border-radius: 0 3px 3px 0;
}

.doc-card.unavailable {
  opacity: 0.62;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 44px;
  color: var(--plum);
  background: #fbf8fb;
  border: 1px solid #efe7f2;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.doc-name {
  display: -webkit-box;
  overflow: hidden;
  color: #2b2530;
  font-weight: 800;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.doc-desc,
.doc-tags {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  padding: 2px 6px;
  background: #faf8fb;
  border-radius: 6px;
}

.tag.ready {
  color: var(--green);
  background: #f1faf6;
}

.tag.warn {
  color: var(--yellow);
  background: #fffaf0;
}

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

.reader-topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid #f0eaf4;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-button,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.tool-button {
  color: var(--plum);
  background: #f5eef8;
}

.primary-action {
  color: #fff;
  background: var(--plum);
}

.reader-scroll {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 55vh;
  text-align: center;
}

.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin-bottom: 16px;
  font-size: 28px;
}

.empty-state p {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.7;
}

.summary-card,
.insight-grid > section,
.chat-bubble,
.source-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-card {
  padding: 18px;
}

.summary-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card p {
  margin-bottom: 0;
  color: #3e3745;
  line-height: 1.8;
}

.insight-grid {
  display: block;
  margin-top: 14px;
}

.insight-grid > section {
  padding: 16px;
}

.section-title {
  margin-bottom: 12px;
  color: #34283c;
  font-size: 15px;
  font-weight: 900;
}

.accordion-list {
  display: grid;
  gap: 8px;
}

.accordion-item {
  border: 1px solid #efe7f2;
  border-radius: 8px;
  overflow: hidden;
}

.accordion-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: #322738;
  background: #fbf8fc;
  text-align: left;
  font-weight: 850;
}

.accordion-content {
  display: none;
  padding: 12px;
  color: #5f5868;
  background: #fff;
  border-top: 1px solid #efe7f2;
  font-size: 13px;
  line-height: 1.7;
}

.accordion-item.open .accordion-content {
  display: block;
}

.suggestion-button {
  min-height: 38px;
  padding: 9px 11px;
  color: var(--plum);
  background: #f7f2fa;
  border: 1px solid #eadfee;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.suggestion-button:hover {
  background: #efe4f4;
}

.chat-thread {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.chat-row {
  display: flex;
}

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

.chat-bubble {
  max-width: min(680px, 82%);
  padding: 14px 16px;
  line-height: 1.72;
}

.chat-row.user .chat-bubble {
  color: #211725;
  background: #f8f0f8;
  border-color: #f0e2f2;
}

.chat-row.ai .chat-bubble {
  background: #fff;
}

.answer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 900;
}

.answer-title .mini-logo {
  width: 25px;
  height: 25px;
  font-size: 13px;
}

.source-toggle {
  margin-top: 10px;
  color: var(--plum);
  background: transparent;
  font-weight: 900;
}

.source-box {
  display: none;
  margin-top: 10px;
  padding: 12px;
  color: #5f5868;
  background: #fbf8fc;
  font-size: 13px;
}

.source-box.open {
  display: block;
}

.suggestion-strip {
  display: grid;
  gap: 8px;
  padding: 12px 24px 0;
  border-top: 1px solid #f0eaf4;
}

.suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6b6172;
  font-size: 13px;
  font-weight: 850;
}

.suggestion-head button {
  color: var(--plum);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
}

.suggestion-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.suggestion-button {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  gap: 10px;
  margin: 12px 24px 8px;
  padding: 8px 9px 8px 16px;
  min-height: 58px;
  border: 1px solid #e4ddea;
  border-radius: 8px;
  background: #fff;
}

.composer button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--plum);
  border-radius: 50%;
}

.ai-note {
  margin-bottom: 10px;
  color: #c7bfcd;
  text-align: center;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(31, 23, 38, 0.38);
}

.modal-panel {
  width: min(960px, 100%);
  max-height: min(760px, 92vh);
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-head {
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.preview-body {
  height: 620px;
  overflow: auto;
  padding: 22px;
  background: #f7f4f8;
}

.preview-page {
  width: min(720px, 100%);
  min-height: 860px;
  margin: 0 auto 18px;
  padding: 58px 62px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(45, 28, 55, 0.13);
}

.preview-page h4 {
  margin: 0 0 18px;
  font-size: 24px;
}

.preview-page p,
.preview-page li {
  color: #4b4352;
  line-height: 1.85;
}

.lead-panel {
  width: min(440px, 100%);
}

.lead-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.lead-form label {
  display: grid;
  gap: 8px;
  color: #4d4555;
  font-size: 13px;
  font-weight: 850;
}

.lead-form input {
  height: 42px;
  padding: 0 12px;
  background: #f8f5fa;
  border: 1px solid #ede5f1;
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: 360px;
  padding: 13px 16px;
  color: #fff;
  background: #2f2636;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .workspace.library-collapsed {
    grid-template-columns: 64px 1fr;
  }

  .reader-panel {
    min-height: 720px;
  }
}

@media (max-width: 1440px) {
  .reader-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .global-sidebar {
    position: static;
    height: auto;
    padding: 22px;
  }

  .new-chat,
  .history-list {
    display: none;
  }

  .workspace {
    padding: 12px;
  }

  .workspace.library-collapsed {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .library-panel.collapsed {
    min-height: 360px;
  }

  .reader-topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-actions {
    width: 100%;
    overflow-x: auto;
  }

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

  .chat-bubble {
    max-width: 94%;
  }
}
