:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #66727e;
  --line: #d8dee5;
  --paper: #f4f1ea;
  --panel: #ffffff;
  --accent: #205f4b;
  --accent-dark: #174638;
  --warning: #9b3d2e;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, textarea, input { font: inherit; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 36px max(4vw, 24px) 24px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.04em; }
.topbar p { margin: 0; color: var(--muted); }
.scope { color: var(--muted); font-size: 14px; text-align: right; }
.logout {
  margin-left: 12px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
}
.logout:hover { color: var(--ink); background: #f3f4f2; }

.auth-gate {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
}
.auth-card h2 { margin: 0 0 10px; font-size: 26px; }
.auth-card > p { color: var(--muted); line-height: 1.6; }
.auth-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: #fbfbf9;
}
.auth-card button { width: 100%; margin-top: 14px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }

main {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.7fr);
  gap: 24px;
  padding: 24px max(4vw, 24px) 48px;
}

.submit-panel, .job-list, .detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.submit-panel { padding: 22px; align-self: start; position: sticky; top: 18px; }
.submit-panel h2, .job-list h2 { margin: 0 0 18px; font-size: 18px; }

label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  line-height: 1.55;
  background: #fbfbf9;
}
textarea:focus, input:focus { outline: 2px solid #8ab7a7; outline-offset: 1px; }

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { cursor: wait; opacity: 0.55; }
.text-button { padding: 4px 0; color: var(--accent); background: transparent; }
.text-button:hover { background: transparent; text-decoration: underline; }

form button { width: 100%; margin-top: 12px; }
input[type="file"] {
  width: 100%;
  border: 1px dashed #aab4be;
  border-radius: 9px;
  padding: 14px;
  background: #fbfbf9;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.error { color: var(--warning); margin: 16px 0 0; line-height: 1.5; }

.workspace { display: grid; grid-template-columns: minmax(250px, 0.75fr) minmax(0, 2fr); gap: 24px; }
.job-list { padding: 18px; align-self: start; max-height: calc(100vh - 170px); overflow: auto; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.job-card {
  width: 100%;
  display: block;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 4px;
}
.job-card:hover { background: #f6f8f5; }
.job-card.active { background: #eaf1ed; box-shadow: inset 3px 0 var(--accent); }
.job-title { display: block; font-weight: 650; line-height: 1.4; margin-bottom: 7px; }
.job-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.status { font-weight: 600; }
.status.completed { color: var(--accent); }
.status.failed { color: var(--warning); }

.detail { min-height: 65vh; padding: 26px; }
.empty { color: var(--muted); padding: 14vh 8vw; text-align: center; }
.empty h2 { color: var(--ink); }

.detail-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.detail-head h2 { margin: 0 0 8px; line-height: 1.35; }
.detail-meta { color: var(--muted); font-size: 13px; line-height: 1.7; word-break: break-all; }
.tag { white-space: nowrap; border: 1px solid var(--line); border-radius: 99px; padding: 5px 10px; font-size: 12px; }

.progress { height: 7px; background: #e7ebe9; border-radius: 99px; overflow: hidden; margin: 20px 0 8px; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width 300ms ease; }
.stage { color: var(--muted); font-size: 13px; }

.transcript {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
  font-size: 16px;
  line-height: 1.9;
  max-height: 58vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.transcript:empty { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.actions a, .actions button { display: inline-block; border-radius: 9px; padding: 10px 14px; text-decoration: none; }
.actions a { background: #edf3f0; color: var(--accent-dark); border: 1px solid #cbded6; }
.actions button { background: #f3eee9; color: var(--ink); border: 1px solid var(--line); }
.error-box { color: var(--warning); background: #fbefeb; border: 1px solid #edc7be; border-radius: 9px; padding: 12px; margin-top: 18px; }
.danger { color: var(--warning); background: #fbf0ec; border: 1px solid #e7beb4; }
.danger:hover { background: #f6dfd8; }

.upload-progress { margin-top: 14px; }
.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}
.upload-progress-head strong { color: var(--accent); }
.upload-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7ebe9;
}
.upload-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 160ms linear;
}

@media (max-width: 1050px) {
  main { grid-template-columns: 1fr; }
  .submit-panel { position: static; }
}

@media (max-width: 760px) {
  .topbar { display: block; padding-top: 24px; }
  .scope { text-align: left; margin-top: 12px; }
  main { padding: 16px 14px 36px; gap: 16px; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .job-list { max-height: 38vh; }
  .detail { padding: 20px 16px; min-height: 50vh; }
  .transcript { font-size: 15px; max-height: none; }
}
