:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #151815;
  --muted: #727a72;
  --line: #e5e9df;
  --soft: #eef5e8;
  --green: #1f7a4d;
  --green-dark: #125235;
  --orange: #ff7a1a;
  --blue: #2f65ff;
  --shadow: 0 18px 54px rgba(35, 45, 35, 0.1);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-card {
  display: grid;
  width: min(520px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 34px;
  background: linear-gradient(135deg, #ffffff, #eef8ee);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: clamp(32px, 7vw, 54px);
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form input {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(31, 122, 77, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 122, 77, 0.08);
}

.auth-form button {
  height: 52px;
  border-radius: 16px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 900;
}

.auth-form button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-error {
  border-radius: 14px;
  padding: 12px 14px;
  color: #9b2d14 !important;
  background: #fff3ef;
  font-weight: 800;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
}

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

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  font-weight: 900;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small,
.composer-row span,
.result-card p {
  color: var(--muted);
}

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

select,
.ghost-button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

select {
  min-width: 150px;
  padding: 0 12px;
  color: var(--ink);
  outline: none;
}

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin: 8px 0 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, #ffffff, #eef8ee);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-tags span {
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--green-dark);
  background: #dff4e7;
  font-size: 13px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: start;
}

.preset-panel,
.result-panel {
  display: grid;
  gap: 10px;
}

.preset-button,
.result-card,
.chat-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 10px 34px rgba(35, 45, 35, 0.06);
}

.preset-button {
  display: grid;
  gap: 8px;
  padding: 16px;
  color: var(--ink);
  text-align: left;
}

.preset-button:hover {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--soft);
}

.preset-button span,
.result-card span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.preset-button strong,
.result-card strong {
  font-size: 16px;
}

.chat-card {
  overflow: hidden;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 580px;
  overflow-y: auto;
  padding: 18px;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  max-width: 94%;
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.message.user .avatar {
  order: 2;
  background: var(--orange);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 13px;
}

.bubble {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.message.user .bubble {
  background: #e9f7ee;
}

.message.error .bubble {
  border-color: #ffd0c2;
  background: #fff3ef;
}

.bubble > strong {
  display: block;
  margin-bottom: 8px;
}

.message-body {
  display: grid;
  gap: 12px;
}

.message-body p,
.message-body ul {
  margin: 0;
  line-height: 1.75;
}

.message-body ul {
  padding-left: 20px;
}

.message-body h2,
.message-body h3,
.message-body h4 {
  margin: 8px 0 0;
  color: var(--green-dark);
  line-height: 1.25;
}

.message-body h2 {
  font-size: 22px;
}

.message-body h3 {
  font-size: 18px;
}

.message-body h4 {
  font-size: 16px;
}

.message-body a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.message-body code {
  border-radius: 8px;
  padding: 2px 6px;
  background: #eef2ea;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.table-card {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.message-body table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

.message-body th,
.message-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.message-body th {
  color: var(--green-dark);
  background: #edf7ef;
  font-weight: 900;
  white-space: nowrap;
}

.message-body tr:last-child td {
  border-bottom: 0;
}

.message-body tbody tr:nth-child(even) {
  background: #fafcf8;
}

.composer {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  line-height: 1.6;
}

textarea:focus {
  border-color: rgba(31, 122, 77, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 122, 77, 0.08);
}

.composer-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.composer-row button {
  min-width: 118px;
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 900;
}

.composer-row button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.result-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.result-card.primary {
  color: #fff;
  background: var(--green-dark);
}

.result-card.primary span,
.result-card.primary p {
  color: rgba(255, 255, 255, 0.76);
}

.result-card p {
  margin: 0;
  line-height: 1.6;
}

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

  .preset-panel,
  .result-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 680px);
  }

  .topbar,
  .hero-card,
  .composer-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .preset-panel,
  .result-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .messages {
    height: 520px;
  }

  .message,
  .message.user {
    max-width: 100%;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .message.user .avatar {
    order: 0;
  }
}
