:root {
  --bg: #eef1f4;
  --workspace: #f8fafb;
  --surface: #ffffff;
  --surface-subtle: #f3f6f8;
  --surface-strong: #111827;
  --line: #d9e1e7;
  --line-strong: #b7c4cf;
  --ink: #14202b;
  --ink-soft: #344453;
  --muted: #697887;
  --muted-strong: #526170;
  --brand: #118575;
  --brand-deep: #0c6157;
  --blue: #2855a4;
  --blue-soft: #e7edf8;
  --green-soft: #e4f4ef;
  --warning: #b7791f;
  --warning-soft: #fff4d6;
  --danger: #b94a48;
  --danger-soft: #fde7e5;
  --success: #207a52;
  --success-soft: #ddf4e7;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  --sidebar-width: 248px;
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", Arial,
    sans-serif;
}

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

html {
  scroll-behavior: auto;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

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

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

button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 14px;
  cursor: pointer;
  color: var(--ink);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(40, 85, 164, 0.28);
  outline-offset: 2px;
}

.primary {
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(17, 133, 117, 0.22);
}

.primary:hover {
  background: var(--brand-deep);
}

.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
}

.ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

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

.hidden {
  display: none !important;
}

body.image-preview-open {
  overflow: hidden;
}

.boot-shell {
  min-height: 100vh;
  background: var(--workspace);
}

.studio-page {
  background: var(--workspace);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: #101923;
  color: #e8edf2;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark,
.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #2855a4 0%, #118575 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.brand-title {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: #9aa8b6;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #aeb9c5;
  font-weight: 650;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-item.active,
.nav-item[aria-current="page"] {
  background: #ffffff;
  color: #101923;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-note-title {
  color: #ffffff;
  font-size: 13px;
  font-weight: 750;
}

.note-flow,
.auth-proof {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: #dce6ee;
  font-size: 12px;
  font-weight: 700;
}

.note-flow i,
.auth-proof i {
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

.sidebar-note p {
  margin: 0;
  color: #aeb9c5;
  font-size: 12px;
  line-height: 1.55;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.topbar-copy {
  min-width: 0;
}

.topbar-kicker,
.panel-tag {
  margin: 0 0 6px;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 800;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.topbar-subtitle {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.page-section {
  display: none;
  padding-top: 18px;
}

.page-section.active {
  display: block;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
  align-items: start;
}

.panel,
.stat-card,
.task-card,
.package-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 16px;
}

.page-panel {
  max-width: 1240px;
}

.stat-card {
  min-width: 0;
  padding: 16px;
}

.stat-card-accent {
  background: linear-gradient(135deg, #ffffff 0%, var(--green-soft) 100%);
  border-color: #cce6df;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-value,
.stat-number {
  margin-top: 8px;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stat-number {
  color: var(--blue);
}

.stat-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-status-lines {
  display: grid;
  gap: 6px;
}

.account-status-lines span {
  display: block;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-status-lines strong {
  margin-left: 4px;
  color: var(--ink);
  font: inherit;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.compact-head {
  margin-bottom: 10px;
}

.result-card {
  min-height: 330px;
  display: grid;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(17, 133, 117, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(40, 85, 164, 0.05) 25%, transparent 25%),
    #fbfcfd;
  background-size: 24px 24px;
  padding: 14px;
}

.result-card.empty {
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.result-card img {
  width: 100%;
  max-height: 540px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.result-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.workflow-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.workflow-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.workflow-list span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.workflow-list strong {
  display: block;
  margin-bottom: 4px;
}

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

.listing-form-note,
.hint,
.empty,
.quote-box,
.codex-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.listing-form-note {
  margin: 6px 0 0;
}

.codex-image-panel {
  max-width: none;
}

.codex-panel-head {
  align-items: flex-start;
}

.codex-image-grid {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.codex-image-controls,
.codex-image-result {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.codex-image-result {
  margin-top: -76px;
}

.control-block {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.prompt-block textarea {
  min-height: 188px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

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

textarea {
  min-height: 138px;
  resize: vertical;
  line-height: 1.6;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 85, 164, 0.15);
}

#codexImageModel:disabled {
  cursor: not-allowed;
  background: var(--surface-subtle);
  color: var(--muted);
  border-color: var(--line);
  opacity: 1;
}

input[type="file"] {
  padding: 8px 10px;
}

.required-star {
  margin-left: 2px;
  color: var(--danger);
}

.codex-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.codex-reference-picked {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.codex-reference-picked-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.codex-reference-picked-copy span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.listing-actions-row,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-row button,
.task-actions button {
  min-height: 34px;
}

.quote-box {
  padding: 11px 12px;
  border: 1px solid #ead191;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #735313;
  font-weight: 700;
}

.codex-progress-text {
  min-height: 20px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.codex-result-summary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px 14px;
  justify-content: flex-start;
}

.codex-result-summary .codex-meta {
  flex: 1 1 280px;
  min-width: 0;
}

.codex-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.codex-status-badge.idle {
  background: var(--surface-subtle);
  color: var(--muted-strong);
}

.codex-status-badge.running {
  background: var(--blue-soft);
  color: var(--blue);
}

.codex-status-badge.success {
  background: var(--success-soft);
  color: var(--success);
}

.codex-status-badge.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.preview-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar > :first-child {
  justify-self: start;
}

.preview-toolbar .codex-status-badge {
  justify-self: center;
}

.preview-toolbar .primary {
  justify-self: end;
}

.preview-toolbar strong {
  font-size: 18px;
}

.codex-preview-stage {
  position: relative;
  min-height: 440px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(17, 133, 117, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(40, 85, 164, 0.08) 25%, transparent 25%),
    #f6f8fa;
  background-position:
    0 0,
    0 12px;
  background-size: 24px 24px;
  cursor: zoom-in;
}

.codex-preview-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(20, 32, 43, 0.08);
  border-radius: 6px;
  pointer-events: none;
}

.codex-preview-stage img {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: #ffffff;
  cursor: zoom-in;
}

[data-preview-image] {
  cursor: zoom-in;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 20, 0.78);
}

.image-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  height: min(780px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: #0f172a;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.image-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: #edf4fa;
}

.image-preview-toolbar strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.image-preview-actions button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #edf4fa;
}

.image-preview-viewport {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    #111827;
  background-position:
    0 0,
    0 12px;
  background-size: 24px 24px;
}

.image-preview-viewport.is-dragging {
  cursor: grabbing;
}

.image-preview-viewport img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 120ms ease;
  pointer-events: none;
  -webkit-user-drag: none;
}

.image-preview-viewport.is-dragging img {
  transition: none;
}

.empty-hint {
  position: relative;
  z-index: 1;
  max-width: 260px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.json-view,
.codex-log-stream {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border-radius: var(--radius);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.json-view {
  min-height: 120px;
  max-height: 220px;
  margin: 0;
  padding: 12px;
  border: 1px solid #263244;
  background: #111827;
  color: #d8e2ee;
}

.codex-log-stream {
  min-height: 118px;
  max-height: 190px;
  padding: 10px 12px;
  border: 1px solid #263244;
  background: #0f172a;
}

.codex-log-line + .codex-log-line {
  margin-top: 4px;
}

.codex-log-line.info {
  color: #c8d3df;
}

.codex-log-line.success {
  color: #96e8ba;
}

.codex-log-line.error {
  color: #f4aaa8;
}

.task-list,
.package-list {
  display: grid;
  gap: 10px;
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.history-tab {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-tab span {
  margin-left: 4px;
  color: inherit;
}

.history-tab.is-active {
  border-color: rgba(17, 133, 117, 0.24);
  background: var(--teal-soft);
  color: var(--teal);
}

.package-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.task-card,
.package-card {
  padding: 14px;
}

.task-card-has-preview {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.task-thumbnail {
  width: 104px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.task-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.task-body {
  min-width: 0;
}

.task-prompt {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.task-head,
.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  flex-wrap: wrap;
}

.task-head {
  margin-bottom: 8px;
  font-size: 15px;
}

.task-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.task-actions {
  margin-top: 12px;
}

.task-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.task-status.succeeded,
.task-status.paid,
.task-status.approved,
.task-status.charged {
  background: var(--success-soft);
  color: var(--success);
}

.task-status.failed,
.task-status.rejected,
.task-status.cancelled,
.task-status.canceled {
  background: var(--danger-soft);
  color: var(--danger);
}

.task-status.running,
.task-status.pending,
.task-status.pending_review,
.task-status.unpaid {
  background: var(--warning-soft);
  color: var(--warning);
}

.package-card h3 {
  margin: 0;
  font-size: 16px;
}

.package-price {
  margin: 8px 0 6px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 800;
}

.empty {
  margin: 0;
  padding: 14px 4px;
}

.auth-page {
  min-height: 100vh;
  background-color: #f7fbfb;
  background-image:
    linear-gradient(rgba(17, 133, 117, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 133, 117, 0.07) 1px, transparent 1px),
    linear-gradient(135deg, rgba(196, 244, 237, 0.72), transparent 34%),
    linear-gradient(315deg, rgba(196, 244, 237, 0.58), transparent 30%);
  background-position:
    center,
    center,
    right top,
    left bottom;
  background-size:
    64px 64px,
    64px 64px,
    100% 100%,
    100% 100%;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px 18px;
}

.auth-card {
  width: min(448px, 100%);
  display: grid;
  justify-items: center;
  gap: 22px;
  animation: authRise 420ms ease-out both;
}

.auth-brand-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.auth-brand-stack h1 {
  margin: 0;
  color: var(--brand);
  font-size: 31px;
  line-height: 1.1;
  font-weight: 850;
}

.auth-brand-stack p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-brand-mark-large {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(18, 30, 64, 0.94), rgba(22, 53, 111, 0.98)),
    var(--brand);
  box-shadow:
    0 18px 42px rgba(22, 53, 111, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  font-size: 18px;
}

.auth-panel {
  width: 100%;
  padding: 36px 32px 32px;
  border: 1px solid rgba(217, 225, 231, 0.86);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 24px 70px rgba(15, 23, 42, 0.11),
    0 4px 18px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(16px);
}

.auth-panel-head {
  text-align: center;
}

.auth-panel-head p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-panel-head h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f8f8;
}

.auth-tab {
  min-height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.auth-tab:hover {
  background: rgba(255, 255, 255, 0.78);
}

.auth-tab.is-active {
  background: #ffffff;
  color: var(--brand-deep);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form input {
  min-height: 44px;
  border-color: #dce3e8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 11px 13px;
}

.auth-form input:focus {
  border-color: #19c6b1;
  box-shadow:
    0 0 0 3px rgba(25, 198, 177, 0.18),
    0 10px 24px rgba(15, 23, 42, 0.06);
}

.auth-form button {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  border-radius: 12px;
  background: linear-gradient(135deg, #20c6b2, #0b9485);
  box-shadow: 0 12px 22px rgba(11, 148, 133, 0.23);
}

.wechat-guide {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(25, 198, 177, 0.32);
  border-radius: 12px;
  background: rgba(228, 244, 239, 0.72);
}

.wechat-guide strong {
  color: var(--brand-deep);
  font-size: 13px;
}

.wechat-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wechat-guide-copy {
  display: grid;
  gap: 5px;
}

.wechat-guide span {
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.wechat-guide-trigger {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(11, 148, 133, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.wechat-guide-trigger:hover {
  transform: none;
  background: #ffffff;
}

.wechat-guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wechat-guide-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1;
}

.wechat-inline-qr {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 196px;
  padding: 14px;
  border: 1px solid rgba(11, 148, 133, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: inherit;
  box-shadow: none;
}

.wechat-inline-qr:hover {
  transform: none;
  border-color: rgba(11, 148, 133, 0.32);
  background: #ffffff;
}

.wechat-inline-qr img {
  display: block;
  width: min(168px, 100%);
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
}

.wechat-inline-qr-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.settings-panel {
  max-width: 680px;
}

.settings-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-message[data-tone="success"] {
  color: var(--success);
}

.settings-message[data-tone="error"] {
  color: var(--danger);
}

.auth-link {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  box-shadow: none;
}

.auth-link:hover {
  color: var(--brand-deep);
  transform: none;
}

.auth-message {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.auth-footer {
  color: #9ba7b2;
  font-size: 12px;
}

.wechat-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wechat-qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(8px);
}

.wechat-qr-dialog {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 24px;
  background:
    radial-gradient(
      circle at top left,
      rgba(32, 198, 178, 0.12),
      transparent 42%
    ),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

.wechat-qr-close {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  box-shadow: none;
}

.wechat-qr-close:hover {
  transform: none;
  color: var(--brand-deep);
}

.wechat-qr-content {
  display: grid;
  grid-template-columns: minmax(220px, 240px) 1fr;
  gap: 22px;
  align-items: center;
}

.wechat-qr-stage {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 18px;
  border: 1px solid rgba(11, 148, 133, 0.16);
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(244, 252, 249, 0.94),
    rgba(255, 255, 255, 0.98)
  );
}

.wechat-qr-stage img {
  display: block;
  width: 100%;
  max-width: 204px;
  border-radius: 18px;
  object-fit: cover;
}

.wechat-qr-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.wechat-qr-copy {
  display: grid;
  gap: 10px;
}

.wechat-qr-copy strong {
  color: var(--brand-deep);
  font-size: 18px;
}

.wechat-qr-copy p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.7;
}

.wechat-qr-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(11, 148, 133, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.wechat-qr-link:hover {
  background: #ffffff;
}

@keyframes authRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .overview-grid,
  .overview-layout,
  .codex-image-grid {
    grid-template-columns: 1fr;
  }

  .codex-preview-stage {
    min-height: 360px;
  }

  .codex-preview-stage img {
    max-height: 360px;
  }

  .codex-image-result {
    margin-top: 0;
  }

  .wechat-qr-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sidebar-note {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-shell {
    padding: 28px 16px;
  }

  .auth-panel {
    padding: 28px 22px 26px;
  }

  .wechat-guide-head {
    flex-direction: column;
  }

  .wechat-guide-trigger,
  .wechat-qr-link {
    width: 100%;
  }

  .wechat-qr-modal {
    padding: 14px;
  }

  .wechat-qr-dialog {
    padding: 18px;
    border-radius: 20px;
  }

  .wechat-qr-stage {
    min-height: 220px;
  }

  .image-preview-modal {
    padding: 12px;
  }

  .image-preview-dialog {
    height: calc(100vh - 24px);
  }

  .image-preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-preview-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

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

  .workspace {
    padding: 14px;
  }

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

  .panel-head,
  .codex-reference-picked-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-toolbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .preview-toolbar > :first-child,
  .preview-toolbar .primary {
    justify-self: stretch;
  }

  .preview-toolbar .codex-status-badge {
    justify-self: center;
  }

  .topbar-actions,
  .topbar-actions button,
  .listing-actions-row,
  .listing-actions-row button,
  .preview-toolbar .primary,
  .task-actions,
  .task-actions button {
    width: 100%;
  }

  .overview-grid,
  .codex-control-grid,
  .package-list {
    grid-template-columns: 1fr;
  }

  .codex-preview-stage {
    min-height: 280px;
  }

  .codex-preview-stage img {
    max-height: 280px;
  }

  .task-card-has-preview {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
  }

  .task-thumbnail {
    width: 78px;
    font-size: 11px;
  }

  .auth-brand-stack h1 {
    font-size: 28px;
  }

  .auth-panel-head h2 {
    font-size: 24px;
  }
}
