:root {
  --ink: #17212f;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --wash: #eef4f8;
  --blue: #1c6dd0;
  --green: #15a47b;
  --shadow: 0 24px 60px rgba(23, 33, 47, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background:
    linear-gradient(135deg, rgba(28, 109, 208, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(21, 164, 123, 0.14), transparent 30%),
    var(--wash);
}

.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: 46px;
  line-height: 1.08;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

button {
  font: inherit;
  cursor: pointer;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  color: #ffffff;
  background: var(--blue);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

.dashboard {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  margin-top: 24px;
}

.center-chat {
  margin-top: 24px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(23, 33, 47, 0.08);
  overflow: hidden;
}

.center-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 30px 18px;
  border-bottom: 1px solid var(--line);
}

.center-chat-head h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.upload-card,
.status-card {
  padding: 28px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 38px rgba(23, 33, 47, 0.08);
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 230px;
  margin-bottom: 18px;
  border: 2px dashed #adc1d6;
  border-radius: 8px;
  background: #f8fbfd;
  text-align: center;
}

.upload-zone strong {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
}

.upload-zone span,
.metrics span {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.metrics div {
  padding: 18px;
  border-radius: 6px;
  background: #f3f7fb;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 18, 28, 0.58);
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog {
  position: relative;
  width: min(560px, 100%);
  padding: 34px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.chat-dialog {
  width: min(720px, 100%);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 30px 18px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.chat-header .close-button {
  position: static;
  flex: 0 0 auto;
}

.chat-messages {
  display: grid;
  gap: 14px;
  max-height: 420px;
  min-height: 280px;
  padding: 24px 30px;
  overflow: auto;
  background: #f7fafc;
}

.message {
  width: min(84%, 520px);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.message strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.message p {
  margin-bottom: 0;
}

.message.user {
  justify-self: end;
  color: #ffffff;
  border-color: transparent;
  background: var(--blue);
}

.message.user p {
  color: rgba(255, 255, 255, 0.9);
}

.message.assistant {
  justify-self: start;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px 30px 26px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.chat-form input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
}

.chat-form input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(28, 109, 208, 0.14);
}

.center-chat-messages {
  max-height: 360px;
  min-height: 300px;
}

.center-chat-form {
  padding-bottom: 30px;
}

.dialog h2 {
  margin-bottom: 12px;
  font-size: 32px;
  line-height: 1.15;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 26px;
  line-height: 1;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding: 24px 0;
  }

  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .hero-actions button {
    width: 100%;
  }

  .hero {
    padding: 28px;
  }

  h1 {
    font-size: 34px;
  }

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

  .dialog-actions {
    flex-direction: column;
  }

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

  .chat-form {
    grid-template-columns: 1fr;
  }

  .message {
    width: 100%;
  }
}
