:root {
  --bg: #edf2e8;
  --panel: #ffffff;
  --ink: #0b1220;
  --muted: #667085;
  --line: #dbe3d6;
  --line-strong: #cbd5c3;
  --navy: #0b1220;
  --navy-soft: #142033;
  --lime: #a3e635;
  --lime-dark: #3f6212;
  --lime-soft: #ecfccb;
  --teal: #0f766e;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --success: #15803d;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(163, 230, 53, 0.2), transparent 60%),
    radial-gradient(780px 480px at 100% 0%, rgba(15, 118, 110, 0.13), transparent 55%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  background:
    radial-gradient(700px 300px at 12% -60%, rgba(163, 230, 53, 0.18), transparent 60%),
    linear-gradient(120deg, #0b1220 0%, #101b2d 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--lime);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(163, 230, 53, 0.22);
}
.brand-name { font-weight: 900; letter-spacing: -0.02em; font-size: 17px; }
.brand-sub { font-size: 12px; color: #94a3b8; margin-top: -1px; }
.topbar-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex: 0 0 auto;
}
.status-pill.ok::before { background: var(--lime); box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.14); }
.status-pill.warn::before { background: #fbbf24; }
.status-pill.error::before { background: #f87171; }

.hero-copy {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 34px;
  align-items: end;
  padding: 38px 0 28px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lime-dark);
  background: var(--lime-soft);
  border: 1px solid #d9f99d;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 14px 0 12px;
  max-width: 820px;
}
.hero-lead {
  max-width: 780px;
  color: #475569;
  font-size: 15px;
  margin: 0;
}
.hero-steps {
  display: grid;
  gap: 8px;
  align-self: end;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(219, 227, 214, 0.9);
  border-radius: 12px;
  padding: 9px 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.step span {
  font-size: 10px;
  color: var(--lime-dark);
  background: var(--lime-soft);
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 20px;
  align-items: start;
  padding-bottom: 22px;
}
.form-column { display: grid; gap: 16px; min-width: 0; }
.preview-column {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(219, 227, 214, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-kicker {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #94a3b8;
  margin-bottom: 2px;
}
.panel h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #f8faf6;
  color: #64748b;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.panel-kicker + h2 { margin-top: 1px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}
.field em {
  color: var(--danger);
  font-style: normal;
  font-size: 10px;
  vertical-align: 1px;
}
.field input,
.field textarea,
.modal input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fbfdf9;
  color: var(--ink);
  border-radius: 11px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.modal input:focus {
  border-color: #84cc16;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.22);
}
.field textarea { resize: vertical; min-height: 92px; }
.field-top { margin-top: 14px; }
.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 7px 0 0;
}
.image-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 7px 0 0;
  word-break: break-word;
}
.manual-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.manual-meta {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--lime-dark);
  font-weight: 800;
  font-size: 12px;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.spec-list { display: grid; gap: 8px; }
.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.spec-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fbfdf9;
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  min-width: 0;
}
.spec-row input:focus {
  border-color: #84cc16;
  box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.18);
}
.spec-row .btn { padding: 8px 10px; }

.dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px dashed #b8c7b0;
  background: linear-gradient(180deg, #fbfdf9, #f4f8ef);
  border-radius: 14px;
  padding: 16px;
  color: #475569;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.dropzone:hover { border-color: #84cc16; background: #fbfff5; }
.dropzone.dragover { border-color: #65a30d; background: #f3ffe0; transform: translateY(-1px); }
.dropzone-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--lime-soft);
  color: var(--lime-dark);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
}
.dropzone strong { display: block; font-size: 13px; color: var(--ink); }
.dropzone span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.crop-editor {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #f8faf6;
}
#cropCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 10px;
  background: #e2e8f0;
  cursor: grab;
  touch-action: none;
}
#cropCanvas.dragging { cursor: grabbing; }
.crop-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}
.zoom-control input { width: 120px; accent-color: #65a30d; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: var(--lime);
  border-color: #84cc16;
  color: #13200a;
  box-shadow: 0 10px 24px rgba(132, 204, 22, 0.22);
}
.btn-primary:hover { background: #b5f04a; }
.btn-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: #1e293b;
}
.btn-secondary:hover { border-color: #a8b8a0; background: #fbfdf9; }
.btn-mini {
  padding: 6px 9px;
  font-size: 11px;
  border-radius: 8px;
  background: #f8faf6;
  border-color: var(--line);
  color: #334155;
}
.btn-mini:hover { background: #fff; border-color: #a8b8a0; }
.btn-mini.danger { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.btn-mini.danger:hover { background: #fee2e2; }
.btn-block { width: 100%; }
.btn-dark-mini {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}
.btn-dark-mini:hover { background: rgba(255, 255, 255, 0.14); }

.post-textarea {
  width: 100%;
  min-height: 172px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  background: #fbfdf9;
  border-radius: 12px;
  padding: 12px;
  outline: none;
  line-height: 1.55;
  font-size: 13px;
}
.post-textarea:focus {
  border-color: #84cc16;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.2);
}
.char-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.char-count { font-size: 12px; font-weight: 900; color: #64748b; font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--warn); }
.char-count.error { color: var(--danger); }

.preview-panel { position: relative; }
.x-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}
.x-card-media {
  position: relative;
  aspect-ratio: 2 / 1;
  background:
    linear-gradient(135deg, rgba(163, 230, 53, 0.12), rgba(15, 118, 110, 0.12)),
    #eef2ea;
  overflow: hidden;
}
.x-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.x-card-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: #7c8a76;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  padding: 20px;
}
.x-card-domain {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(11, 18, 32, 0.78);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 800;
  backdrop-filter: blur(7px);
}
.x-card-body { padding: 13px 15px 15px; }
.x-card-kicker {
  color: #94a3b8;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin-bottom: 3px;
}
.x-card-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.x-card-desc {
  color: #64748b;
  font-size: 13px;
  margin-top: 3px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.link-panel {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.link-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.link-row > span { font-size: 11px; font-weight: 800; color: #64748b; }
.link-row code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  color: #334155;
}
.dirty-badge {
  margin-top: 10px;
  background: var(--warn-soft);
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 800;
}
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.action-grid .btn-block { grid-column: 1 / -1; }
.action-grid .btn { width: 100%; }

.checklist { margin: 0; padding-left: 18px; color: #475569; font-size: 12px; }
.checklist li { margin: 7px 0; }
.checklist li::marker { color: #65a30d; }

.meta-result { border-color: #d9f99d; background: #fbfff5; }
.meta-result h3 { margin: 0 0 4px; font-size: 15px; }
.meta-grid { display: grid; gap: 7px; margin-top: 10px; }
.meta-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.meta-item > span {
  display: block;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.meta-item code {
  display: block;
  color: #334155;
  font-size: 11px;
  word-break: break-all;
  white-space: pre-wrap;
}
.meta-warning {
  margin-top: 9px;
  background: var(--warn-soft);
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 11px;
}
.meta-warning ul { margin: 5px 0 0; padding-left: 16px; }
.meta-ok {
  margin-top: 9px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 11px;
}

.campaign-panel { margin: 8px 0 22px; }
.campaign-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.campaign-card {
  display: flex;
  gap: 11px;
  border: 1px solid var(--line);
  background: #fbfdf9;
  border-radius: 13px;
  padding: 10px;
  min-width: 0;
}
.campaign-thumb {
  width: 116px;
  flex: 0 0 auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 9px;
  background: #e2e8f0;
}
.campaign-info { min-width: 0; flex: 1; }
.campaign-name {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.campaign-tagline {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.campaign-meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 10px;
  margin-top: 5px;
  font-weight: 700;
}
.campaign-meta code {
  background: #eef2ea;
  border-radius: 5px;
  padding: 1px 4px;
  color: #334155;
}
.campaign-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.empty-state { color: var(--muted); font-size: 13px; margin: 4px 0; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 12px;
  border-top: 1px solid rgba(203, 213, 195, 0.8);
  padding: 18px 0 26px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 18, 32, 0.56);
  backdrop-filter: blur(7px);
}
.modal {
  width: min(450px, 100%);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
}
.modal h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.modal p { color: #64748b; font-size: 13px; margin: 0 0 12px; }
.modal input { margin-top: 3px; }
.modal-actions { display: flex; gap: 9px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  max-width: min(430px, calc(100vw - 40px));
  background: #0b1220;
  color: #fff;
  border-left: 4px solid var(--lime);
  border-radius: 12px;
  padding: 12px 15px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.28);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: #f87171; }
.toast.success { border-left-color: var(--lime); }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; grid-template-columns: 1fr 1fr; align-items: start; }
  .preview-panel { grid-row: span 2; }
  .hero-copy { grid-template-columns: 1fr; gap: 18px; }
  .hero-steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .preview-column { grid-template-columns: 1fr; }
  .preview-panel { grid-row: auto; }
  .campaign-list { grid-template-columns: 1fr; }
  .hero-steps { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1440px); }
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .topbar-status { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .spec-row { grid-template-columns: 1fr 1fr auto; }
  .action-grid { grid-template-columns: 1fr; }
  .action-grid .btn-block { grid-column: auto; }
  .link-row { grid-template-columns: 44px minmax(0, 1fr); }
  .link-row .btn { grid-column: 2; justify-self: start; }
  .campaign-card { flex-direction: column; }
  .campaign-thumb { width: 100%; }
}
