:root {
  color-scheme: light;
  --bg: #eef4f8;
  --surface: #ffffff;
  --surface-soft: #f7fbfe;
  --text: #172334;
  --muted: #607286;
  --line: #d8e5ef;
  --blue: #237bd2;
  --blue-strong: #155ea8;
  --green: #0f8c79;
  --amber: #c98019;
  --red: #c44949;
  --shadow: 0 18px 48px rgba(31, 52, 74, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 44%, #e8f1f7 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, pre { margin: 0; }

.agent-shell {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.hero, .panel-card, .status-card, .result-card, .preview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.hero {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 { margin-top: 5px; font-size: 30px; line-height: 1.15; }
.hero-copy { margin-top: 8px; color: var(--muted); line-height: 1.55; }

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions a, .primary-button, .result-card button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 780;
}

.hero-actions a {
  padding: 0 13px;
  border: 1px solid #cfe0ee;
  color: var(--blue-strong);
  background: var(--surface-soft);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 14px;
}

.control-panel, .workbench {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2 { font-size: 18px; }
.panel-title span, .field span, .switch-line, .caution p { color: var(--muted); font-size: 13px; line-height: 1.5; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.check-grid label, .switch-line {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #dce8f0;
  border-radius: 9px;
  background: var(--surface-soft);
  font-weight: 720;
}

.field {
  display: grid;
  gap: 7px;
}

.field input, .field select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid #cfe0eb;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}

.caution {
  border-color: #f1d4a9;
  background: #fffaf2;
}

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

.primary-button:hover { background: var(--blue-strong); }
.primary-button:disabled { opacity: 0.55; cursor: not-allowed; }

.status-card {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-card h2 { margin-top: 5px; font-size: 22px; }
.status-card p:last-child { margin-top: 6px; color: var(--muted); }

.status-pill {
  min-width: 94px;
  padding: 9px 12px;
  border-radius: 999px;
  text-align: center;
  color: #fff;
  background: #718096;
  font-size: 13px;
  font-weight: 850;
}

.status-pill[data-status="queued"] { background: var(--amber); }
.status-pill[data-status="running"] { background: var(--blue); }
.status-pill[data-status="succeeded"] { background: var(--green); }
.status-pill[data-status="failed"] { background: var(--red); }

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
  gap: 14px;
}

.result-card, .preview-card {
  min-width: 0;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.result-card header, .preview-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-card h3, .preview-card h3 { font-size: 17px; }
.result-card header span, .preview-card header span { color: var(--muted); font-size: 13px; }

.result-card button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #cfe0ee;
  color: var(--blue-strong);
  background: var(--surface-soft);
}

.log-box, .preview-text {
  overflow: auto;
  border: 1px solid #dce8f0;
  border-radius: 10px;
  background: #101925;
  color: #d8e8f8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.log-box {
  height: 420px;
  padding: 12px;
}

.file-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.empty {
  color: var(--muted);
  line-height: 1.6;
}

.file-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dce8f0;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 740;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.preview-card audio {
  width: 100%;
}

.preview-text {
  min-height: 260px;
  max-height: 420px;
  padding: 13px;
  background: #f8fbfe;
  color: #24384d;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: #172334;
  color: #fff;
  box-shadow: var(--shadow);
}

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

@media (max-width: 760px) {
  .agent-shell { padding: 12px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .check-grid { grid-template-columns: 1fr; }
}
