:root {
  color-scheme: light;
  --bg: #f4f8fc;
  --panel: #ffffff;
  --panel-2: #eef6ff;
  --text: #0f2238;
  --muted: #607188;
  --subtle: #8aa0b8;
  --line: #d7e3f0;
  --line-strong: #bed0e4;
  --blue: #1f8fc9;
  --blue-dark: #146da0;
  --blue-soft: #e8f4ff;
  --green: #18a767;
  --red: #d94841;
  --warn: #e58c38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 26px 104px;
}

.top-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.project-switch {
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 700;
  padding: 0;
}

.project-switch span {
  color: var(--subtle);
  font-size: 20px;
  vertical-align: -1px;
}

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

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 800;
}

.text-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 11px;
  background: var(--panel);
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(229, 140, 56, 0.14);
}

.status-dot.ready {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 167, 103, 0.14);
}

.project-shell {
  width: 100%;
  max-width: 1120px;
  margin: 26px auto 0;
}

.project-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.project-title h1 {
  font-size: 25px;
  line-height: 1.15;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.tab {
  min-width: 92px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.tab.active {
  color: #fff;
  background: var(--blue-dark);
}

.view {
  display: none;
  margin-top: 22px;
}

.view.active {
  display: block;
}

.chat-summary {
  display: none;
}

.progress-card {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(33, 91, 135, 0.06);
}

.progress-card.hidden {
  display: none;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf6;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--blue);
  transition: width 220ms ease;
}

#message {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.downloads {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.document-list {
  display: grid;
  background: transparent;
}

.document-item {
  min-height: 74px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.document-item:last-child {
  border-bottom: 0;
}

.document-item.muted {
  min-height: 64px;
}

.document-file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 800;
}

.document-file-icon.pdf {
  background: #ffeceb;
  color: var(--red);
}

.document-file-icon.sheet {
  background: #e6f8ef;
  color: var(--green);
}

.document-file-icon.word {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.document-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.document-item strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.document-item small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-progress {
  display: grid;
  grid-template-columns: minmax(90px, 220px) 38px;
  align-items: center;
  gap: 8px;
}

.document-progress span {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4edf6;
}

.document-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 220ms ease;
}

.document-progress em {
  color: var(--subtle);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.document-item.muted strong {
  color: var(--blue-dark);
}

.cancel-job-button,
.clear-button {
  border: 0;
  background: transparent;
  color: var(--subtle);
  font-weight: 800;
}

.cancel-job-button {
  min-width: 44px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
}

.sources-view {
  max-width: none;
}

.source-list {
  display: grid;
  background: transparent;
}

.source-row {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  border-right: 0;
  background: transparent;
  text-align: left;
}

.source-row:last-child {
  border-bottom: 0;
}

.source-upload-form {
  display: block;
}

.source-upload-form input[type="file"] {
  display: none;
}

.source-add-row {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.source-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.source-add-icon {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 22px;
}

.source-icon.pdf {
  background: #ffeceb;
  color: var(--red);
}

.source-icon.sheet {
  background: #e6f8ef;
  background: var(--green);
  color: #fff;
}

.source-icon.word {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.source-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.source-main strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.source-main small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.clear-button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
}

.composer {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 18px;
  width: min(1120px, calc(100vw - 52px));
  min-height: 74px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(33, 91, 135, 0.14);
  transform: translateX(-50%);
  z-index: 20;
}

.plus-button,
.send-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  line-height: 1;
}

.plus-button {
  border-radius: 7px;
  background: transparent;
  color: var(--blue-dark);
  font-size: 22px;
}

.send-button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.composer-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.composer-text span {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.composer-text small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.hidden,
.hidden-form,
.hidden-action {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px 14px 96px;
  }

  .top-actions {
    gap: 7px;
  }

  .project-shell {
    margin-top: 20px;
  }

  .project-title h1 {
    font-size: 22px;
  }

  .project-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .tabs {
    margin-top: 18px;
  }

  .tab {
    min-width: 82px;
    min-height: 34px;
    font-size: 14px;
  }

  .view {
    margin-top: 18px;
  }

  .document-item {
    min-height: 68px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 0;
  }

  .document-file-icon,
  .source-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 14px;
  }

  .document-item strong,
  .source-row h3 {
    font-size: 14px;
  }

  .sources-head {
    display: grid;
  }

  .source-row {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    gap: 10px;
    padding: 10px 0;
  }

  .composer {
    bottom: 12px;
    width: calc(100vw - 28px);
    min-height: 68px;
    grid-template-columns: 30px minmax(0, 1fr) 36px;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .plus-button,
  .send-button {
    width: 30px;
    height: 30px;
    font-size: 21px;
  }

  .send-button {
    width: 36px;
    height: 36px;
  }

  .composer-text span {
    font-size: 14px;
  }
}
