/* TikTok 脚本创作云台 — 薰衣草紫主题 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: #f4f3fb; color: #191827; font-size: 14px; line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: #6a5cf5; text-decoration: none; }
h2 { font-size: 20px; margin: 0; }
h3 { margin: 0; }

#app { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
#sidebar {
  width: 260px; flex: 0 0 260px; background: #fbfaff; border-right: 1px solid #eceaf6;
  padding: 18px 14px; display: flex; flex-direction: column; gap: 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.logo-icon { width: 38px; height: 38px; border-radius: 11px; background: #6a5cf5; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.logo-title { font-weight: 700; font-size: 15px; }
.logo-sub { font-size: 10px; letter-spacing: 2px; color: #8a87a0; }
.nav-group-title { font-size: 11px; color: #8a87a0; letter-spacing: 1px; padding: 6px 8px 2px; }
#mainNav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: none; background: transparent;
  border-radius: 10px; font-size: 14px; color: #33324a; text-align: left; width: 100%;
}
.nav-item:hover { background: #f1effc; }
.nav-item.active { background: #efedfd; color: #5b4fd6; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; color: #6a5cf5; }
.promo-card {
  margin-top: auto; background: linear-gradient(135deg, #efeafd, #e6e1fd); border: 1px solid #ddd5fb;
  border-radius: 14px; padding: 14px; cursor: pointer;
}
.promo-title { font-weight: 700; margin-bottom: 4px; }
.promo-desc { font-size: 12px; color: #5d5a75; margin-bottom: 8px; }
.promo-link { font-size: 12px; font-weight: 600; }
.workspace-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; border-top: 1px solid #eceaf6; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #6a5cf5; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.ws-meta { flex: 1; }
.ws-name { font-size: 13px; font-weight: 600; }
.ws-plan { font-size: 11px; color: #8a87a0; }
.ws-dots { color: #8a87a0; }
#sidebarMask { display: none; }

/* ===== 主区与顶栏 ===== */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid #eceaf6; padding: 12px 22px; display: flex; align-items: center; gap: 14px;
}
#btnMenu { display: none; border: 1px solid #e6e3f5; background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 16px; }
.crumb { color: #8a87a0; font-size: 13px; }
.crumb-sep { margin: 0 4px; }
#crumbView { color: #191827; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; background: #f1effc; border: 1px solid #e6e3f5; color: #4c4680; font-size: 12px; padding: 5px 11px; border-radius: 999px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-purple { background: #6a5cf5; } .dot-green { background: #22b573; } .dot-gray { background: #b9b6cc; }
#content { padding: 22px; max-width: 1460px; width: 100%; margin: 0 auto; }

/* ===== 通用组件 ===== */
.card { background: #fff; border: 1px solid #eceaf6; border-radius: 18px; padding: 18px; box-shadow: 0 1px 3px rgba(80,70,180,.05); }
.kicker { font-size: 11px; letter-spacing: 2px; color: #6a5cf5; font-weight: 700; text-transform: uppercase; }
.page-title { font-size: 22px; margin: 4px 0 2px; }
.section-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.section-head.mt, .mt { margin-top: 26px; }
.section-sub { color: #8a87a0; font-size: 13px; margin: 4px 0 14px; }
.head-note { color: #8a87a0; font-size: 12px; margin-left: auto; }
.num-pill { background: #6a5cf5; color: #fff; font-weight: 700; font-size: 13px; border-radius: 999px; padding: 3px 11px; }
.num-pill.sm { font-size: 11px; padding: 2px 8px; }
.card-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.card-title { font-weight: 700; font-size: 15px; }
.card-sub { color: #8a87a0; font-size: 12px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.req { color: #e5484d; }
.hint { color: #8a87a0; font-size: 12px; margin: 5px 0; }
.hint.center { text-align: center; }
.input {
  width: 100%; border: 1px solid #e6e3f5; border-radius: 10px; padding: 8px 10px; font-size: 14px;
  background: #fff; color: #191827; outline: none;
}
.input:focus { border-color: #6a5cf5; box-shadow: 0 0 0 3px rgba(106,92,245,.15); }
.input.err { border-color: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.12); }
textarea.input.big { line-height: 1.6; }
select.input { appearance: auto; }
.row-flex { display: flex; align-items: center; }
.row-flex.gap { gap: 8px; }
.row-flex .flex1 { flex: 1; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn {
  border-radius: 10px; padding: 8px 16px; font-size: 14px; border: 1px solid transparent; background: #fff;
}
.btn-primary { background: #6a5cf5; color: #fff; font-weight: 600; }
.btn-primary:hover { background: #5b4fd6; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { border-color: #e6e3f5; color: #33324a; background: #fff; }
.btn-outline:hover { border-color: #6a5cf5; color: #5b4fd6; }
.btn-ghost-purple { border: 1px solid #d9d2fc; color: #5b4fd6; background: #f6f4ff; font-weight: 600; }
.btn-text { background: none; border: none; color: #8a87a0; font-size: 13px; padding: 4px 6px; }
.btn-text:hover { color: #e5484d; }
.btn-danger-outline { border: 1px solid #f3c2c4; color: #e5484d; background: #fff; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; padding: 12px; font-size: 15px; }
.btn-x { border: none; background: none; font-size: 16px; color: #8a87a0; padding: 4px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tip-box { background: #f3f1fe; border: 1px solid #e6e1fd; color: #4c4680; border-radius: 10px; padding: 9px 11px; font-size: 12.5px; margin-top: 10px; }
.info-box { background: #f6f4ff; border: 1px solid #e9e5fd; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin-top: 10px; }
.info-box .ib-row { margin: 2px 0; }
.info-box .ib-label { color: #8a87a0; }
.tag { display: inline-block; font-size: 11px; padding: 1.5px 8px; border-radius: 999px; background: #efedfd; color: #5b4fd6; font-weight: 600; }
.tag.green { background: #e3f7ec; color: #12805c; }
.tag.orange { background: #fdeeda; color: #b25e09; }
.tag.gray { background: #efeff4; color: #6d6a85; }
.tag.blue { background: #e5f0fe; color: #2563eb; }
.tag.outline { background: #fff; border: 1px solid #d9d2fc; }

/* ===== 配置区 ===== */
.config-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 12px; }
@media (max-width: 1200px) { .config-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .config-grid { grid-template-columns: 1fr; } }
.mat-toggle { display: flex; gap: 8px; }
.mat-btn { flex: 1; padding: 9px; border-radius: 10px; border: 1px solid #e6e3f5; background: #fff; font-weight: 600; }
.mat-btn.active { background: #6a5cf5; color: #fff; border-color: #6a5cf5; }
.mat-btn:disabled { opacity: .5; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid #e6e3f5; background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13px; }
.pill.active { background: #6a5cf5; color: #fff; border-color: #6a5cf5; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { background: #efedfd; color: #5b4fd6; font-size: 11.5px; border-radius: 999px; padding: 2.5px 9px; }
#prodInfo .sample-box { background: #fbfbfe; border: 1px solid #eceaf6; border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 12.5px; }
#prodInfo .sample-box h5 { margin: 6px 0 2px; font-size: 12px; color: #8a87a0; }
#prodInfo .sample-box ul { margin: 0; padding-left: 16px; }
.thumb-sm { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid #eceaf6; }

/* ===== 输出区 ===== */
.out-card { margin-top: 16px; }
.out-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.out-head h2 { font-size: 17px; }
.out-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }
.badge-ready { font-size: 11px; font-weight: 700; padding: 2.5px 9px; border-radius: 999px; background: #e3f7ec; color: #12805c; }
.badge-ready.idle { background: #efeff4; color: #6d6a85; }
.empty-state { text-align: center; color: #8a87a0; padding: 34px 12px; }
.empty-ico { font-size: 30px; margin-bottom: 6px; }
.prompt-editor {
  width: 100%; min-height: 430px; margin-top: 14px; border: 1px solid #e6e3f5; border-radius: 12px;
  padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.65;
  background: #fcfbff; resize: vertical; outline: none;
}
.prompt-editor:focus { border-color: #6a5cf5; box-shadow: 0 0 0 3px rgba(106,92,245,.15); }
.fallback-fold { margin-top: 16px; border-top: 1px dashed #e6e3f5; padding-top: 12px; }
.fallback-fold summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.code-block {
  background: #17141f; color: #d8d4ea; border-radius: 12px; padding: 14px; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: 12px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.import-area { margin-top: 14px; }
.import-box { position: relative; }
.expand-btn { position: absolute; top: 8px; right: 8px; }
.overlay { position: fixed; inset: 0; background: #fff; z-index: 90; display: flex; flex-direction: column; }
.overlay-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid #eceaf6; }
.overlay-editor { flex: 1; border: none; padding: 18px 20px; font-size: 14px; line-height: 1.7; resize: none; outline: none; font-family: inherit; }

/* ===== 钩子与格式卡 ===== */
.w200 { width: 200px; } .w220 { width: 220px; } .w140 { width: 140px; } .w160 { width: 160px; }
.hook-grid, .format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
@media (max-width: 1100px) { .hook-grid, .format-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .hook-grid, .format-grid { grid-template-columns: 1fr; } }
.hook-card, .format-card { background: #fff; border: 1px solid #eceaf6; border-radius: 14px; padding: 14px; }
.hook-card.selected { border-color: #6a5cf5; box-shadow: 0 0 0 2.5px rgba(106,92,245,.18); }
.hook-card .hc-top, .format-card .fc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hook-card .hc-name, .format-card .fc-name { font-weight: 700; }
.hook-card .hc-tpl, .format-card .fc-play { font-size: 13px; color: #44435e; margin: 8px 0 4px; }
.hook-card .hc-fit, .format-card .fc-fit { font-size: 12px; color: #8a87a0; }
.hook-card .hc-hook, .format-card .fc-hook { font-size: 12.5px; color: #5b4fd6; margin-top: 6px; }
.hc-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.link-btn { background: none; border: none; color: #6a5cf5; font-weight: 700; font-size: 13px; padding: 2px 4px; }

/* ===== 脚本库 ===== */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status-tabs { display: inline-flex; background: #f1effc; border-radius: 999px; padding: 3px; gap: 2px; }
.status-tab { border: none; background: transparent; padding: 5px 13px; border-radius: 999px; font-size: 13px; color: #5d5a75; }
.status-tab.active { background: #fff; color: #5b4fd6; font-weight: 700; box-shadow: 0 1px 3px rgba(80,70,180,.15); }
.select-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
.script-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 1100px) { .script-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .script-grid { grid-template-columns: 1fr; } }
.script-card { border: 1px solid #eceaf6; border-radius: 14px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 7px; }
.script-card .sc-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.script-card .sc-prod { color: #8a87a0; font-size: 12.5px; }
.sc-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sc-hook { color: #5b4fd6; font-size: 12.5px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-status { display: flex; justify-content: space-between; align-items: center; }
.sc-btns { display: flex; gap: 7px; margin-top: auto; }
.sc-btns .btn { flex: 1; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager .pg { border: 1px solid #e6e3f5; background: #fff; border-radius: 8px; padding: 5px 11px; font-size: 13px; }
.pager .pg.active { background: #6a5cf5; color: #fff; border-color: #6a5cf5; }

/* ===== 产品库 ===== */
.card-inner-head { margin-bottom: 8px; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
@media (max-width: 1100px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .product-grid { grid-template-columns: 1fr; } }
.product-card { border: 1px solid #eceaf6; border-radius: 14px; padding: 15px; background: #fff; }
.product-card .pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.product-card .pc-name { font-weight: 700; font-size: 15.5px; }
.pc-points { color: #44435e; font-size: 13px; margin: 8px 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.pc-created { color: #8a87a0; font-size: 12px; }
.pc-link { font-size: 12px; display: inline-block; margin-top: 4px; }
.pc-btns { display: flex; gap: 8px; margin-top: 12px; }
.pc-btns .btn { flex: 1; }

/* ===== 利润测算 ===== */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 14px; margin-top: 6px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.check-card { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #e6e3f5; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.adv-fold { margin-top: 14px; border-top: 1px dashed #e6e3f5; padding-top: 10px; }
.adv-fold summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.block-title { font-size: 15.5px; margin: 0 0 10px; }
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
@media (max-width: 1150px) { .results-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .results-grid { grid-template-columns: 1fr; } }
.result-card { background: #fff; border: 1px solid #eceaf6; border-radius: 16px; padding: 16px; }
.result-card .rc-head { display: flex; justify-content: space-between; align-items: baseline; }
.result-card .rc-country { font-weight: 700; font-size: 16px; }
.result-card .rc-cur { color: #8a87a0; font-size: 12px; }
.profit-banner { background: linear-gradient(135deg, #6a5cf5, #8a7bff); color: #fff; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.profit-banner .pb-label { font-size: 12px; opacity: .85; }
.profit-banner .pb-big { font-size: 23px; font-weight: 800; }
.profit-banner .pb-small { font-size: 12.5px; opacity: .92; }
.profit-banner.neg { background: linear-gradient(135deg, #d64550, #e5737c); }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.detail-table th { text-align: left; color: #8a87a0; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #f0eef9; }
.detail-table td { padding: 4px 6px; border-bottom: 1px solid #f6f4fc; }
.detail-table td.num, .detail-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.detail-table tr.group-row td { background: #f6f4ff; font-weight: 700; color: #5b4fd6; border-bottom: none; }
.neg-text { color: #e5484d !important; font-weight: 700; }
.pos-text { color: #12805c; font-weight: 700; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 880px; }
table.data-table th { text-align: left; color: #8a87a0; font-weight: 600; padding: 8px; border-bottom: 1.5px solid #eceaf6; white-space: nowrap; }
table.data-table td { padding: 9px 8px; border-bottom: 1px solid #f2f0fa; vertical-align: middle; }
table.data-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { border: 1px solid #e6e3f5; background: #fff; border-radius: 8px; padding: 4px 8px; font-size: 13px; margin-right: 4px; }
.icon-btn:hover { border-color: #6a5cf5; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; background: #fbfbfe; border: 1px solid #eceaf6; border-radius: 12px; padding: 14px; }
@media (max-width: 700px) { .info-grid { grid-template-columns: 1fr 1fr; } }
.info-grid .ig-label { font-size: 11.5px; color: #8a87a0; }
.info-grid .ig-value { font-weight: 600; margin-top: 1px; }

/* ===== 信息采集 ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.intel-list-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.intel-list-table th { text-align: left; color: #8a87a0; padding: 6px 8px; border-bottom: 1.5px solid #eceaf6; }
.intel-list-table td { padding: 7px 8px; border-bottom: 1px solid #f2f0fa; vertical-align: top; }
.act-item, .trend-item { padding: 9px 0; border-bottom: 1px dashed #eeeaf9; }
.act-item:last-child, .trend-item:last-child { border-bottom: none; }
.act-name, .trend-title { font-weight: 600; }
.act-points, .trend-points { font-size: 12.5px; color: #44435e; margin-top: 2px; }
.sub-block-title { font-size: 13.5px; font-weight: 700; margin: 14px 0 4px; color: #5b4fd6; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(23,20,40,.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 26px 12px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; box-shadow: 0 18px 50px rgba(30,25,70,.25); }
.modal.wide { max-width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px 8px; }
.modal-head strong { font-size: 16.5px; }
.modal-body { padding: 6px 20px 14px; max-height: 74vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid #f2f0fa; flex-wrap: wrap; }
.prompt-sections .ps-sec { margin-bottom: 10px; }
.prompt-sections .ps-name { font-weight: 700; color: #5b4fd6; font-size: 13px; margin-bottom: 2px; }
.prompt-sections .ps-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: #fcfbff; border: 1px solid #f0eef9; border-radius: 10px; padding: 9px 11px; }
.prompt-sections .ps-raw { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.upload-box { border: 1.5px dashed #d9d2fc; border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; background: #fbfaff; }
.upload-link { color: #6a5cf5; font-weight: 600; }
.upload-box img { max-width: 160px; max-height: 120px; border-radius: 8px; display: block; margin: 8px auto; }

/* ===== toast ===== */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-item { background: #191827; color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 86vw; text-align: center; }

/* ===== 移动端 ===== */
@media (max-width: 900px) {
  #sidebar { position: fixed; left: -280px; transition: left .22s ease; height: 100dvh; }
  #sidebar.open { left: 0; box-shadow: 0 0 40px rgba(30,25,70,.25); }
  #sidebarMask.show { display: block; position: fixed; inset: 0; background: rgba(23,20,40,.35); z-index: 35; }
  #btnMenu { display: inline-block; }
  #content { padding: 14px; }
  .status-pill { display: none; }
}
