* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  color: #172033;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #eef2f6;
}

[hidden] {
  display: none !important;
}

body[data-auth="guest"],
body[data-auth="checking"] {
  min-height: 100%;
  height: auto;
  overflow: auto;
  background: #f5f7fb;
}

.landing-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(22, 32, 51, 0.04), rgba(22, 32, 51, 0)),
    #f5f7fb;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-brand .beta-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.landing-logo {
  color: #162033;
  font-size: 25px;
  font-weight: 950;
}

.landing-actions,
.hero-actions,
.hero-points {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.landing-login,
.landing-primary,
.hero-primary,
.hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.landing-login,
.hero-secondary {
  border: 1px solid #d7e0eb;
  background: #fff;
  color: #243044;
}

.landing-primary,
.hero-primary {
  border: 0;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.18);
}

.landing-login:hover,
.landing-primary:hover,
.hero-primary:hover,
.hero-secondary:hover {
  filter: brightness(0.98);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(520px, 1.12fr);
  align-items: center;
  gap: 42px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 58px 24px 64px;
}

.hero-copy {
  min-width: 0;
}

.hero-kicker {
  margin-bottom: 14px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 950;
}

.hero-copy h1 {
  margin: 0;
  color: #101827;
  font-size: 52px;
  font-weight: 950;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 20px 0 0;
  color: #526177;
  font-size: 17px;
  line-height: 1.8;
}

.hero-actions {
  margin-top: 28px;
}

.hero-primary,
.hero-secondary {
  height: 48px;
  padding: 0 20px;
}

.hero-points {
  margin-top: 24px;
}

.hero-points span {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border: 1px solid #dce6f2;
  border-radius: 999px;
  background: #fff;
  color: #526177;
  font-size: 12px;
  font-weight: 900;
}

.product-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dbe5f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.14);
}

.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: #162033;
  color: #fff;
}

.preview-brand {
  font-size: 20px;
  font-weight: 950;
}

.preview-sub {
  margin-top: 4px;
  color: #9fb0c8;
  font-size: 12px;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 900;
}

.preview-grid {
  display: grid;
  grid-template-columns: 190px 230px minmax(0, 1fr);
  min-height: 430px;
}

.preview-panel {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid #e1e8f1;
  background: #fff;
}

.preview-panel:last-child {
  border-right: 0;
  background: #f7f9fc;
}

.preview-label {
  margin-bottom: 14px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 950;
}

.preview-topic {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid #dfe7f1;
  border-radius: 10px;
}

.preview-topic.active {
  border-color: #8db9ff;
  background: #f3f8ff;
  box-shadow: inset 3px 0 0 #2563eb;
}

.preview-topic strong,
.preview-file {
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-topic span {
  color: #7a899d;
  font-size: 11px;
}

.preview-file {
  min-height: 36px;
  margin-bottom: 9px;
  padding: 9px 10px;
  border: 1px solid #e3e9f2;
  border-radius: 9px;
  background: #fff;
}

.preview-file.folder {
  background: #f8fbff;
  color: #40516a;
}

.preview-file.nested {
  margin-left: 18px;
  color: #526177;
}

.preview-message {
  max-width: 88%;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid #dfe7f1;
  border-radius: 11px;
  background: #fff;
  color: #243044;
  font-size: 13px;
  line-height: 1.6;
}

.preview-message.user {
  margin-left: auto;
  border-color: #bfd7ff;
  background: #eaf3ff;
}

.preview-message.ai {
  border-color: #cfe2fb;
}

.preview-compose {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  margin-top: 20px;
}

.preview-compose span,
.preview-compose em {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d7e0eb;
  border-radius: 10px;
  background: #fff;
  color: #607088;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.preview-compose span {
  border-color: #4b8df8;
  background: #eaf3ff;
  color: #1d5fd1;
}

.landing-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 70px;
}

.section-head {
  margin-bottom: 18px;
}

.section-head span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 950;
}

.section-head h2 {
  margin: 8px 0 0;
  color: #101827;
  font-size: 30px;
  line-height: 1.2;
}

.workflow-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.workflow-cards article {
  min-height: 190px;
  padding: 20px;
  border: 1px solid #dfe7f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
}

.workflow-cards b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eaf3ff;
  color: #1d5fd1;
  font-size: 15px;
}

.workflow-cards h3 {
  margin: 18px 0 8px;
  color: #172033;
  font-size: 18px;
}

.workflow-cards p {
  margin: 0;
  color: #607088;
  font-size: 14px;
  line-height: 1.7;
}

button,
textarea,
input {
  font-family: inherit;
}

.mobile-tabs {
  display: none;
}

.topbar {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  height: 72px;
  padding: 0 26px;
  background: #162033;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-name {
  font-size: 24px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 30px;
}

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

.org-label {
  flex: 0 0 auto;
  color: #93a4bc;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.org-switcher select {
  width: min(300px, 38vw);
  height: 42px;
  min-width: 180px;
  padding: 0 13px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  outline: none;
  background: #243149;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.org-settings {
  display: grid;
  gap: 14px;
}

.org-settings-head {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #fbfdff;
}

.org-settings-name {
  font-size: 18px;
  font-weight: 950;
}

.org-settings-meta {
  color: #6b7a90;
  font-size: 12px;
}

.org-settings-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #fff;
}

.org-settings-label {
  color: #44546a;
  font-size: 12px;
  font-weight: 900;
}

.org-settings-value {
  color: #172033;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

.org-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #1d5fd1;
  font-size: 12px;
  font-weight: 900;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 420px minmax(0, 1fr);
  min-width: 980px;
  height: calc(100vh - 72px);
  background: #f7f9fc;
}

.topics-pane,
.files-pane,
.chat-pane {
  min-height: 0;
  overflow: hidden;
}

.topics-pane {
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #172033;
  border-right: 1px solid #dfe7f1;
}

.files-pane {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #dde5ef;
}

.chat-pane {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #f6f8fb;
}

.pane-head,
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topics-pane .pane-head {
  min-height: 112px;
  margin-bottom: 0;
  padding: 18px;
  border-bottom: 1px solid #e3e9f2;
  background: #fff;
}

.pane-copy {
  min-width: 0;
}

.pane-step {
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.files-pane .pane-head {
  min-height: 112px;
  padding: 18px;
  border-bottom: 1px solid #e3e9f2;
}

.files-head {
  align-items: flex-start;
}

.files-head .pane-copy {
  flex: 1;
}

.chat-head {
  min-height: 112px;
  padding: 18px 22px;
  background: #fff;
  border-bottom: 1px solid #e0e7f0;
}

.pane-title,
.chat-title {
  overflow: hidden;
  font-size: 19px;
  font-weight: 900;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topics-pane .pane-title {
  font-size: 20px;
  line-height: 26px;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.topbar .beta-badge {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  border: 1px solid transparent;
}

.invite-landing {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 0;
}

.invite-landing-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid #d9e4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.invite-landing-kicker {
  color: #2563eb;
  font-size: 12px;
  font-weight: 950;
}

.invite-landing-card h1 {
  margin: 0;
  color: #101827;
  font-size: 28px;
  line-height: 1.2;
}

.invite-landing-card p {
  margin: 0;
  color: #526177;
  line-height: 1.7;
}

.invite-landing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invite-landing-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #dce6f2;
  border-radius: 999px;
  background: #f8fbff;
  color: #44546a;
  font-size: 12px;
  font-weight: 800;
}

.invite-landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pane-sub,
.chat-sub {
  margin-top: 3px;
  overflow: hidden;
  color: #738196;
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topics-pane .pane-sub {
  color: #68788f;
}

.topic-list {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.file-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.upload-progress {
  padding: 10px 14px 12px;
  border-bottom: 1px solid #e3e9f2;
  background: #fbfdff;
}

.upload-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #526177;
  font-size: 12px;
  font-weight: 900;
}

.upload-progress-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-row strong {
  color: #1d5fd1;
  font-size: 12px;
}

.upload-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6f2;
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width 0.16s ease, background 0.16s ease;
}

.upload-progress.error .upload-progress-bar {
  background: #dc2626;
}

.upload-progress.error .upload-progress-row strong {
  color: #dc2626;
}

.file-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.topic-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 92px;
  margin: 0 0 10px;
  padding: 14px;
  border: 1px solid #dfe7f1;
  border-radius: 10px;
  background: #fff;
  color: #172033;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.03);
  user-select: none;
}

.topic-item::before {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.topic-item:hover {
  border-color: #bed2ee;
  background: #fbfdff;
}

.topic-item.active {
  border-color: #8db9ff;
  background: #f3f8ff;
  box-shadow: inset 3px 0 0 #2563eb;
}

.topic-item.active::before {
  background: transparent;
}

.topic-item.dragging {
  opacity: 0.55;
}

.topic-item.drag-over {
  border-color: #4b8df8;
  box-shadow: inset 0 0 0 1px #4b8df8;
}

.topic-item.drag-over::before {
  background: #4b8df8;
}

.topic-item.drag-over.after::before {
  top: auto;
  bottom: -6px;
  left: 10px;
  right: 10px;
  width: auto;
  height: 3px;
}

.topic-main,
.file-main {
  min-width: 0;
}

.topic-name,
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-name {
  display: block;
  font-size: 15px;
  font-weight: 950;
  line-height: 20px;
}

.topic-meta {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #7a899d;
  font-size: 12px;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-owner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 850;
}

.topic-owner.me {
  background: rgba(16, 185, 129, 0.28);
  color: #bbf7d0;
}

.topic-owner.system {
  background: rgba(100, 116, 139, 0.35);
  color: #e2e8f0;
}

.file-tree {
  min-width: 0;
}

.tree-node {
  min-width: 0;
}

.folder-item,
.file-item {
  display: grid;
  grid-template-columns: 18px 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 0 10px;
  border: 1px solid #e3e9f2;
  border-radius: 9px;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.folder-toggle {
  color: #607088;
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

.folder-item {
  background: #f8fbff;
  font-weight: 800;
}

.folder-item:hover,
.file-item:hover {
  border-color: #cfe2fb;
  background: #f3f8ff;
}

.folder-item > .layui-icon,
.file-item > .layui-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
}

.folder-item > .layui-icon {
  background: #64748b;
}

.file-item > .layui-icon {
  background: #2563eb;
}

.file-name {
  font-size: 13px;
  font-weight: 900;
  line-height: 18px;
}

.file-meta {
  margin-top: 2px;
  overflow: hidden;
  color: #8391a5;
  font-size: 11px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid #d9e3ef;
  background: #fff;
  color: #243044;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.ghost-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid #d9e3ef;
  border-radius: 9px;
  background: #fff;
  color: #243044;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.topbar .ghost-btn {
  border-color: rgba(148, 163, 184, 0.28);
  background: #fff;
  color: #162033;
}

.action-btn:hover,
.ghost-btn:hover {
  filter: brightness(0.98);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  cursor: pointer;
}

.primary-icon {
  border: 0;
  background: #2563eb;
  color: #fff;
}

.ghost-icon {
  border: 1px solid #d9e3ef;
  background: #fff;
  color: #607088;
}

.primary-icon:hover,
.ghost-icon:hover {
  filter: brightness(0.98);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.file-download {
  width: 32px;
  height: 26px;
  padding: 0;
  border: 1px solid #d8e3ef;
  border-radius: 7px;
  background: #fff;
  color: #526985;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.member-stack {
  display: flex;
  align-items: center;
}

.member-avatar,
.profile-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.member-avatar {
  width: 30px;
  height: 30px;
  margin-left: -7px;
  border: 2px solid #fff;
  background: #2563eb;
}

.member-avatar:first-child {
  margin-left: 0;
}

.member-avatar.ai {
  background: #7c3aed;
}

.profile-avatar {
  width: 38px;
  height: 38px;
  border: 2px solid #dbeafe;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.16);
  cursor: pointer;
}

.profile-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 14px;
}

.invite-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: #f7f9fc;
}

.message {
  display: flex;
  margin-bottom: 16px;
}

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

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(700px, 78%);
  padding: 12px 14px;
  border: 1px solid #dde6f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.message.user .bubble {
  border-color: #bfd7ff;
  background: #eaf3ff;
}

.message.assistant .bubble {
  border-color: #cfe2fb;
  overflow: hidden;
}

.message.assistant .bubble .msg-meta {
  margin: -12px -14px 12px;
  padding: 11px 13px;
  border-bottom: 1px solid #e2edf9;
  background: #f3f8ff;
  color: #1d5fd1;
  font-weight: 900;
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
  color: #738196;
  font-size: 11px;
  line-height: 18px;
}

.msg-content {
  color: #243044;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.msg-content p {
  margin: 0 0 8px;
}

.msg-content p:last-child,
.msg-content ul:last-child,
.msg-content ol:last-child,
.msg-content pre:last-child {
  margin-bottom: 0;
}

.msg-content ul,
.msg-content ol {
  margin: 0 0 8px 22px;
  padding: 0;
}

.msg-content code {
  padding: 2px 4px;
  border-radius: 4px;
  background: #eef2f7;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.msg-content pre {
  overflow: auto;
  margin: 0 0 8px;
  padding: 10px;
  border-radius: 6px;
  background: #111827;
  color: #e5e7eb;
}

.msg-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.msg-content table {
  width: 100%;
  margin: 0 0 8px;
  border-collapse: collapse;
  font-size: 13px;
}

.msg-content th,
.msg-content td {
  padding: 6px 8px;
  border: 1px solid #dce2ea;
  text-align: left;
}

.composer {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 88px;
  align-items: stretch;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e0e7f0;
  background: #fff;
}

.ai-toggle {
  min-height: 54px;
  border: 1px solid #d7e0eb;
  border-radius: 10px;
  background: #fff;
  color: #607088;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.ai-toggle:hover,
.ai-toggle.active {
  border-color: #4b8df8;
  background: #eaf3ff;
  color: #1d5fd1;
}

.composer textarea {
  width: 100%;
  min-height: 54px;
  max-height: 160px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #d7e0eb;
  border-radius: 10px;
  outline: none;
  color: #243044;
  font-size: 13px;
  line-height: 1.5;
}

.composer textarea:focus {
  border-color: #4b8df8;
  box-shadow: 0 0 0 3px rgba(75, 141, 248, 0.12);
}

.composer .layui-btn {
  height: auto;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.empty {
  padding: 18px 8px;
  color: #7f8ca1;
  font-size: 13px;
  text-align: center;
}

.empty-state,
.upload-empty,
.chat-empty {
  display: grid;
  gap: 8px;
  place-items: start;
  padding: 18px;
  border: 1px dashed #d5deea;
  border-radius: 12px;
  background: #fbfdff;
}

.dark-empty {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.empty-title {
  color: #172033;
  font-size: 16px;
  font-weight: 950;
}

.dark-empty .empty-title {
  color: #f8fafc;
}

.empty-text {
  color: #6b7a90;
  font-size: 13px;
  line-height: 1.6;
}

.dark-empty .empty-text {
  color: #a4b3ca;
}

.upload-empty {
  place-items: center;
  text-align: center;
}

.upload-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #eaf3ff;
  color: #1d5fd1;
  font-size: 22px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.topics-pane .empty {
  color: #90a2bc;
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-name {
  font-size: 15px;
  font-weight: 900;
}

.profile-help {
  margin-top: 3px;
  color: #6b7a90;
  font-size: 12px;
}

.role-form {
  padding: 18px 20px 6px;
}

.role-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 130px;
  overflow: auto;
  padding: 2px 0;
}

.role-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d4dce7;
  border-radius: 6px;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.role-choice:hover,
.role-choice.active,
.role-choice:disabled {
  border-color: #4b8df8;
  background: #edf4ff;
  color: #1f66d1;
}

.role-choice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-empty {
  color: #7f8ca1;
  font-size: 13px;
  line-height: 32px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.38);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal-card {
  position: relative;
  width: min(var(--modal-width, 420px), calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.16s ease;
}

.modal-overlay.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-title {
  padding: 18px 20px 0;
  color: #172033;
  font-size: 17px;
  font-weight: 950;
  line-height: 24px;
}

.modal-content {
  padding: 18px 20px 4px;
}

.modal-title + .modal-content {
  padding-top: 14px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #172033;
}

.modal-message {
  color: #44546a;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.modal-field {
  display: block;
}

.modal-field span {
  display: block;
  margin-bottom: 7px;
  color: #44546a;
  font-size: 12px;
  font-weight: 900;
}

.modal-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  outline: none;
  color: #172033;
  font-size: 14px;
}

.modal-field input:focus {
  border-color: #4b8df8;
  box-shadow: 0 0 0 3px rgba(75, 141, 248, 0.12);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
}

.modal-action {
  min-width: 82px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  background: #fff;
  color: #243044;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.modal-action.primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.modal-action.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.modal-action:hover {
  filter: brightness(0.98);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.auth-modal .modal-card {
  overflow: hidden;
  padding: 0;
}

.auth-modal .modal-content {
  padding: 0;
}

.auth-modal .modal-close,
.auth-modal .modal-actions {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: #172033;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-panel {
  background: #fff;
}

.auth-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 22px;
  background: #172033;
  color: #fff;
}

.auth-logo {
  font-size: 24px;
  font-weight: 950;
  line-height: 30px;
}

.auth-sub {
  margin-top: 5px;
  color: #a4b3ca;
  font-size: 12px;
}

.auth-beta {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.auth-card {
  padding: 22px 24px 24px;
}

.auth-field {
  display: block;
  margin-bottom: 14px;
}

.auth-field span {
  display: block;
  margin-bottom: 7px;
  color: #44546a;
  font-size: 12px;
  font-weight: 900;
}

.auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  outline: none;
  color: #172033;
  font-size: 14px;
}

.auth-field input:focus {
  border-color: #4b8df8;
  box-shadow: 0 0 0 3px rgba(75, 141, 248, 0.12);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.auth-submit,
.auth-secondary {
  height: 42px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.auth-submit {
  border: 0;
  background: #2563eb;
  color: #fff;
}

.auth-secondary {
  border: 1px solid #d7e0eb;
  background: #fff;
  color: #243044;
}

.auth-help {
  margin-top: 12px;
  color: #6b7a90;
  font-size: 12px;
  line-height: 1.6;
}

.invite-copy {
  padding: 18px;
}

.invite-copy-title {
  margin-bottom: 10px;
  color: #44546a;
  font-size: 13px;
  font-weight: 900;
}

.invite-copy textarea {
  width: 100%;
  height: 84px;
  resize: none;
  padding: 10px;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  color: #172033;
  font-size: 13px;
  line-height: 1.5;
}

.preview-body {
  max-height: 70vh;
  overflow: auto;
  padding: 16px;
  color: #172033;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 240px 330px minmax(420px, 1fr);
    min-width: 900px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body[data-auth="guest"],
  body[data-auth="checking"] {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .landing-nav {
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }

  .landing-brand {
    min-width: 0;
    flex-wrap: wrap;
  }

  .landing-logo {
    font-size: 22px;
    line-height: 28px;
  }

  .landing-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 8px;
  }

  .landing-login,
  .landing-primary {
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13px;
  }

  .invite-landing {
    padding: 8px 16px 0;
  }

  .invite-landing-card {
    padding: 16px;
  }

  .invite-landing-card h1 {
    font-size: 24px;
  }

  .invite-landing-actions .landing-primary,
  .invite-landing-actions .landing-login {
    flex: 1 1 140px;
  }

  .landing-hero {
    display: block;
    width: 100%;
    max-width: none;
    padding: 22px 16px 42px;
  }

  .hero-kicker {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.6;
  }

  .hero-copy h1 {
    font-size: 34px;
    line-height: 1.16;
  }

  .hero-copy p {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.75;
  }

  .hero-actions {
    margin-top: 22px;
    align-items: stretch;
  }

  .hero-primary,
  .hero-secondary {
    flex: 1 1 150px;
    height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 13px;
  }

  .hero-points {
    margin-top: 18px;
    gap: 8px;
  }

  .hero-points span {
    height: 28px;
    padding: 0 10px;
  }

  .product-preview {
    width: 100%;
    margin-top: 28px;
    border-radius: 14px;
    box-shadow: 0 16px 44px rgba(15, 23, 42, 0.12);
  }

  .preview-top {
    padding: 14px;
  }

  .preview-brand {
    font-size: 17px;
  }

  .preview-grid {
    display: block;
    min-height: 0;
  }

  .preview-panel {
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid #e1e8f1;
  }

  .preview-panel:last-child {
    border-bottom: 0;
  }

  .preview-label {
    margin-bottom: 10px;
  }

  .preview-topic {
    padding: 11px;
  }

  .preview-file.nested {
    margin-left: 12px;
  }

  .preview-message {
    max-width: 96%;
    font-size: 12px;
  }

  .preview-compose {
    grid-template-columns: 48px minmax(0, 1fr);
    margin-top: 14px;
  }

  .preview-compose span,
  .preview-compose em {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .landing-section {
    padding: 0 16px 42px;
  }

  .section-head h2 {
    font-size: 24px;
  }

  .workflow-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .workflow-cards article {
    min-height: 0;
    padding: 16px;
    border-radius: 12px;
  }

  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 48px;
    border-bottom: 1px solid #dce2ea;
    background: #fff;
  }

  .mobile-tab {
    border: 0;
    border-right: 1px solid #e8edf3;
    background: #fff;
    color: #59677c;
    font-size: 14px;
  }

  .mobile-tab:last-child {
    border-right: 0;
  }

  .mobile-tab.active {
    color: #1f66d1;
    font-weight: 800;
    box-shadow: inset 0 -2px 0 #4b8df8;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: 112px;
    padding: 12px;
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand-name {
    font-size: 20px;
  }

  .org-switcher {
    grid-column: 1 / -1;
    order: 3;
  }

  .org-label {
    display: none;
  }

  .org-switcher select {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .top-actions {
    justify-self: end;
  }

  .topbar #inviteBtn {
    display: none;
  }

  .topbar .ghost-btn {
    padding: 0 10px;
    min-width: 0;
  }

  .app-shell {
    display: block;
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px);
    min-width: 0;
  }

  .topics-pane,
  .files-pane,
  .chat-pane {
    display: none;
    height: 100%;
    border-right: 0;
  }

  .topics-pane {
    padding: 0;
  }

  .topics-pane .pane-head {
    margin-bottom: 16px;
  }

  .org-bar {
    margin-bottom: 14px;
    display: none;
  }

  body[data-mobile-pane="topics"] .topics-pane,
  body[data-mobile-pane="files"] .files-pane {
    display: flex;
  }

  body[data-mobile-pane="chat"] .chat-pane {
    display: flex;
  }

  .files-pane .pane-head,
  .chat-head {
    min-height: 62px;
    padding: 10px 12px;
  }

  .files-head {
    align-items: stretch;
    flex-direction: column;
  }

  .file-actions {
    justify-content: flex-start;
  }

  .action-btn {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
  }

  .member-stack {
    display: none;
  }

  .topic-list,
  .file-list {
    padding-bottom: 12px;
  }

  .folder-item,
  .file-item {
    grid-template-columns: 16px 28px minmax(0, 1fr) auto;
    min-height: 54px;
    padding: 10px;
  }

  .messages {
    padding: 12px;
  }

  .bubble {
    max-width: 94%;
  }

  .composer {
    grid-template-columns: 52px minmax(0, 1fr) 72px;
    gap: 8px;
    padding: 10px;
  }

  .ai-toggle,
  .composer textarea,
  .composer .layui-btn {
    min-height: 52px;
  }

  .composer textarea {
    max-height: 110px;
    padding: 8px 10px;
  }

  .composer .layui-btn {
    padding: 0 10px;
  }

  .role-form {
    padding: 14px 12px 2px;
  }

  .role-choice-list {
    max-height: 38vh;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-content {
    padding: 14px 14px 4px;
  }

  .modal-actions {
    padding: 14px;
  }
}
