:root {
  --bg: #f5f4f0;
  --surface: #fffefa;
  --ink: #1b1c1a;
  --muted: #5f6362;
  --line: rgba(26, 26, 26, 0.11);
  --line-strong: rgba(26, 26, 26, 0.22);
  --surface-soft: #f1f0ec;
  --accent-soft: #e6eeeb;
  --faint: #8b8f8d;
  --soft-shadow: 0 10px 26px rgba(26, 26, 26, 0.06);
  --card-shadow: 0 16px 38px rgba(26, 26, 26, 0.08);
  --radius-card: 8px;
  --mono: Consolas, "Courier New", monospace;
  --serif: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  --accent: #315f5a;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.5 "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button,
a.button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 18px;
  min-height: 38px;
  font-weight: 600;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}
button:hover,
a.button:hover {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary {
  background: #000 !important;
  color: white !important;
  border-color: #000 !important;
}
a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
aside.nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.96);
  box-shadow: 10px 0 34px rgba(26, 26, 26, 0.035);
  z-index: 20;
}
.brand {
  font: italic 30px var(--serif);
  text-decoration: none;
  color: var(--ink);
}
.brand-subtitle { margin-top: 2px; color: var(--muted); font: 11px/1.5 var(--mono); text-transform: uppercase; }
.sidebar-brand { margin-bottom: 34px; padding: 2px 2px 0; }
.nav > .button { margin-bottom: 30px; text-align: center; }
.new-conversion { position: relative; }
.new-conversion[aria-current="page"]::after { content: ""; position: absolute; right: 8px; top: 9px; bottom: 9px; width: 3px; border-radius: 4px; background: #fff; }
.nav nav { display: grid; gap: 4px; }
.nav-item {
  display: block;
  position: relative;
  padding: 10px 18px 10px 10px;
  border-radius: 8px;
  text-decoration: none;
  font: 12px/1.5 var(--mono);
  text-transform: uppercase;
  color: var(--muted);
}
.nav-item:hover { background: var(--surface-soft); }
.nav-item.selected { background: var(--surface-soft); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
.nav-item.selected::after { content: ""; position: absolute; right: 8px; top: 9px; bottom: 9px; width: 3px; border-radius: 4px; background: #000; }
.nav footer { margin-top: auto; display: grid; gap: 12px; }
.work-area { margin-left: 256px; min-width: 0; }
#content { width: min(1160px, calc(100% - 72px)); margin: 0 auto; padding: 44px 0 76px; }
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
h1 {
  font-size: 30px;
  line-height: 1.3;
  font-weight: 600;
  margin: 8px 0 16px;
}
h2 {
  font-size: 21px;
  line-height: 1.4;
}
h3 {
  font-size: 16px;
}
/* Welcome layout and diagram reused from the approved reference. */
.welcome-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.welcome-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 7vw;
  border-bottom: 1px solid rgba(26, 26, 26, 0.08);
}

.welcome-hero {
  width: min(1180px, calc(100vw - 48px));
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  gap: 72px;
  align-items: center;
  padding: 72px 0;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 58px;
  line-height: 1.05;
  font-weight: 400;
}

.hero-title em {
  font-style: italic;
}

.hero-body {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-note {
  max-width: 560px;
  margin: 0;
  padding: 8px 0 8px 20px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-diagram {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #fffefa 0%, #f1f0ec 100%);
  box-shadow: var(--soft-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px;
}

.diagram-stack {
  display: grid;
  gap: 12px;
  min-width: 92px;
}

.mini-doc,
.zip-chip,
.diagram-template {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(26, 26, 26, 0.045);
}

.mini-doc {
  min-height: 92px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px;
}

.mini-doc .line {
  display: block;
  height: 7px;
  width: 76%;
  background: rgba(26, 26, 26, 0.1);
}

.mini-doc .line.wide {
  width: 100%;
}

.mini-doc .line.short {
  width: 56%;
}

.diagram-template {
  width: 136px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  position: relative;
}

.diagram-template::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
}

.diagram-large-icon {
  color: var(--faint);
  font-size: 36px;
}

.diagram-arrow {
  color: var(--faint);
  font-size: 34px;
}

.zip-chip {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--mono);
  color: var(--muted);
}

.muted,
small {
  color: var(--muted);
}
.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--soft-shadow);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 20px;
}
.card h2 {
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
}
.result {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}
label {
  display: block;
  margin: 0 0 20px;
  font-weight: 500;
}
input:not([type="checkbox"]):not([type="radio"]),
select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  margin-top: 7px;
  background: white;
  border: 1px solid #c9ccc7;
  border-radius: 8px;
}
input[type="file"] {
  padding: 12px;
}
p {
  margin: 10px 0 18px;
}
.badge {
  display: inline-block;
  background: #e6eeeb;
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.badge.incomplete,
.badge.interrupted {
  background: #f5e9dd;
  color: #80542b;
}
.badge.running {
  background: #e8edf3;
  color: #375475;
}
.records {
  display: grid;
  gap: 12px;
}
.record {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
}
.record strong {
  display: block;
}
.metadata {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.banner {
  padding: 14px 18px;
  background: #e6eeeb;
  border-radius: 8px;
  margin-bottom: 24px;
}
.error {
  color: #8e302b;
  background: #f7e8e4;
  padding: 14px;
  border-radius: 8px;
  margin: 16px 0;
  overflow-wrap: anywhere;
}
.empty {
  padding: 48px 24px;
  text-align: center;
}
.pdf {
  width: 100%;
  height: 76vh;
  min-height: 450px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #deded9;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    12px/1.6 Consolas,
    monospace;
  max-height: 400px;
  overflow: auto;
}
li {
  margin: 8px 0;
  overflow-wrap: anywhere;
}
details {
  margin-top: 24px;
}
summary {
  cursor: pointer;
}
.danger {
  color: #9b3027 !important;
}
.prose {
  max-width: 850px;
}
.prose section {
  margin: 26px 0;
}
.step {
  font:
    24px Georgia,
    serif;
  color: var(--accent);
}
.report h2 {
  margin-top: 0;
}
.report ul {
  padding-left: 22px;
}
.source {
  background: #f1f0ec;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  max-width: 90vw;
  z-index: 10;
}
.state-line {
  font-size: 22px;
  margin: 24px 0;
}
.elapsed {
  font-variant-numeric: tabular-nums;
}
.loading {
  padding: 40px;
}
.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 25px 0;
}

/* Upload panel reused from the reference setup view. */
.upload-panel {
  min-height: 220px;
  border: 1px dashed rgba(26, 26, 26, 0.24);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #fffefa 0%, #f7f6f2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--soft-shadow);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-panel:hover {
  border-color: rgba(26, 26, 26, 0.4);
  box-shadow: var(--card-shadow);
  transform: translateY(-1px);
}

.upload-panel.has-file {
  border-style: solid;
  border-color: rgba(49, 95, 90, 0.46);
  background: var(--accent-soft);
}

.upload-panel h4 {
  margin: 0;
  font-size: 18px;
}

.upload-panel p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
}

.upload-icon {
  font-size: 34px;
  color: var(--muted);
}


[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.welcome-page { margin: 0; padding: 0; max-width: none; }
.welcome-header { justify-content: space-between; flex-shrink: 0; }
.welcome-header .brand { font-size: 28px; }
.welcome-header #language { font-size: 12px; min-height: 32px; padding: 6px 12px; background: transparent; font-weight: 400; }
.hero-actions .button { background: transparent; }
.diagram-symbol { display: inline-flex; justify-content: center; align-items: center; font: 700 20px/1 var(--mono); }
.diagram-large-icon { font-size: 36px; }
.diagram-arrow { font: 34px/1 var(--mono); }
:lang(zh-CN) .hero-title { line-height: 1.25; }
:lang(zh-CN) .hero-note { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 13px; line-height: 1.7; }
.section-heading { margin-bottom: 30px; }
h1 { font-size: 28px; margin-top: 0; }
h1 .badge { vertical-align: middle; font-weight: 400; }
.card h2 { margin-top: 0; font-size: 20px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card:hover { box-shadow: var(--card-shadow); }
.card h2 a:hover { text-decoration: underline; }
.setup-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 36px; }
.setup-main { min-width: 0; }
.setup-section { margin-bottom: 36px; }
.setup-section > h2, .output-panel > h2 { margin: 0 0 18px; font: 600 12px/1.5 var(--mono); text-transform: uppercase; }
.upload-panel h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.upload-panel .upload-icon { color: var(--accent); font: 34px/1 var(--mono); }
.upload-panel.is-dragging { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.upload-panel[aria-busy="true"] { opacity: .72; }
.filename, #main, #letter { font-family: var(--mono); }
.filename { overflow-wrap: anywhere; }
.output-panel { position: sticky; top: 32px; box-shadow: var(--card-shadow); }
.output-panel > h2 { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.output-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.output-list li { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 40px; border-bottom: 1px solid var(--line); }
.output-list li span { color: var(--accent); font: 11px var(--mono); }
.small-note { font-size: 12px; }
.output-panel .small-note { margin-top: 24px; margin-bottom: 0; }
.submit-note { font-size: 13px; }
.target-choice { display: flex; align-items: flex-start; gap: 14px; border: 1px solid #000; box-shadow: inset 0 0 0 1px #000, var(--soft-shadow); border-radius: 8px; padding: 20px; background: linear-gradient(180deg, #fffefa 0%, #f3f8f5 100%); }
.target-choice input { margin: 5px 0 0; accent-color: #000; }
.target-choice:not(:has(input:checked)) { background: var(--surface); border-color: var(--line); box-shadow: none; }
.optional-letter { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.optional-letter input { accent-color: #000; }
[hidden] { display: none !important; }
.badge.partial { background: #fff1ce; color: #684000; }
.guide-source { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.7; }
.target-choice span span { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.target-info { max-width: 720px; padding: 32px; margin-top: 28px; }
.target-info h2 { margin: 14px 0 18px; font-size: 24px; }
.target-info p { color: var(--muted); margin-bottom: 24px; }
.target-info .eyebrow { font-family: var(--mono); }
.pdf-switch .selected { background: #000; color: #fff; border-color: #000; }
.back-link { font-size: 13px; margin-top: 0; }
.report { font-size: 14px; }
.report li { margin: 0 0 14px; }
.report ul { margin-bottom: 0; }
.report h2 { font-size: 18px; }
button:hover, a.button:hover { background: var(--surface-soft); }
.primary:hover { background: #2f312e !important; box-shadow: 0 8px 18px rgba(26, 26, 26, .18); }
@media (max-width: 1100px) {
  .setup-grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; }
  .result { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .welcome-hero { grid-template-columns: 1fr; gap: 44px; }
  .hero-title { font-size: 46px; }
  aside.nav { width: 210px; padding: 24px 16px; }
  .work-area { margin-left: 210px; }
  #content { width: calc(100% - 40px); padding-top: 30px; }
  .split, .setup-grid { grid-template-columns: 1fr; }
  .output-panel { position: static; }
}
@media (max-width: 640px) {
  .welcome-header { padding: 0 24px; }
  .welcome-hero { width: calc(100vw - 32px); padding: 40px 0; }
  .hero-title { font-size: 38px; }
  .hero-diagram { min-height: 280px; gap: 12px; padding: 18px; }
  .diagram-arrow { display: none; }
  .diagram-stack { min-width: 76px; }
  .mini-doc { padding: 12px; }
  .diagram-template { width: 110px; min-width: 64px; }
  aside.nav { position: static; width: auto; padding: 18px 16px; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 16px; }
  .sidebar-brand { margin: 0; padding: 0; }
  .brand-subtitle { font-size: 9px; }
  .nav > .button { margin: 0; align-self: center; padding: 9px 12px; }
  .nav nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .nav-item { font-size: 12px; }
  .nav footer { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
  .nav footer #language { padding: 6px 12px; font-size: 12px; }
  .work-area { margin-left: 0; }
  #content { width: calc(100% - 32px); padding: 28px 0 48px; }
  .panel, .card { padding: 20px; }
  .upload-panel { padding: 24px 18px; }
  h1 { font-size: 26px; }
  .pdf { height: 65vh; min-height: 350px; }
  .record { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .upload-panel { transition: none; }
  .upload-panel:hover { transform: none; }
}
.connection-settings { margin-top: 24px; max-width: 900px; }
.connection-settings label { display: block; margin-block: 16px; }
.connection-settings input, .connection-settings select, .connection-settings textarea { width: 100%; }
.connection-settings textarea { font: inherit; padding: 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); }
.connection-settings details { margin-block: 20px; }
.connection-settings summary { cursor: pointer; }
.connection-row { padding-block: 18px; border-bottom: 1px solid var(--line); }
.connection-row .metadata { margin-block: 6px 12px; }
#auth-flow:not(:empty) { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
#compiler-status, #default-feedback { margin-top: 16px; overflow-wrap: anywhere; }
.login-content { width: min(480px, calc(100% - 40px)); margin: 64px auto; }
.login-content h1 { margin-bottom: 16px; }
.login-content p { line-height: 1.75; }
#website-login { margin: 32px 0 24px; }
#website-login label { display: block; margin-bottom: 8px; font-weight: 600; }
#website-passphrase { width: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); caret-color: var(--accent); }
#website-passphrase:focus-visible { outline: 2px solid var(--accent); }
#login-error { min-height: 1.75em; margin: 12px 0; }
#login-error:empty { background: transparent; padding: 0; }
.login-content .banner { margin-block: 24px; }
#connection-status { position: sticky; top: 0; z-index: 10; margin: 0; text-align: center; }
@media (max-width: 640px) { .login-content { margin-top: 36px; } }
.login-content #account-username { width:100%; padding:12px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--ink); caret-color:var(--accent); margin-bottom:20px; }
.account-name { color:var(--muted); overflow-wrap:anywhere; }
.materials { margin-block:32px; }
.material-row { padding-block:18px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:20px; }
.material-row p { margin-bottom:0; }
.task-retention { margin-top:32px; padding-top:20px; border-top:1px solid var(--line); }
@media(max-width:640px) { .material-row { align-items:flex-start; flex-direction:column; } .account-name { max-width:40vw; } }

.public-guide { max-width: 960px; margin: 48px auto; padding: 0 24px; }
