:root {
  --bg: #eef7f1;
  --surface: #ffffff;
  --surface-soft: #f1f8f4;
  --ink: #13231d;
  --muted: #5f746b;
  --line: #cfe2d8;
  --accent: #13805e;
  --accent-dark: #07553f;
  --accent-soft: #dff4e8;
  --accent-faint: #f4fbf7;
  --sage: #8fb9a6;
  --warn: #a16207;
  --shadow: 0 18px 48px rgba(14, 83, 62, 0.12);
  --shadow-soft: 0 10px 28px rgba(14, 83, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(19, 128, 94, 0.08) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(315deg, rgba(143, 185, 166, 0.22) 0%, rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(90deg, rgba(19, 128, 94, 0.035) 0, rgba(19, 128, 94, 0.035) 1px, transparent 1px, transparent 36px),
    repeating-linear-gradient(0deg, rgba(19, 128, 94, 0.025) 0, rgba(19, 128, 94, 0.025) 1px, transparent 1px, transparent 36px),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 18px;
  height: 100vh;
  padding: 18px;
  overflow: hidden;
  backdrop-filter: saturate(1.08);
}

.sidebar,
.report-panel,
.workspace {
  min-width: 0;
  min-height: 0;
}

.sidebar,
.report-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 2px;
}

.brand,
.panel,
.workspace {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand,
.panel {
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(223, 244, 232, 0.92), rgba(255, 255, 255, 0.96)),
    var(--surface);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(145deg, #17a673, #07553f);
  box-shadow: 0 10px 22px rgba(7, 85, 63, 0.28);
  font-size: 0;
  font-weight: 800;
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  width: 21px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px 14px 12px 12px;
  transform: rotate(-8deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  transform: translate(6px, -2px) rotate(-28deg);
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p,
.eyebrow,
.panel p,
dd,
li {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-size: 12px;
}

.panel {
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.plain-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.plain-list li {
  padding-left: 4px;
  line-height: 1.45;
}

.case-list {
  display: grid;
  gap: 8px;
}

.case-button,
.secondary-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.case-button {
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--accent-faint);
  text-align: left;
}

.case-button:hover,
.secondary-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.note p,
.rubric li,
dd {
  font-size: 13px;
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
}

.topbar h2 {
  font-size: 22px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(19, 128, 94, 0.18);
}

.status-pill.ready {
  color: #ffffff;
  background: var(--accent);
}

.chat-window {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(252, 255, 253, 0.94), rgba(238, 247, 241, 0.96)),
    linear-gradient(120deg, rgba(19, 128, 94, 0.06), transparent 44%),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(19, 128, 94, 0.045) 32px);
}

.message {
  display: flex;
  gap: 10px;
  max-width: 860px;
  margin-bottom: 16px;
}

.message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.avatar {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #ffffff;
  background:
    linear-gradient(145deg, #0f6b51, #073f32);
  box-shadow: 0 8px 18px rgba(7, 85, 63, 0.18);
  font-size: 0;
  font-weight: 700;
  position: relative;
}

.user .avatar {
  background:
    linear-gradient(145deg, #74b995, #13805e);
}

.assistant .avatar::before {
  content: "";
  width: 17px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 11px 11px 9px 9px;
}

.assistant .avatar::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 7px;
  border-top: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  transform: translate(5px, -1px) rotate(-28deg);
}

.user .avatar::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 11px 0 3px rgba(255, 255, 255, 0.94);
}

.bubble {
  max-width: min(100%, 720px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  line-height: 1.7;
  white-space: pre-wrap;
  box-shadow: 0 8px 18px rgba(14, 83, 62, 0.06);
}

.user .bubble {
  color: #ffffff;
  border-color: var(--accent-dark);
  background:
    linear-gradient(145deg, #15956b, #0c664e);
}

.composer {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 249, 0.96));
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.96);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input {
  min-height: 42px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.secondary-button,
.primary-button,
.icon-button {
  min-width: 86px;
  min-height: 38px;
  padding: 8px 14px;
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
}

.primary-button {
  color: #ffffff;
  border-color: var(--accent-dark);
  background: var(--accent);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.api-row {
  position: relative;
}

.api-row input {
  padding-right: 46px;
}

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

.icon-button {
  min-width: 46px;
  padding: 8px 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.eye-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-flex;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 999px;
  background: transparent;
  transform: translateY(-50%);
}

.eye-button:hover,
.eye-button:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
}

.eye-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dt {
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 0;
}

.rubric ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.error {
  color: #991b1b;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .report-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 780px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 10px;
  }

  .report-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    min-height: 680px;
  }
}
