:root {
  --ink: #12213a;
  --ink-soft: #3f506a;
  --muted: #687991;
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --canvas-strong: #e9eef6;
  --line: #d7e0ec;
  --line-strong: #a9b9cd;
  --blue: #1354d6;
  --blue-dark: #0e3b9d;
  --teal: #08796d;
  --teal-soft: #e6f5f1;
  --orange: #c95222;
  --orange-soft: #fff0e8;
  --red: #b43131;
  --red-soft: #fff0f0;
  --shadow: 0 16px 34px rgba(37, 63, 104, 0.1);
  --radius: 8px;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  /* Let the viewport, including the space lost to a vertical scrollbar,
     determine the page width on narrow phones. */
  min-width: 0;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "MiSans", "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(19, 84, 214, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: var(--header-height);
  gap: 28px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand,
.back-link,
.app-nav,
.form-topline,
.duration-row,
.url-entry,
.form-actions,
.side-heading,
.job-row,
.job-actions,
.service-state,
.policy-line,
.mode-label {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  background: var(--blue);
  border-radius: 7px;
}

.brand-mark img {
  width: 18px;
  filter: brightness(0) invert(1);
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--line-strong);
}

.brand-area {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.app-nav {
  justify-content: center;
  gap: 24px;
}

.app-nav a {
  padding: 8px 1px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
  color: var(--blue);
  border-color: currentColor;
}

.back-link {
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.back-link img,
.mode-label img,
.policy-line img,
.primary-action img,
.quiet-button img,
.job-actions img {
  width: 16px;
  height: 16px;
}

.workspace-shell {
  width: min(1280px, calc(100% - 80px));
  margin: 0 auto;
  padding: 46px 0 58px;
}

.workspace-intro {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: end;
  padding: 0 0 34px;
  border-bottom: 1px solid var(--line);
}

.section-kicker {
  margin: 0 0 9px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
}

h1 {
  max-width: 780px;
  margin-bottom: 13px;
  font-size: 37px;
  line-height: 1.22;
}

.intro-copy {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.75;
}

.service-state {
  flex: 0 0 auto;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-dot,
.job-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--muted);
}

.service-state.is-ready .status-dot,
.job-status.is-completed .job-status-dot {
  background: var(--teal);
}

.service-state.is-waiting .status-dot,
.job-status.is-waiting .job-status-dot {
  background: var(--orange);
}

.service-state.is-error .status-dot,
.job-status.is-error .job-status-dot {
  background: var(--red);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(310px, 0.66fr);
  gap: 24px;
  align-items: start;
  padding-top: 30px;
}

.job-form,
.job-sidebar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.job-form {
  padding: 30px;
}

.form-topline {
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 25px;
}

.form-topline h2,
.side-heading h2 {
  margin: 0 0 7px;
  font-size: 21px;
  line-height: 1.3;
}

.form-topline p {
  max-width: 510px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.mode-label {
  flex: 0 0 auto;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  background: #edf3ff;
  border: 1px solid #cbdafd;
  border-radius: 999px;
}

.mode-label img {
  width: 15px;
  height: 15px;
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.form-section legend {
  padding: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.form-section label,
.field-label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

label em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fbfcff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 98px;
  padding: 11px 12px;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8a9ab0;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8399b8;
}

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(19, 84, 214, 0.13);
  outline: none;
}

.field-grid {
  display: grid;
  gap: 16px;
  padding-top: 16px;
}

.field-grid-product {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(130px, 0.7fr);
}

.duration-row {
  gap: 18px;
  margin-top: 18px;
}

.segment-control {
  display: flex;
  padding: 3px;
  background: var(--canvas-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.segment {
  min-width: 70px;
  min-height: 34px;
  padding: 0 11px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 5px;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-selected {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 8px rgba(19, 84, 214, 0.24);
}

.policy-line {
  flex-wrap: wrap;
  gap: 9px 17px;
  margin-top: 13px;
}

.policy-line span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.policy-line img {
  width: 15px;
  height: 15px;
}

.reference-section {
  padding-bottom: 15px;
}

.help-text {
  margin: 11px 0 13px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.url-entry {
  gap: 8px;
}

.icon-command {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--blue);
  background: #edf3ff;
  border: 1px solid #c7d8fb;
  border-radius: 6px;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.icon-command:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.icon-command img {
  width: 18px;
  height: 18px;
}

.icon-command:hover img {
  filter: brightness(0) invert(1);
}

.reference-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.reference-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 7px 7px 11px;
  color: var(--ink-soft);
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.reference-index {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.reference-url-label {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-remove {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.reference-remove:hover {
  color: var(--red);
  background: var(--red-soft);
}

.reference-remove img {
  width: 16px;
  height: 16px;
}

.empty-references {
  margin: 0;
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.form-feedback {
  min-height: 0;
}

.form-feedback:not(:empty) {
  margin: 0 0 14px;
  padding: 10px 12px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
  background: var(--red-soft);
  border: 1px solid #f3c4c4;
  border-radius: 6px;
}

.form-feedback.is-success {
  color: #08685e;
  background: var(--teal-soft);
  border-color: #b9dfd8;
}

.form-actions {
  gap: 14px;
}

.primary-action,
.quiet-button,
.job-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.primary-action {
  padding: 0 16px;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  box-shadow: 0 8px 16px rgba(19, 84, 214, 0.2);
}

.primary-action:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 11px 19px rgba(19, 84, 214, 0.25);
}

.primary-action:disabled {
  color: #9babbe;
  background: #e6ecf4;
  border-color: #e6ecf4;
  box-shadow: none;
}

.form-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.job-sidebar {
  overflow: hidden;
}

.side-heading {
  justify-content: space-between;
  gap: 12px;
  padding: 25px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.side-heading .section-kicker {
  margin-bottom: 6px;
}

.quiet-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
}

.quiet-button:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: #f7faff;
}

.job-list {
  min-height: 360px;
}

.empty-jobs {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 30px 24px;
}

.empty-jobs img {
  width: 27px;
  height: 27px;
  color: var(--blue);
}

.empty-jobs h3 {
  margin: 4px 0 0;
  font-size: 16px;
}

.empty-jobs p {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.job-item {
  padding: 19px 24px;
  border-bottom: 1px solid var(--line);
}

.job-item:last-child {
  border-bottom: 0;
}

.job-row {
  justify-content: space-between;
  gap: 10px;
}

.job-title-wrap {
  min-width: 0;
}

.job-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.job-title {
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-refresh {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.job-refresh.is-loading img {
  animation: rotate 900ms linear infinite;
}

.job-meta,
.job-message {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.job-message {
  color: var(--ink-soft);
}

.job-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.job-actions .quiet-button,
.job-result {
  min-height: 34px;
  font-size: 12px;
}

.job-result {
  padding: 0 10px;
  color: var(--teal);
  border: 1px solid #a8d8d0;
  background: var(--teal-soft);
}

.delivery-strip {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(0, 1.18fr);
  gap: 40px;
  align-items: start;
  margin-top: 24px;
  padding: 27px 30px;
  color: #eef5ff;
  background: #102548;
  border-radius: var(--radius);
}

.delivery-strip .section-kicker {
  color: #8ed8ca;
}

.delivery-strip h2 {
  margin-bottom: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1.35;
}

.delivery-strip dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
}

.delivery-strip dl div {
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.26);
}

.delivery-strip dt {
  margin-bottom: 8px;
  color: #8ed8ca;
  font-size: 12px;
  font-weight: 800;
}

.delivery-strip dd {
  margin: 0;
  color: #eef5ff;
  font-size: 13px;
  line-height: 1.6;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1080px) {
  .app-header { padding: 0 28px; }
  .workspace-shell { width: min(100% - 56px, 960px); }
  .workspace-grid { grid-template-columns: 1fr; }
  .job-sidebar { min-height: auto; }
  .job-list { min-height: 0; }
  .delivery-strip { grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 720px) {
  :root { --header-height: 62px; }
  .app-header { grid-template-columns: 1fr auto; gap: 10px; padding: 0 18px; }
  .app-nav { display: none; }
  .brand-area, .brand-divider { display: none; }
  .back-link { font-size: 13px; }
  .workspace-shell { width: min(100% - 32px, 620px); padding: 28px 0 42px; }
  .workspace-intro { display: grid; gap: 18px; padding-bottom: 25px; }
  h1 { font-size: 29px; }
  .intro-copy { font-size: 15px; }
  .service-state { justify-self: start; }
  .job-form { padding: 22px 18px; }
  .form-topline { display: grid; gap: 15px; }
  .mode-label { justify-self: start; }
  .field-grid-product { grid-template-columns: 1fr; }
  .duration-row { display: grid; gap: 9px; }
  .segment-control { width: 100%; }
  .segment { flex: 1 1 0; min-width: 0; }
  .form-actions { display: grid; align-items: start; }
  .form-actions .primary-action { width: 100%; }
  .side-heading { padding: 20px 18px 16px; }
  .job-item { padding: 17px 18px; }
  .delivery-strip { padding: 23px 18px; }
  .delivery-strip dl { grid-template-columns: 1fr; gap: 14px; }
  .delivery-strip dl div { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.2); padding: 13px 0 0; }
}
