:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #f5f6f8;
  color: #171923;
  --brand-pink: #f40058;
  --brand-pink-dark: #bc0043;
  --brand-dark: #151820;
  --brand-ink: #243246;
  --brand-soft: #fff1f6;
  --brand-line: #ffd2e2;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #e6ebf2;
  --muted: #65758b;
  --shadow: 0 18px 46px rgba(21, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

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

button {
  background: var(--brand-pink);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 16px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  color: var(--brand-dark);
  outline: none;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 3px rgba(244, 0, 88, 0.12);
}

.secondary-button,
.tiny-button {
  background: #f0f2f6;
  color: var(--brand-dark);
}

.danger-button {
  background: #ffe6ee;
  color: #a1003b;
}

.link-button {
  background: transparent;
  color: var(--brand-pink-dark);
  min-height: 0;
  padding: 12px 0 0;
}

.login-view {
  align-items: center;
  background:
    radial-gradient(circle at 10% 10%, rgba(244, 0, 88, 0.08), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f6f8fb 48%, #fff4f8 100%);
  display: flex;
  min-height: 100vh;
  padding: 22px;
}

.login-panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 460px;
  padding: 32px;
  width: 100%;
}

.logo-lockup {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.logo-lockup img,
.topbar-brand img {
  display: block;
  object-fit: contain;
}

.login-logo {
  margin-bottom: 16px;
  width: 232px;
}

.login-logo img {
  height: 72px;
  width: 100%;
}

.welcome-logo {
  width: 214px;
}

.welcome-logo img {
  height: 64px;
  width: 100%;
}

.eyebrow {
  color: var(--brand-pink-dark);
  font-size: 13px;
  font-weight: 900;
  margin: 0 0 8px;
}

h1,
h2 {
  color: var(--brand-ink);
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 24px;
}

.subtle,
.status {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0 0;
}

.login-form,
.reset-form,
.compact-form {
  display: grid;
  gap: 11px;
  margin-top: 20px;
}

.login-form label {
  color: #344154;
  font-size: 14px;
  font-weight: 800;
}

.reset-form {
  margin-top: 10px;
}

.app-shell {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(245, 247, 251, 0.92)),
    #f5f6f8;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  align-items: center;
  display: flex;
  gap: 16px;
  min-width: 0;
}

.topbar-brand img {
  height: 48px;
  width: 158px;
}

.logout-button {
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  min-height: 0;
  padding: 20px;
}

.user-chat-only .workspace {
  grid-template-columns: minmax(0, 1fr);
}

.chat {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 116px);
  min-width: 0;
  overflow: hidden;
}

.health {
  background: #fff8fb;
  border-bottom: 1px solid #ffd4e3;
  color: var(--brand-pink-dark);
  font-size: 14px;
  font-weight: 900;
  padding: 13px 22px;
  text-align: center;
}

.health.warn {
  background: #fff8fb;
  border-bottom-color: #ffd4e3;
  color: var(--brand-pink-dark);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding: 28px;
}

.message {
  border-radius: 8px;
  line-height: 1.75;
  max-width: min(1060px, 86%);
  padding: 18px 20px;
  white-space: pre-wrap;
}

.message strong {
  display: block;
  font-weight: 900;
  margin-bottom: 6px;
}

.message p {
  margin: 0;
}

.message .answer-title {
  color: var(--brand-pink-dark);
  display: inline-block;
  margin-top: 4px;
}

.message.user {
  align-self: flex-end;
  background: #eef4ff;
  border: 1px solid #d8e6ff;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(21, 24, 32, 0.05);
}

.welcome-card {
  align-self: flex-start;
  background: linear-gradient(180deg, #ffffff 0%, #fff8fb 100%);
  border: 1px solid #f2d5df;
  border-radius: 8px;
  box-shadow: var(--shadow);
  line-height: 1.75;
  max-width: min(1060px, 100%);
  padding: 28px;
}

.welcome-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.welcome-header span {
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  color: var(--brand-pink-dark);
  font-size: 13px;
  font-weight: 900;
  padding: 5px 10px;
  white-space: nowrap;
}

.welcome-card h2 {
  color: #101828;
  font-size: 28px;
  margin: 0 0 10px;
}

.welcome-card p {
  color: #475569;
  font-size: 15px;
  margin: 0;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.quick-prompts button {
  background: #ffffff;
  border: 1px solid var(--brand-line);
  color: var(--brand-pink-dark);
  font-size: 13px;
  min-height: 36px;
  padding: 8px 12px;
}

.composer {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 104px;
  padding: 18px 22px;
}

.composer textarea {
  line-height: 1.7;
  min-height: 118px;
  resize: vertical;
}

.composer button {
  align-self: stretch;
}

.management-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(21, 24, 32, 0.06);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 116px);
  min-width: 0;
  overflow: hidden;
}

.admin-tabs {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px;
}

.admin-tabs button {
  background: #f3f5f8;
  color: #344154;
  flex: 0 0 auto;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 12px;
}

.admin-tabs button.active {
  background: var(--brand-pink);
  color: #ffffff;
}

.tab-panel {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.tab-panel.active {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(21, 24, 32, 0.04);
  display: grid;
  gap: 12px;
  padding: 16px;
}

.section-title {
  color: var(--brand-ink);
  font-size: 15px;
  font-weight: 900;
}

.document-list,
.user-list,
.request-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.document-item,
.user-item,
.request-item,
.activity-item {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.document-item {
  display: grid;
  gap: 10px;
}

.document-main {
  min-width: 0;
}

.document-item strong,
.user-item strong,
.request-item strong,
.activity-item strong {
  color: var(--brand-dark);
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.document-item span,
.user-item span,
.request-item span,
.activity-meta,
.source-line {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.55;
  margin-top: 4px;
}

.document-category {
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  color: var(--brand-pink-dark) !important;
  display: inline-block !important;
  font-weight: 800;
  padding: 2px 8px;
}

.muted-document {
  background: #fff8fb;
  border-color: var(--brand-line);
}

.document-actions,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-item {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.tiny-button {
  font-size: 12px;
  min-height: 32px;
  padding: 6px 10px;
}

.pager {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
}

.request-item p,
.activity-item p {
  color: #39475c;
  font-size: 13px;
  line-height: 1.55;
  margin: 8px 0 0;
}

.insight-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.insight-summary div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.insight-summary strong {
  color: var(--brand-pink-dark);
  display: block;
  font-size: 24px;
}

.insight-summary span {
  color: var(--muted);
  font-size: 12px;
}

.activity-top {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.activity-top span {
  background: #f1f4f8;
  border-radius: 999px;
  color: #344154;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .chat,
  .management-panel {
    min-height: auto;
    max-height: none;
  }

  .management-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  .login-view {
    align-items: stretch;
    padding: 14px;
  }

  .login-panel {
    align-self: center;
    padding: 22px;
  }

  .topbar {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .topbar-brand {
    gap: 10px;
  }

  .topbar-brand img {
    height: 38px;
    width: 124px;
  }

  h1 {
    font-size: 20px;
  }

  .subtle {
    font-size: 12px;
  }

  .logout-button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .workspace {
    gap: 12px;
    padding: 12px;
  }

  .messages {
    padding: 14px;
  }

  .message {
    max-width: 100%;
    padding: 15px;
  }

  .welcome-card {
    padding: 18px;
  }

  .welcome-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .welcome-card h2 {
    font-size: 22px;
  }

  .quick-prompts {
    display: grid;
    grid-template-columns: 1fr;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 12px 14px 14px;
  }

  .composer textarea {
    min-height: 112px;
  }

  .admin-tabs {
    padding: 10px;
  }

  .tab-panel {
    padding: 14px;
  }
}
