:root {
  --ink: #17171a;
  --muted: #6b7278;
  --line: #e2e5e7;
  --bg: #faf9fa;
  --card: #ffffff;
  --accent: #151517;
  --danger: #c0362c;
  --ok: #1f7a4d;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 240px;
}
.account-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--line); }
.account-chip span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 60px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 22px;
}
.panel h2 { font-size: 15px; margin: 0 0 6px; }
.accounts-panel { position: sticky; top: 78px; }

.hint { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.req { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ---------- accounts ---------- */
.account-list { display: flex; flex-direction: column; gap: 8px; }
.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.account-item:hover { border-color: #b9c0c5; }
.account-item.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.account-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.account-item .meta { min-width: 0; }
.account-item .nick { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-item .sub { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-item .warn { color: var(--danger); font-size: 11px; }
.empty { color: var(--muted); font-size: 12px; padding: 12px 0; }

/* ---------- fields ---------- */
.field { margin-bottom: 18px; }
.field > label:first-child {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
}
input[type="text"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  color: inherit;
  background: #fff;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: 2px solid #c9ced2;
  outline-offset: -1px;
  border-color: #b9c0c5;
}
textarea { resize: vertical; min-height: 84px; }
input[type="file"] { font-size: 12px; }
.counter { text-align: right; font-size: 11px; color: var(--muted); margin-top: 3px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; flex: none; }
.check.is-disabled { color: var(--muted); cursor: not-allowed; }
.check small { font-size: 11px; }

.sol-publish .layout { grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); padding-block: 29px 60px; }
.sol-publish { background: radial-gradient(ellipse at 70% 0%, #faecf0 0, transparent 42%), #faf9fa; }
.sol-publish .panel { border-color: #e1e4ef; border-radius: 18px; box-shadow: 0 12px 45px #20375908; }
.sol-publish .btn { transition: background .17s, border-color .17s, box-shadow .2s, transform .2s cubic-bezier(.22,.61,.36,1); }
.sol-publish .btn:not(:disabled):active { transform: scale(.975); }
.sol-publish h1 { font-size: 1.9rem; line-height: 1.13; margin: 4px 0 18px; letter-spacing: -.035em; }
.sol-publish .workspace-home { color: #4031af; font-weight: 650; font-size: .9rem; }
.sol-publish .field > label:first-child, .sol-publish legend { font-size: .86rem; }
.sol-publish .accounts-panel { top: 98px; }
.sol-publish .accounts-panel button { margin-top: 6px; }
.sol-publish input[type="file"] { max-width: 100%; }
.sol-publish input::file-selector-button { border: 1px solid #d8d4f5; border-radius: 7px; background: #f1eeff; color: #3828a1; padding: 6px 10px; margin-right: 9px; cursor: pointer; }
.interactions { margin-inline: 0; padding: 0; border: 0; }
.interactions legend { font-weight: 650; padding: 0; margin-bottom: 6px; }
.unavailable { display: none; }
.is-disabled .unavailable { display: inline; }
.sol-publish .preview-media video, .sol-publish .media-thumb video { width: 100%; height: 100%; object-fit: contain; }
.sol-publish .media-thumb img { cursor: pointer; }
.sol-publish .media-thumb.is-selected { border: 2px solid #5240d8; }
.photo-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 3px; }
.photo-tools [aria-pressed="true"] { color: #3828a1; background: #ece8ff; border-color: #d4cdf1; }
.photo-tools .muted { font-size: .82rem; }
.cover-badge {
  position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); padding: 2px 4px;
  border-radius: 4px; background: #2b225d; color: #fff; font-size: .6rem;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; pointer-events: none;
}
.sol-publish .preview-text { overflow-wrap: anywhere; }
.review-modal { width: min(536px, calc(100% - 26px)); max-height: 90svh; padding: 24px; border-radius: 19px; border: 1px solid #d9ddeb; color: #111c30; box-shadow: 0 25px 75px #141c4070; }
.review-modal::backdrop { background: #12182c9c; }
.review-modal[open] { animation: review-in .23s cubic-bezier(.16,1,.3,1) both; }
@keyframes review-in { from { opacity: 0; transform: translateY(9px) scale(.988); } }
.review-modal h2 { margin: 0 0 7px; font-size: 1.35rem; }
.review-modal p { color: #526179; }
.review-modal .declaration a { color: #4031af; text-decoration: underline; }
.review-modal .confirm-body dd { overflow-wrap: anywhere; }
@media(max-width: 900px) {
  .sol-publish .layout { grid-template-columns: 1fr; }
  .sol-publish .accounts-panel { position: static; }
}
@media(max-width: 520px) {
  .sol-publish .layout { padding-inline: 13px; }
  .sol-publish .panel { padding-inline: 13px; }
  .sol-publish .workspace-home { display: none; }
}

.switch-row { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 12px; cursor: pointer; }
.switch-row input { width: 38px; height: 22px; appearance: none; background: #d5d9dc; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(16px); }

.commercial-body { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfb; }
.label-hint { font-size: 12px; margin: 4px 0 8px; padding: 7px 10px; background: #fff5e6; border: 1px solid #f0dcb8; border-radius: 8px; }

/* ---------- media ---------- */
.media-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.media-thumb { position: relative; width: 74px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #f0f2f3; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb button[data-remove] {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.62); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.media-thumb .thumb-select { display: block; width: 100%; height: 100%; border: 0; padding: 0; background: transparent; }
.media-thumb .thumb-select:focus-visible { outline-offset: -4px; }
.media-thumb .order {
  position: absolute; bottom: 2px; left: 2px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 10px; padding: 0 5px; border-radius: 6px;
}
.field-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }

/* ---------- creator ---------- */
.creator-box {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px;
  background: #fafbfb;
}
.creator-box img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.creator-box > div { flex: 1; min-width: 0; }
.creator-label { font-size: 11px; color: var(--muted); }
.creator-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator-name span { color: var(--muted); font-size: 12px; }

/* ---------- preview ---------- */
.preview { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbfb; }
.preview-media { width: clamp(108px, 20vw, 183px); aspect-ratio: 9 / 14; border-radius: 8px; overflow: hidden; background: #eceff6; display: grid; place-items: center; flex: none; font-size: 11px; text-align: center; padding: 6px; }
.preview-media img { width: 100%; height: 100%; object-fit: contain; }
.preview-text { flex: 1; min-width: 0; }
.preview-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; word-break: break-word; }
.preview-desc { font-size: 12px; color: #3c4247; white-space: pre-wrap; word-break: break-word; max-height: 96px; overflow: auto; }
.preview-meta { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- declaration / actions ---------- */
.declaration { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.declaration a { color: inherit; }
.actions { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.processing-note { margin-top: 10px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 8px 14px; cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { border-color: #b9c0c5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 11px 22px; font-size: 14px; font-weight: 600; }
.btn-tiny { padding: 4px 9px; font-size: 11px; border-radius: 7px; }

/* ---------- progress / result ---------- */
.progress { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfb; }
.progress-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.progress-text { font-size: 12px; color: var(--muted); }
.progress-bar { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-bar i { display: block; height: 100%; width: 30%; background: var(--accent); border-radius: 999px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.progress.is-done .progress-bar { display: none; }

.result { margin-top: 16px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 13px; }
.result.is-ok { border-color: #b9dfc8; background: #f2fbf6; }
.result.is-error { border-color: #f0c9c6; background: #fdf4f3; color: var(--danger); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(16,18,20,.42); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; width: min(520px, 100%); max-height: 86vh; overflow: auto; box-shadow: 0 16px 48px rgba(0,0,0,.18); }
.modal-card h3 { margin: 0 0 14px; font-size: 16px; }
.confirm-body { font-size: 13px; }
.confirm-body dl { display: grid; grid-template-columns: 88px 1fr; gap: 7px 12px; margin: 0; }
.confirm-body dt { color: var(--muted); }
.confirm-body dd { margin: 0; word-break: break-word; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #161819; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 60; max-width: min(560px, 92vw); text-align: center;
}
.toast.is-error { background: var(--danger); }
