:root {
  color-scheme: light;
  --paper: #f3f0ea;
  --linen: #faf8f3;
  --ink: #17202a;
  --subtle: #607080;
  --line: #d5d0c6;
  --line-dark: #a9a194;
  --bank: #164c63;
  --bank-2: #0d6b70;
  --risk: #a23e35;
  --amber: #a46a18;
  --green: #237052;
  --blue: #315f9e;
  --white: #ffffff;
  --shadow: 0 18px 46px rgba(28, 35, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 76, 99, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 76, 99, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.workbench {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(500px, 50%) minmax(460px, 50%);
}

.case-console,
.chat-desk {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.case-console {
  border-right: 1px solid var(--line-dark);
  background: rgba(250, 248, 243, 0.88);
}

.case-header,
.chat-topbar {
  min-height: 82px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
}

.kicker {
  margin: 0 0 5px;
  color: var(--bank-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: 27px;
}

h2 {
  font-size: 17px;
}

p {
  margin: 0;
}

.console-scroll {
  min-height: 0;
  padding: 18px 20px 22px;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}

.surface {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.surface-title {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  margin-bottom: 12px;
}

.surface-title p {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.5;
}

.section-code {
  width: 44px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-left: 4px solid var(--risk);
  background: #efe9dc;
  color: var(--bank);
  font-size: 12px;
  font-weight: 900;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid.two {
  grid-template-columns: 1fr 1fr;
}

.field-grid.three {
  grid-template-columns: minmax(0, 1.25fr) minmax(86px, 0.7fr) minmax(112px, 0.8fr);
}

.field-grid.key-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffdf8;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--bank-2);
  box-shadow: 0 0 0 3px rgba(13, 107, 112, 0.13);
}

.action {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 9px 13px;
  font-weight: 850;
  white-space: nowrap;
}

.action.primary,
.action.send {
  color: #fff;
  background: var(--risk);
}

.action.secondary {
  color: #fff;
  background: var(--bank);
}

.action.ghost {
  color: var(--bank);
  background: transparent;
  border-color: var(--line-dark);
}

.action:disabled,
.task-card:disabled {
  opacity: 0.55;
  cursor: wait;
}

.run-state {
  min-width: 158px;
  display: grid;
  gap: 2px;
  justify-items: end;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.status-label {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 6px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
}

.run-state small {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-dark);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.bad {
  background: var(--risk);
}

.status-dot.pending {
  background: var(--amber);
}

.drop-zone {
  position: relative;
  min-height: 96px;
  margin-top: 10px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--line-dark);
  border-radius: 6px;
  background: repeating-linear-gradient(135deg, #fffdf8, #fffdf8 12px, #f6f1e7 12px, #f6f1e7 24px);
  color: var(--subtle);
  text-align: center;
}

.drop-zone span {
  color: var(--bank);
  font-size: 15px;
  font-weight: 900;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 12px;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--risk);
  background: #fff4ef;
}

.requirement-line {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-requirement {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8f4eb;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.file-requirement.ok {
  color: var(--green);
  border-color: rgba(35, 112, 82, 0.32);
  background: #eef7f1;
}

.file-requirement.missing {
  color: var(--risk);
  border-color: rgba(162, 62, 53, 0.28);
  background: #fff0ed;
}

.file-requirement.optional {
  color: var(--amber);
  border-color: rgba(164, 106, 24, 0.32);
  background: #fff8e8;
}

.file-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  max-height: 120px;
  overflow: auto;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 8px;
  background: #fffdf8;
  font-size: 12px;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.file-size,
.file-empty {
  color: var(--subtle);
  font-size: 12px;
}

.icon-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8f4eb;
  color: var(--risk);
  font-weight: 900;
}

.upload-line {
  margin-top: 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  color: var(--subtle);
  font-size: 12px;
}

.upload-line span {
  color: var(--ink);
  font-weight: 900;
}

.upload-line small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-line .action {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.upload-line.ok span {
  color: var(--green);
}

.upload-line.warn span {
  color: var(--amber);
}

.upload-line.bad span {
  color: var(--risk);
}

.task-lane {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.task-card {
  min-width: 0;
  min-height: 86px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
}

.task-card:hover {
  border-color: var(--risk);
  background: #fff8f3;
}

.task-card span {
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(162, 62, 53, 0.35);
  background: #fff0ed;
  color: var(--risk);
  font-weight: 950;
}

.task-card strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.task-card small {
  color: var(--subtle);
  line-height: 1.35;
}

.task-card.all {
  grid-column: 1 / -1;
  border-color: rgba(49, 95, 158, 0.32);
  background: #f4f7fc;
}

.task-card.all span {
  color: var(--blue);
  border-color: rgba(49, 95, 158, 0.34);
  background: #eaf0fb;
}

.evidence-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

figure {
  margin: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--white);
}

figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

figcaption {
  padding: 8px 10px;
  color: var(--subtle);
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.chat-desk {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.26)),
    #eef1ef;
}

.chat-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.help-panel {
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
  background: rgba(255, 253, 248, 0.94);
}

.help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.help-head h3,
.help-grid h4 {
  margin: 0;
}

.help-head h3 {
  font-size: 16px;
}

.help-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.help-grid section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  background: #ffffff;
}

.help-grid h4 {
  margin-bottom: 7px;
  color: var(--bank);
  font-size: 13px;
}

.help-grid p,
.help-grid li {
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.55;
}

.help-grid p,
.help-grid ol {
  margin: 0;
}

.help-grid ol {
  padding-left: 18px;
}

.dialogue {
  min-height: 0;
  overflow: auto;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.dialogue-row {
  max-width: 92%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
}

.dialogue-row.user {
  margin-left: auto;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.speaker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bank);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}

.dialogue-row.user .speaker {
  grid-column: 2;
  background: var(--risk);
}

.speech {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(36, 43, 48, 0.06);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  font-size: 14px;
}

.dialogue-row.user .speech {
  grid-column: 1;
  grid-row: 1;
  background: #fff6f3;
  border-color: rgba(162, 62, 53, 0.28);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.composer textarea {
  min-height: 56px;
  max-height: 170px;
  resize: vertical;
}

.composer .send {
  align-self: end;
  min-width: 82px;
}

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

  .case-console {
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .chat-desk {
    min-height: 720px;
  }
}

@media (max-width: 680px) {
  .case-header,
  .chat-topbar,
  .composer,
  .dialogue,
  .console-scroll {
    padding-left: 12px;
    padding-right: 12px;
  }

  .case-header,
  .chat-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-grid.two,
  .field-grid.three,
  .field-grid.key-row,
  .task-lane,
  .evidence-preview,
  .help-grid,
  .upload-line,
  .composer {
    grid-template-columns: 1fr;
  }

  .upload-line .action {
    grid-column: auto;
    grid-row: auto;
  }

  .task-card.all {
    grid-column: auto;
  }

  .dialogue-row {
    max-width: 100%;
  }
}
