:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --bg: #f7f7f5;
  --card: #ffffff;
  --ink: #171717;
  --muted: #8d8d8d;
  --line: #ececea;
  --warm: #f5ece3;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, video { display: block; max-width: 100%; }

.app-shell { width: 100%; min-height: 100vh; padding-bottom: calc(82px + var(--safe-bottom)); }
.page { width: min(100%, 720px); margin: 0 auto; padding: 18px 16px 28px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; height: 58px; padding: 0 16px; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.back { position: absolute; left: 12px; display: grid; width: 38px; height: 38px; place-items: center; border: 0; background: transparent; font-size: 26px; }
.card { border: 1px solid rgba(0,0,0,.035); border-radius: 18px; background: var(--card); box-shadow: 0 8px 30px rgba(30,25,20,.035); }

.hero { padding: 24px 22px; overflow: hidden; background: linear-gradient(135deg,#171717 0%,#282725 55%,#4b4038 100%); color: #fff; }
.eyebrow { margin-bottom: 7px; color: #cabfb6; font-size: 12px; letter-spacing: .12em; }
.hero h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.hero p { max-width: 440px; margin: 10px 0 0; color: #d2ceca; font-size: 14px; line-height: 1.7; }
.balance-pill { display: inline-flex; margin-top: 18px; padding: 8px 12px; align-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.08); color: #f4e8dc; font-size: 13px; }

.kind-switch { display: grid; margin: 14px 0; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-button { min-height: 80px; padding: 15px; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); }
.kind-button strong { display: block; font-size: 17px; }
.kind-button span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.kind-button.active { border-color: #222; background: #222; color: #fff; }
.kind-button.active span { color: #bbb; }

.toolbar { display: flex; gap: 9px; }
.search { flex: 1; min-width: 0; height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: #fff; }
.sort { width: 86px; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.chips { display: flex; margin: 12px -16px 14px; padding: 0 16px; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 15px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #666; font-size: 13px; }
.chip.active { border-color: #1c1c1c; background: #1c1c1c; color: #fff; }

.workflow-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.workflow-card { min-width: 0; overflow: hidden; border-radius: 15px; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.04); }
.workflow-cover-wrap { position: relative; aspect-ratio: 4/5; overflow: hidden; background: #e9e9e7; }
.workflow-cover { width: 100%; height: 100%; object-fit: cover; }
.workflow-badge { position: absolute; left: 9px; bottom: 9px; padding: 5px 8px; border-radius: 7px; background: rgba(255,255,255,.9); color: #333; font-size: 11px; }
.workflow-info { padding: 12px; }
.workflow-name { min-height: 42px; overflow: hidden; font-size: 15px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.workflow-meta { display: flex; margin-top: 7px; align-items: center; justify-content: space-between; color: #aaa; font-size: 12px; }
.favorite { display: grid; width: 31px; height: 31px; place-items: center; border: 0; border-radius: 50%; background: #f5f5f3; color: #9a9a9a; font-size: 17px; }
.favorite.on { color: #b47b31; background: #fff5e8; }
.load-more { width: 100%; margin: 18px 0 4px; padding: 13px; border: 0; border-radius: 13px; background: #ececea; color: #666; }
.empty { padding: 80px 20px; color: #aaa; text-align: center; }

.detail-media { overflow: hidden; border-radius: 18px; background: #171717; }
.detail-media video, .detail-media img { width: 100%; max-height: 66vh; object-fit: contain; }
.detail-card { margin-top: 14px; padding: 20px; }
.detail-title-row { display: flex; gap: 14px; align-items: flex-start; }
.detail-title-row h2 { flex: 1; margin: 0; font-size: 22px; line-height: 1.35; }
.cost { flex: none; color: #a06428; font-weight: 650; }
.description { margin: 12px 0 0; color: #777; font-size: 14px; line-height: 1.75; }
.section-title { margin: 26px 0 12px; font-size: 18px; }
.field-card { margin-bottom: 12px; padding: 16px; }
.field-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.field-copy { min-width: 0; flex: 1; }
.field-label { font-size: 15px; font-weight: 650; }
.required { margin-left: 3px; color: #b45546; }
.field-desc { margin-top: 5px; color: #999; font-size: 12px; line-height: 1.55; }
.slot-media { position: relative; flex: none; width: 86px; height: 86px; overflow: hidden; border-radius: 12px; background: #eee; color: #888; text-decoration: none; }
.slot-media img, .slot-media video { width: 100%; height: 100%; object-fit: cover; }
.slot-media > span { position: absolute; right: 4px; bottom: 4px; left: 4px; padding: 3px 4px; overflow: hidden; border-radius: 5px; background: rgba(20,20,20,.68); color: #fff; font-size: 10px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.slot-empty { display: grid; place-items: center; border: 1px dashed #d7d7d3; background: #fafaf8; }
.slot-empty > span { position: static; background: transparent; color: #aaa; font-size: 12px; }
.slot-media.selected { box-shadow: 0 0 0 2px #b9d7bf; }
.upload-label { position: relative; display: flex; min-height: 48px; margin-top: 13px; overflow: hidden; align-items: center; justify-content: center; border: 1px dashed #cfcfca; border-radius: 12px; background: #fafaf8; color: #555; font-size: 13px; }
.upload-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .001; cursor: pointer; }
.file-name { margin-top: 8px; overflow: hidden; color: #777; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.field-card.invalid { border-color: #d27c70; box-shadow: 0 0 0 2px rgba(210,124,112,.12); }
.control { width: 100%; min-height: 46px; margin-top: 10px; padding: 10px 12px; border: 1px solid #dededb; border-radius: 11px; outline: none; background: #fff; }
textarea.control { min-height: 100px; resize: vertical; }
.check-row { display: flex; margin-top: 12px; gap: 9px; align-items: center; color: #666; font-size: 14px; }
.quote { margin: 18px 0; padding: 16px 18px; color: #69523c; background: var(--warm); }
.primary { display: flex; width: 100%; min-height: 52px; padding: 0 18px; align-items: center; justify-content: center; border: 0; border-radius: 14px; background: #171717; color: #fff; font-weight: 650; }
.primary:disabled { background: #aaa; }
.note { margin-top: 10px; color: #aaa; font-size: 12px; line-height: 1.6; text-align: center; }

.task-filters { display: flex; margin-bottom: 14px; gap: 8px; overflow-x: auto; }
.task-card { display: grid; margin-bottom: 12px; padding: 12px; grid-template-columns: 92px 1fr; gap: 13px; }
.task-cover { width: 92px; height: 112px; border-radius: 11px; object-fit: cover; background: #eee; }
.task-name { font-size: 15px; font-weight: 650; line-height: 1.4; }
.task-status { display: inline-block; margin-top: 9px; padding: 4px 7px; border-radius: 6px; background: #f2f2f0; color: #777; font-size: 11px; }
.task-status.succeeded { background: #eaf7ed; color: #3c9a52; }
.task-status.failed { background: #fff0ee; color: #c15a50; }
.task-sub { margin-top: 8px; color: #aaa; font-size: 12px; }
.result-video { width: 100%; margin-top: 12px; border-radius: 11px; background: #111; }

.profile-card { padding: 22px; }
.profile-row { display: flex; align-items: center; gap: 14px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; background: #eee; }
.profile-name { font-size: 18px; font-weight: 650; }
.profile-sub { margin-top: 4px; color: #aaa; font-size: 12px; }
.points-panel { margin-top: 14px; padding: 24px; text-align: center; }
.points-panel strong { display: block; margin-top: 5px; font-size: 42px; }
.secondary { width: 100%; min-height: 48px; margin-top: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: #555; }

.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; height: calc(68px + var(--safe-bottom)); padding: 7px max(12px,calc((100vw - 720px)/2)) var(--safe-bottom); grid-template-columns: repeat(5,1fr); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; background: transparent; color: #aaa; font-size: 11px; }
.nav-icon { margin-bottom: 3px; font-size: 21px; line-height: 1; }
.nav-item.active { color: #171717; font-weight: 600; }

.modal { position: fixed; z-index: 80; inset: 0; display: flex; padding: 18px; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.48); }
.modal-panel { width: min(100%,520px); padding: 24px; border-radius: 22px 22px max(22px,var(--safe-bottom)) max(22px,var(--safe-bottom)); background: #fff; }
.modal-panel h3 { margin: 0; font-size: 21px; }
.modal-panel p { margin: 9px 0 18px; color: #888; font-size: 13px; line-height: 1.6; }
.modal-close { float: right; border: 0; background: transparent; color: #999; font-size: 22px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 100px; max-width: calc(100% - 48px); padding: 11px 16px; transform: translate(-50%,20px); border-radius: 10px; opacity: 0; pointer-events: none; background: rgba(20,20,20,.9); color: #fff; font-size: 13px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.spinner { width: 26px; height: 26px; margin: 70px auto; border: 3px solid #ddd; border-top-color: #222; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  .workflow-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .page { padding-right: 22px; padding-left: 22px; }
}
