:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #182033;
  --muted: #667085;
  --line: #d8dee8;
  --soft: #f8fafc;
  --blue: #276ef1;
  --blue-dark: #1e56c7;
  --blue-soft: #eef4ff;
  --green: #067647;
  --red: #b42318;
  --amber: #b7791f;
  --shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
.auth-screen {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(34, 211, 238, 0.24), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(39, 110, 241, 0.28), transparent 30%),
    linear-gradient(135deg, #06111f 0%, #0b1728 44%, #101827 100%);
}
.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.09) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 82%);
  animation: authGrid 14s linear infinite;
}
.auth-screen::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: linear-gradient(115deg, transparent 34%, rgba(125, 211, 252, 0.11) 46%, transparent 58%);
  transform: translateX(-28%);
  animation: authSweep 6s ease-in-out infinite;
}
.auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.auth-bg span {
  position: absolute;
  width: 36vw;
  height: 36vw;
  border-radius: 999px;
  filter: blur(38px);
  opacity: 0.44;
  animation: authFloat 9s ease-in-out infinite;
}
.auth-bg span:nth-child(1) { left: -8vw; top: 8vh; background: #0ea5e9; }
.auth-bg span:nth-child(2) { right: -10vw; top: 6vh; background: #2563eb; animation-delay: -4s; }
.auth-bg span:nth-child(3) { left: 36vw; bottom: -18vw; background: #14b8a6; animation-delay: -8s; }
.auth-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, 100%);
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(360px, 0.68fr);
  gap: 22px;
  align-items: stretch;
}
.auth-story,
.auth-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(10, 20, 34, 0.72);
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(18px);
}
.auth-story {
  display: grid;
  gap: 12px;
  padding: 24px;
  color: #e5eefb;
}
.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #d9f7ff;
  font-weight: 800;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #062033;
  background: linear-gradient(135deg, #67e8f9, #60a5fa);
  box-shadow: 0 0 28px rgba(103, 232, 249, 0.42);
  animation: authPulse 2.4s ease-in-out infinite;
}
.eyebrow {
  color: #67e8f9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.auth-story h1 {
  max-width: 760px;
  color: #f8fbff;
  font-size: 34px;
  line-height: 1.1;
}
.auth-lede {
  max-width: 760px;
  color: #b7c4d6;
  font-size: 14px;
  line-height: 1.55;
}
.hero-visual {
  position: relative;
  height: clamp(200px, 30vh, 270px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: #07111f;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.86;
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.18), transparent);
  transform: translateX(-100%);
  animation: heroScan 3.6s ease-in-out infinite;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    repeating-linear-gradient(0deg, rgba(125, 211, 252, 0.08) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 18% 70%, rgba(34, 211, 238, 0.18), transparent 26%);
  mix-blend-mode: screen;
  animation: heroFlicker 2.8s ease-in-out infinite;
}
.hero-metrics {
  position: absolute;
  z-index: 2;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 8px;
  background: rgba(2, 8, 23, 0.62);
  color: #dff7ff;
  backdrop-filter: blur(12px);
}
.hero-metrics span,
.capability-grid span,
.pain-strip p,
.auth-footnote,
.auth-panel-head p {
  color: #9fb0c7;
}
.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.capability-grid article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
}
.capability-grid strong {
  color: #f8fbff;
}
.capability-grid span {
  font-size: 12px;
  line-height: 1.42;
}
.pain-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.09);
}
.pain-strip span {
  color: #99f6e4;
  font-size: 13px;
  font-weight: 800;
}
.pain-strip p {
  font-size: 13px;
  line-height: 1.45;
}
.auth-panel {
  align-self: center;
  display: grid;
  gap: 14px;
  padding: 24px;
  color: #e5eefb;
}
.auth-panel::before {
  content: "";
  position: absolute;
  left: -40%;
  top: 0;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #67e8f9, transparent);
  animation: panelLine 3.2s linear infinite;
}
.auth-panel h2 {
  color: #f8fbff;
  font-size: 26px;
}
.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.74);
}
.auth-switch button {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: #9fb0c7;
}
.auth-switch button.active {
  color: #06111f;
  background: linear-gradient(135deg, #67e8f9, #60a5fa);
  box-shadow: 0 10px 26px rgba(96, 165, 250, 0.3);
}
.auth-form {
  display: none;
  gap: 14px;
}
.auth-form.active {
  display: grid;
}
.auth-panel label {
  color: #cbd7e6;
}
.auth-panel input {
  min-height: 48px;
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(2, 8, 23, 0.58);
  color: #f8fbff;
}
.auth-panel input::placeholder {
  color: #6f8097;
}
.auth-remember {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9fb0c7;
  font-size: 13px;
}
.auth-remember input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  accent-color: #22d3ee;
}
.auth-panel .primary {
  min-height: 50px;
  border-color: #22d3ee;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.32);
  animation: primaryBreath 2.8s ease-in-out infinite;
}
.auth-footnote {
  font-size: 13px;
}
@keyframes authGrid {
  from { background-position: 0 0, 0 0; }
  to { background-position: 84px 84px, 84px 84px; }
}
@keyframes authSweep {
  0%, 100% { transform: translateX(-34%) rotate(0.001deg); opacity: 0; }
  38%, 62% { opacity: 1; }
  100% { transform: translateX(34%) rotate(0.001deg); }
}
@keyframes authFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(28px, -22px, 0) scale(1.08); }
}
@keyframes authPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(103, 232, 249, 0.32); }
  50% { box-shadow: 0 0 34px rgba(103, 232, 249, 0.64); }
}
@keyframes heroScan {
  0%, 18% { transform: translateX(-110%); opacity: 0; }
  42%, 62% { opacity: 1; }
  100% { transform: translateX(110%); opacity: 0; }
}
@keyframes heroFlicker {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.65; }
}
@keyframes panelLine {
  from { transform: translateX(0); }
  to { transform: translateX(220%); }
}
@keyframes primaryBreath {
  0%, 100% { box-shadow: 0 12px 28px rgba(37, 99, 235, 0.26); }
  50% { box-shadow: 0 18px 44px rgba(34, 211, 238, 0.36); }
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.topbar-link:hover {
  border-color: #b8c7e6;
  background: #f7faff;
}
.account-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.account-info div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.account-info strong,
.account-info span {
  display: block;
}
.account-info span {
  color: var(--muted);
  font-size: 13px;
}
.membership-info {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.membership-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #abefc6;
  border-radius: 8px;
  background: #f6fef9;
}
.membership-card strong {
  color: var(--green);
}
.membership-card span {
  color: var(--muted);
  font-size: 13px;
}
.payment-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.payment-plan {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.plan-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #244ba8;
  font-size: 12px;
  font-weight: 700;
}
.payment-plan h3 {
  margin: 0 0 4px;
}
.plan-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.plan-price strong {
  font-size: 24px;
  color: var(--text);
}
.plan-allowance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #abefc6;
  border-radius: 999px;
  background: #f6fef9;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.plan-desc {
  color: var(--muted);
  font-size: 13px;
}
.plan-desc {
  min-height: 40px;
  line-height: 1.55;
}

.shell {
  width: min(1440px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 24px 0 40px;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.active-workflow-banner {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffbeb;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}
.active-workflow-banner.hidden { display: none; }
.active-workflow-head,
.active-workflow-item,
.run-card-head,
.run-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.active-workflow-head p,
.active-workflow-item span {
  color: var(--muted);
  font-size: 13px;
}
.active-workflow-list {
  display: grid;
  gap: 8px;
}
.active-workflow-item {
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fff;
}
.run-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #244ba8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}
h1 { margin: 0 0 6px; font-size: 24px; }
h2 { margin: 0; font-size: 21px; }
h3 { margin: 0 0 12px; font-size: 16px; }
p { margin: 0; color: var(--muted); line-height: 1.7; }

.view { display: none; }
.view.active { display: block; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 6px 0 14px;
}
.page-head.compact-head { margin-bottom: 10px; }
.page-head p { max-width: 760px; }
.steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.step {
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
}
.step strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475467;
  font-size: 13px;
}
.step span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.active { border-color: #9fc2ff; background: var(--blue-soft); color: #244ba8; }
.step.active strong { background: var(--blue); color: #fff; }

.flow-page { display: none; min-height: calc(100vh - 160px); }
.flow-page.active { display: block; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}
.compact-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.form-sections {
  display: grid;
  gap: 18px;
}
.form-section {
  display: grid;
  gap: 12px;
}
.form-section h3 {
  margin: 0;
  color: #344054;
  font-size: 15px;
}
.advanced-options {
  margin-top: 16px;
  color: var(--muted);
}
.advanced-options summary {
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: #475467;
}
.advanced-options .check {
  margin-top: 12px;
}
.advanced-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.model-options {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow: auto;
}
.model-vendor {
  display: grid;
  gap: 8px;
}
.model-vendor h4 {
  margin: 0;
  color: #344054;
  font-size: 13px;
}
.model-vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}
.model-option {
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
  padding: 9px 10px;
}
.model-option strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-option span {
  color: var(--muted);
  font-size: 12px;
}
.model-option.active {
  border-color: #b2ccff;
  background: var(--blue-soft);
  color: #244ba8;
}
.split-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(480px, 1.2fr);
  gap: 16px;
}
.generation-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100vh - 220px);
  align-items: stretch;
}
.result-workbench {
  display: grid;
  grid-template-columns: 300px minmax(460px, 1fr) 380px;
  gap: 16px;
  min-height: 520px;
}
.bottom-review {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 380px;
  gap: 18px;
}
.settings-layout {
  display: grid;
  gap: 16px;
}
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}
.settings-modal.active { display: block; }
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}
.settings-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1180px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.24);
  overflow: hidden;
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.settings-header p { margin-top: 4px; }
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  padding: 12px 20px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.settings-tab {
  border-color: transparent;
  background: transparent;
  color: #475467;
  font-weight: 700;
}
.settings-tab.active {
  border-color: #b2ccff;
  background: #eef4ff;
  color: #244ba8;
}
.settings-body {
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 20px;
}
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }
.settings-tab-panel > .actions,
.settings-layout > .actions {
  justify-content: flex-start;
}
.settings-actions {
  position: sticky;
  bottom: -20px;
  z-index: 3;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  margin: 18px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}
.settings-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.fiction-only { display: none; }
body.fiction-mode .article-only { display: none; }
body.fiction-mode .fiction-only { display: grid; }
.category-editor {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}
.category-tabs {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 560px;
  overflow: auto;
}
.category-tab {
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  padding: 11px 12px;
}
.category-tab strong {
  line-height: 1.35;
}
.category-tab span {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.category-tab.active {
  border-color: #b2ccff;
  background: #eef4ff;
  color: #244ba8;
}
.category-tab.active span {
  color: #3b5fb8;
}
.category-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
}
.category-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.category-form-head strong {
  font-size: 16px;
}
.category-form-head button {
  padding: 7px 10px;
  font-size: 13px;
}

label { display: grid; gap: 7px; color: #344054; font-size: 14px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(39, 110, 241, 0.12);
  border-color: #84adff;
}
.category-select-row span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.category-select-row button {
  height: 48px;
  padding-inline: 14px;
  white-space: nowrap;
}
textarea { resize: vertical; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.check input { width: auto; }
.autopilot-box {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 1fr);
  gap: 12px 16px;
  align-items: end;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  padding: 14px;
  background: #f5f8ff;
}
.autopilot-box .check { margin: 0 0 10px; }
.autopilot-box p { grid-column: 1 / -1; }
.autopilot-mode #flowSteps .step[data-step="2"],
.autopilot-mode #flowSteps .step[data-step="3"] {
  opacity: 0.52;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions.slim { margin-top: 0; }
.direction-tools {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.direction-tools > button {
  justify-self: start;
}
.direction-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.direction-options.empty {
  display: block;
}
.direction-option {
  max-width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: #244ba8;
  background: #eef4ff;
  border-color: #c7d7fe;
}
.direction-option.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
button, .button-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.primary:hover { background: var(--blue-dark); }
button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}
button.secondary { background: #eef4ff; border-color: #c7d7fe; color: #244ba8; }
button.danger { color: var(--red); border-color: #f4b8b0; background: #fff7f6; }
button.ghost-danger { background: #fff; }
.button-link { margin-top: 10px; color: #244ba8; background: #eef4ff; border-color: #c7d7fe; }
.button-link.disabled { opacity: 0.5; pointer-events: none; }

.flow-footer, .toolbar, .panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.flow-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 20px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-radius: 0 0 8px 8px;
}
.flow-footer .muted {
  color: #344054;
  font-weight: 600;
}
.flow-footer-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}
.quota-dock {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
}
.quota-dock:empty {
  display: none;
}
.quota-dock div {
  min-width: 104px;
  padding: 7px 10px;
  border: 1px solid #d7e3f7;
  border-radius: 8px;
  background: #f8fbff;
}
.quota-dock strong,
.quota-dock span {
  display: block;
}
.quota-dock strong {
  color: #182033;
  font-size: 15px;
  line-height: 1.2;
}
.quota-dock span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.toolbar { margin-bottom: 10px; }
.toolbar strong { display: block; font-size: 17px; }
.toolbar span { color: var(--muted); font-size: 13px; }
.queue-quota-hint {
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid #b2ccff;
  border-radius: 8px;
  background: #eef4ff;
  color: #244ba8;
  font-weight: 700;
}
.queue-quota-hint.error {
  border-color: #fecdca;
  background: #fff7f6;
  color: var(--red);
}
.queue-quota-hint.success {
  border-color: #abefc6;
  background: #f6fef9;
  color: var(--green);
}
.muted { color: var(--muted); }
.hidden { display: none !important; }
.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
}
.notice.error { color: var(--red); }
.notice.warn {
  color: var(--amber);
  margin-bottom: 8px;
}
.save-status {
  align-self: center;
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
}
.save-status.success { color: var(--green); }
.save-status.error { color: var(--red); }

.compact-list, .topic-list, .job-list {
  display: grid;
  gap: 10px;
  overflow: auto;
}
.compact-list { max-height: 560px; }
.topic-list { max-height: calc(100vh - 300px); }
.job-list { max-height: calc(100vh - 360px); }
.next-action {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.mini-card, .topic-item, .job, .result-job {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.mini-card {
  display: grid;
  gap: 5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.mini-card:hover,
.topic-item:hover,
.job:hover,
.result-job:hover {
  border-color: #b2ccff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
}
.mini-card span { color: var(--muted); }
.topic-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.topic-item div { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.topic-item input { width: auto; margin-top: 6px; }
.topic-item span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef4ff;
  color: #244ba8;
  font-size: 13px;
}
.topic-item strong { font-weight: 600; line-height: 1.55; }
.topic-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}
.row-actions { flex: 0 0 auto; }
.row-actions button { padding: 7px 9px; font-size: 13px; }
.side-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.side-panel-head h3 { margin: 0; }
.side-panel-head button {
  padding: 6px 9px;
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  background: var(--soft);
}
.stats strong {
  display: block;
  font-size: clamp(14px, 2vw, 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats span { color: var(--muted); font-size: 12px; }
.job strong, .result-job strong { display: block; line-height: 1.45; }
.job span, .result-job span { color: var(--muted); font-size: 13px; }
.job.running, .result-job.running { border-color: #b2ccff; background: #f5f8ff; }
.job.completed, .result-job.completed { border-color: #abefc6; background: #f6fef9; }
.job.failed, .result-job.failed { border-color: #fecdca; background: #fff7f6; }
.job.skipped, .result-job.skipped { opacity: 0.65; }
.job.running strong, .result-job.running strong { color: #244ba8; }
.job.completed strong, .result-job.completed strong { color: var(--green); }
.job.failed strong, .result-job.failed strong { color: var(--red); }

.timeline {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  color: #475467;
  min-width: 122px;
  flex: 0 0 122px;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.compact-timeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px;
}
.timeline-item::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
  flex: 0 0 auto;
}
.timeline-item strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-item span { color: var(--muted); font-size: 13px; }
.timeline-item.pending {
  border-color: #d8dee8;
  background: #f8fafc;
  color: #667085;
}
.timeline-item.running {
  border-color: #84adff;
  background: #eef4ff;
  color: #244ba8;
  box-shadow: 0 0 0 2px rgba(39, 110, 241, 0.08);
}
.timeline-item.running::before {
  border-color: var(--blue);
  background: radial-gradient(circle at center, var(--blue) 0 34%, #fff 38%);
}
.timeline-item.completed {
  border-color: #75e0a7;
  background: #f6fef9;
  color: #067647;
}
.timeline-item.completed::before {
  content: "✓";
  display: grid;
  place-items: center;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.timeline-item.failed {
  border-color: #fda29b;
  background: #fff7f6;
  color: #b42318;
}
.timeline-item.failed::before {
  content: "!";
  display: grid;
  place-items: center;
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.timeline-item.skipped {
  border-style: dashed;
  opacity: 0.68;
}

.live-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 260px);
}
pre, .result {
  white-space: pre-wrap;
  background: #0b1220;
  color: #d6e2ff;
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  margin: 0;
}
#liveText {
  height: calc(100vh - 390px);
  min-height: 360px;
  overflow: auto;
  padding: 18px 22px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.9;
  border-radius: 8px;
}
#liveText h2,
#liveText h3,
#liveText h4 {
  margin: 22px 0 10px;
  color: #101828;
  line-height: 1.45;
}
#liveText h2 { font-size: 20px; }
#liveText h3 { font-size: 18px; }
#liveText h4 { font-size: 16px; }
#liveText p {
  margin: 0 0 16px;
  color: #182033;
  line-height: 1.9;
}
#liveText strong { font-weight: 700; }
#liveText code {
  background: #eef2f7;
  border-radius: 4px;
  padding: 1px 5px;
}
#liveText .image-ref,
#liveText .list-line {
  color: #475467;
}
.result.small { min-height: 80px; max-height: 112px; }
.settings-result {
  margin-top: 14px;
  max-height: 120px;
}
.reader-panel, .image-panel { min-width: 0; }
.reader-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
}
.image-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.image-panel h3 { margin-bottom: 8px; }
.log-strip {
  align-self: end;
}
.log-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.log-strip-head button {
  padding: 5px 9px;
  font-size: 13px;
}
.current-event {
  min-height: 48px;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  background: #eef4ff;
  color: #244ba8;
  padding: 10px 11px;
  line-height: 1.55;
  font-size: 13px;
}

.article-image {
  max-width: 680px;
  margin: 24px auto;
}
.article-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #eef2f7;
  cursor: zoom-in;
}
.article-image img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #eef2f7;
}
.article-image figcaption {
  text-align: center;
  background: #fff;
}

.thumb-grid, .image-card-grid {
  display: grid;
  gap: 10px;
  align-content: start;
}
.thumb-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: calc(100vh - 480px);
  overflow: auto;
}
.thumb-grid figure:first-child { grid-column: 1 / -1; }
.image-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.image-thumb-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #eef2f7;
  cursor: zoom-in;
}
.image-kind {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.4;
}
figure img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #eef2f7;
}
figcaption {
  display: grid;
  gap: 4px;
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
}
figcaption code, .artifact-list code {
  word-break: break-all;
  white-space: pre-wrap;
}

body.lightbox-open { overflow: hidden; }
.image-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}
.image-lightbox.active { display: block; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 24, 0.82);
}
.lightbox-stage {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
}
.lightbox-stage img {
  max-width: min(1400px, calc(100vw - 150px));
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
}
.lightbox-close {
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 28px;
}
.lightbox-nav {
  top: 50%;
  width: 46px;
  height: 64px;
  padding: 0;
  transform: translateY(-50%);
  font-size: 38px;
}
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-caption {
  max-width: min(1100px, calc(100vw - 120px));
  margin-top: 12px;
  color: #dbe7ff;
  font-size: 13px;
  word-break: break-all;
  text-align: center;
}

.summary-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 980;
}
.summary-modal.active { display: block; }
.summary-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}
.summary-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.22);
  overflow: hidden;
}
.summary-dialog header,
.summary-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.summary-dialog footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.summary-dialog h2 {
  margin: 0;
  font-size: 18px;
}
.summary-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}
.summary-body div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}
.summary-body strong,
.summary-body span {
  display: block;
}
.summary-body strong {
  font-size: 20px;
  color: var(--text);
}
.summary-body span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.contact-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1100;
}
.contact-modal.active { display: block; }
.contact-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}
.contact-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.24);
  overflow: auto;
}
.contact-dialog header,
.contact-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.contact-dialog footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.contact-dialog h2 {
  margin: 0;
  font-size: 18px;
}
.contact-dialog header p {
  margin-top: 4px;
  font-size: 13px;
}
.contact-body {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 16px;
}
.contact-body img {
  width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.contact-copy {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  background: #f5f8ff;
  text-align: center;
}
.contact-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-list, .result-media { overflow: hidden; }
.result-text, .result-media, .result-list { min-height: 520px; }
.result-job {
  width: 100%;
  text-align: left;
  display: block;
}
.result-job.active { outline: 2px solid #b2ccff; }
.artifact-list { display: grid; gap: 7px; margin-top: 12px; }
.artifact-list code {
  display: block;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  color: #475467;
  background: var(--soft);
}
.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.quality-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}
.quality-item strong, .quality-item span { display: block; }
.quality-item span { color: var(--muted); font-size: 13px; }
.quality-item p { font-size: 13px; }
.quality-item.pass { border-color: #abefc6; background: #f6fef9; }
.quality-item.fail { border-color: #fecdca; background: #fff7f6; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.card.active-run {
  border-color: #fedf89;
  background: #fffcf2;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card code {
  display: block;
  color: #475467;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.usage-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.usage-snapshot div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}
.usage-snapshot strong,
.usage-snapshot span {
  display: block;
}
.usage-snapshot strong {
  color: var(--ink);
  font-size: 17px;
}
.usage-snapshot span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.run-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.run-metrics span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
}

@media (max-width: 1280px) {
  .split-layout, .generation-layout, .result-workbench, .bottom-review, .live-preview { grid-template-columns: 1fr; }
  .result-text, .result-media, .result-list { min-height: auto; }
  .category-editor { grid-template-columns: 1fr; }
  .category-tabs {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    max-height: none;
  }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-panel { align-self: stretch; }
  .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { padding: 16px; }
  .grid, .steps, .stats, .thumb-grid, .image-card-grid { grid-template-columns: 1fr; }
  .settings-dialog {
    inset: 10px;
    width: auto;
    max-height: none;
    transform: none;
  }
  .settings-tabs { grid-template-columns: 1fr; }
  .auth-screen {
    height: auto;
    min-height: 100vh;
    padding: 16px;
    place-items: start center;
    overflow-y: auto;
  }
  .auth-shell { max-height: none; }
  .auth-story,
  .auth-panel {
    padding: 18px;
  }
  .auth-panel {
    order: -1;
  }
  .auth-story h1 {
    font-size: 30px;
  }
  .capability-grid,
  .pain-strip {
    grid-template-columns: 1fr;
  }
  .hero-visual,
  .hero-visual img {
    min-height: 210px;
  }
  .flow-footer-right,
  .quota-dock {
    width: 100%;
    justify-content: stretch;
  }
  .quota-dock {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quota-dock div {
    min-width: 0;
  }
  .topic-item { align-items: stretch; flex-direction: column; }
  .page-head, .toolbar, .flow-footer { align-items: stretch; flex-direction: column; }
}
