:root {
  --page: #f4f5f2;
  --page-soft: #fbfbfa;
  --panel: #ffffff;
  --panel-soft: #f7f8f6;
  --ink: #151a18;
  --ink-soft: #2c3230;
  --muted: #5f6863;
  --muted-2: #828a85;
  --line: #dddfda;
  --line-strong: #bfc7c1;
  --accent: #0e6f7b;
  --accent-dark: #074a53;
  --accent-soft: #e8f3f2;
  --aqua-soft: rgba(14, 111, 123, 0.085);
  --mint-soft: rgba(79, 147, 117, 0.08);
  --peach-soft: rgba(196, 90, 63, 0.075);
  --gold-soft: rgba(154, 106, 20, 0.065);
  --sand: #f0ebe1;
  --warm: #c45a3f;
  --green: #2d7a5f;
  --red: #c84d3f;
  --amber: #9a6a14;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 80px rgba(31, 37, 34, 0.08);
  --shadow-soft: 0 10px 34px rgba(31, 37, 34, 0.07);
  --font: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  background:
    radial-gradient(circle at 8% 7%, rgba(14, 111, 123, 0.1), transparent 24rem),
    radial-gradient(circle at 88% 18%, rgba(196, 90, 63, 0.065), transparent 26rem),
    linear-gradient(180deg, #fbfbfa 0, #f1f1ed 380px, #f7f7f5 100%),
    var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(90deg, rgba(21, 26, 24, 0.035) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(180deg, black 0, transparent 520px);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

.eyeline {
  margin-bottom: 10px;
  color: #0b7b88;
  font-size: 12px;
  font-weight: 800;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(14, 111, 123, 0.14), transparent 36%),
    linear-gradient(180deg, #fbfbfa, #eeeee9);
}

.login-panel {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #111614;
  color: white;
  font-size: 15px;
  font-weight: 800;
}

.login-panel h1 {
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.08;
  font-weight: 800;
}

.login-copy {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.login-form,
.composer,
.settings-panel,
.records {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

input::placeholder,
textarea::placeholder {
  color: #a9aea9;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 111, 123, 0.12);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary {
  background: #111614;
  color: #fff;
  box-shadow: 0 14px 28px rgba(17, 22, 20, 0.16);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.danger {
  min-height: 36px;
  border: 1px solid rgba(200, 77, 63, 0.18);
  background: #fff5f2;
  color: var(--red);
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover {
  transform: translateY(-1px);
}

.secondary:hover,
.ghost:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.link-button {
  min-height: 38px;
  text-decoration: none;
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  min-width: 0;
  margin-bottom: 18px;
  padding: 46px 40px 36px 24px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  background:
    radial-gradient(circle at 0% 0%, rgba(14, 111, 123, 0.16), transparent 20rem),
    radial-gradient(circle at 82% 24%, rgba(196, 90, 63, 0.06), transparent 22rem),
    linear-gradient(135deg, rgba(14, 111, 123, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 250, 248, 0.96));
  box-shadow: 0 28px 90px rgba(31, 37, 34, 0.1);
}

.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 58px;
  bottom: 58px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, rgba(14, 111, 123, 0.45), var(--accent), rgba(14, 111, 123, 0.35));
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.topbar h1 {
  max-width: 780px;
  font-size: 58px;
  line-height: 1.02;
  font-weight: 800;
  color: var(--ink);
}

.topbar h1::after {
  content: "文生视频、文生图、模型切换和生成记录统一放在这里。";
  display: block;
  max-width: 620px;
  margin-top: 16px;
  color: #545d58;
  font-size: 18px;
  line-height: 1.65;
  font-weight: 500;
}

.account-menu,
.section-head,
.composer-actions,
.template-head,
.config-head,
.config-row,
.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.user-pill,
.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.user-pill {
  min-height: 40px;
  padding: 0 15px;
  color: var(--ink-soft);
}

.account-menu {
  position: relative;
  justify-content: flex-end;
}

.avatar-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(135deg, #111614, #1f2a27);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(17, 22, 20, 0.13);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.avatar-button:hover,
.avatar-button[aria-expanded="true"] {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(17, 22, 20, 0.18);
}

.account-dropdown {
  position: absolute;
  top: 56px;
  right: 0;
  z-index: 20;
  width: 190px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(31, 37, 34, 0.16);
  backdrop-filter: blur(14px);
}

.account-card {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border-radius: 13px;
  background: var(--panel-soft);
}

.account-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-card strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.menu-action {
  min-height: 38px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 11px;
  font-size: 14px;
  font-weight: 800;
}

.menu-action:hover {
  background: #f0f2ee;
}

.danger-text {
  color: var(--red);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 4px 0 8px;
  border: 1px solid rgba(221, 223, 218, 0.86);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(14, 111, 123, 0.045), rgba(255, 255, 255, 0.72) 40%, rgba(196, 90, 63, 0.035)),
    rgba(255, 255, 255, 0.74);
  box-shadow: 0 16px 48px rgba(31, 37, 34, 0.055);
  overflow: hidden;
}

.summary-strip article {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 84px;
  padding: 18px 18px 16px 24px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(14, 111, 123, 0.05), transparent 46%),
    rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.summary-strip article:last-child {
  border-right: 0;
}

.summary-strip article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.summary-strip article::after {
  position: absolute;
  right: 18px;
  top: 18px;
  color: rgba(21, 26, 24, 0.06);
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
}

.summary-strip article:nth-child(1)::after { content: "01"; }
.summary-strip article:nth-child(2)::after { content: "02"; }
.summary-strip article:nth-child(3)::after { content: "03"; }
.summary-strip article:nth-child(4)::after { content: "04"; }

.summary-strip span {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.summary-strip strong {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(340px, 0.66fr);
  gap: 22px;
  align-items: start;
}

.composer,
.settings-panel,
.records {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.composer {
  background:
    radial-gradient(circle at 0% 0%, var(--aqua-soft), transparent 18rem),
    radial-gradient(circle at 100% 8%, var(--gold-soft), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(252, 252, 250, 0.96)),
    #fff;
}

.records {
  margin-top: 22px;
  background:
    radial-gradient(circle at 0% 0%, rgba(14, 111, 123, 0.07), transparent 20rem),
    radial-gradient(circle at 100% 8%, var(--peach-soft), transparent 18rem),
    rgba(255, 255, 255, 0.98);
}

.section-head {
  align-items: flex-start;
}

.section-head h2 {
  margin-bottom: 7px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
}

.section-head p {
  color: #59625d;
  font-size: 14px;
  line-height: 1.62;
}

.section-head.compact h2 {
  font-size: 20px;
}

.segmented {
  --active-index: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ecefea;
  overflow: hidden;
}

.segmented::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: calc((100% - 10px) / 3);
  height: calc(100% - 10px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31, 37, 34, 0.08);
  transform: translateX(calc(var(--active-index) * 100%));
  transition:
    transform 430ms cubic-bezier(0.58, 0.02, 0.22, 1.08),
    box-shadow 220ms ease;
}

.segmented button {
  position: relative;
  z-index: 1;
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  color: #66706b;
  font-size: 14px;
  font-weight: 800;
  transition: color 220ms ease, transform 280ms cubic-bezier(0.58, 0.02, 0.22, 1.08);
}

.segmented button.active {
  color: var(--ink);
  transform: scale(1.015);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.template-box {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #d7e5e2;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(14, 111, 123, 0.08), transparent 42%),
    #fbfdfc;
}

.template-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 800;
}

.template-head span {
  color: #59625d;
  font-size: 13px;
  line-height: 1.5;
}

.prompt-field {
  color: var(--ink-soft);
}

.prompt-field textarea {
  min-height: 210px;
  border-color: #cfd9d4;
  background:
    linear-gradient(180deg, #fff, #fbfcfb);
  font-size: 15px;
}

.composer-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.settings-panel {
  gap: 20px;
}

.project-panel {
  display: grid;
  gap: 13px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.project-create,
.project-list,
.model-list,
.jobs-list,
.provider-config {
  display: grid;
  gap: 10px;
}

.project-card,
.config-card,
.model-card,
.job-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

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

.project-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 7px;
}

.project-delete {
  min-height: 28px;
  border: 1px solid rgba(200, 77, 63, 0.18);
  border-radius: 999px;
  padding: 0 9px;
  background: #fff7f4;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.project-delete:hover {
  background: #fff1ed;
}

.project-card strong,
.model-card strong,
.job-card strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}

.project-card p,
.model-card p,
.job-card p,
.config-card p {
  color: #59625d;
  font-size: 13px;
  line-height: 1.55;
}

.provider-config {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.config-card {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.config-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.config-row {
  min-height: 30px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

.config-row em {
  border-radius: 999px;
  padding: 5px 9px;
  font-style: normal;
  font-size: 12px;
}

.config-vars,
.model-tags,
.job-meta,
.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.config-vars code {
  border-radius: 9px;
  padding: 5px 8px;
  background: #eef0ec;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.config-vars .missing-var {
  background: #fff1ed;
  color: var(--red);
}

.config-test {
  min-height: 36px;
}

.config-result {
  min-height: 20px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.config-row .ok,
.status-completed {
  background: #e9f5ef;
  color: var(--green);
}

.config-row .missing,
.status-failed,
.status-blocked {
  background: #fff1ed;
  color: var(--red);
}

.status-processing,
.status-queued {
  background: #fff6df;
  color: var(--amber);
}

.model-card {
  position: relative;
  padding: 15px;
  overflow: hidden;
}

.model-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.model-card > * {
  margin-left: 8px;
}

.model-card p {
  margin-top: 5px;
}

.model-tags {
  margin-top: 12px;
}

.records-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 170px 170px;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.job-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.job-card:hover {
  transform: translateY(-1px);
  border-color: #c8d4ce;
  box-shadow: var(--shadow-soft);
}

.job-head {
  align-items: flex-start;
}

.job-head p {
  margin-top: 5px;
}

.job-compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding-top: 4px;
}

.job-compact p {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft) !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-toggle {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.job-detail {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.job-prompt {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfbfa;
  color: var(--ink-soft) !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
}

.job-card:not(.expanded) {
  padding-block: 14px;
}

.job-actions .secondary,
.job-actions .danger {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: #fbfbfa;
  color: #59625d;
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .topbar,
  .summary-strip article,
  .composer,
  .settings-panel,
  .records {
    animation: rise-in 420ms ease both;
  }

  .summary-strip article:nth-child(2) { animation-delay: 40ms; }
  .summary-strip article:nth-child(3) { animation-delay: 80ms; }
  .summary-strip article:nth-child(4) { animation-delay: 120ms; }
}

@keyframes rise-in {
  from {
    transform: translateY(10px);
  }
  to {
    transform: translateY(0);
  }
}

@media (min-width: 1101px) {
  .settings-panel {
    position: sticky;
    top: 22px;
    max-height: calc(100vh - 44px);
    overflow: auto;
    scrollbar-width: thin;
  }
}

@media (max-width: 1180px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 18px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 34px 26px 28px;
  }

  .topbar h1 {
    font-size: 42px;
  }

  .topbar h1::after {
    font-size: 16px;
  }

  .account-menu {
    justify-content: flex-start;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip article:nth-child(2n) {
    border-right: 0;
  }

  .records-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .login-shell {
    padding: 18px;
  }

  .login-panel {
    padding: 26px;
    border-radius: 24px;
  }

  .login-panel h1 {
    font-size: 30px;
  }

  .app-shell {
    padding: 12px;
  }

  .topbar {
    margin-bottom: 14px;
    padding: 28px 18px 22px;
    border-radius: 24px;
  }

  .topbar h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  .topbar h1::after {
    margin-top: 12px;
    font-size: 15px;
  }

  .account-menu {
    width: 100%;
  }

  .account-dropdown {
    left: 0;
    right: auto;
    width: min(220px, 100%);
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip article {
    min-height: 76px;
    padding: 15px 14px 14px 18px;
  }

  .summary-strip span {
    font-size: 16px;
  }

  .summary-strip strong {
    font-size: 21px;
  }

  .composer,
  .settings-panel,
  .records {
    padding: 16px;
    border-radius: 20px;
  }

  .section-head,
  .template-head,
  .job-head,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head h2 {
    font-size: 22px;
  }

  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 18px;
  }

  .segmented button {
    border-radius: 14px;
    min-height: 40px;
    font-size: 13px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .composer-actions .primary,
  .composer-actions .secondary {
    width: 100%;
  }

  .project-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
