:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #1c2230;
  --text-2: #4a5263;
  --muted: #7a8293;
  --accent: #3a63e0;
  --accent-hover: #2f53c4;
  --accent-soft: #eaf0fe;
  --accent-text: #2b4fb8;
  --danger: #d0443e;
  --success: #1e9a5a;
  --thumb-bg: #141821;
  --shadow-md: 0 6px 20px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .24);
  --radius: 12px;
  --radius-sm: 8px;
  --aud-2b: #2f6fd6;
  --aud-2c: #d9741c;
  --st-draft: #7a8293;
  --st-ai_pending: #7b5cd6;
  --st-ai_review: #d9741c;
  --st-composing: #2f6fd6;
  --st-publish_pending: #0f9488;
  --st-published: #1e9a5a;
  --st-cancelled: #a3a9b5;
  --kind-sim: #7b5cd6;
  --kind-intro: #0f9488;
  --kind-outro: #0f9488;
  --kind-reference: #d9741c;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1f2430;
    --border: #2a303c;
    --border-strong: #3a4150;
    --text: #e7eaf0;
    --text-2: #b8bfcc;
    --muted: #8a92a2;
    --accent: #5b82f5;
    --accent-hover: #6f91f7;
    --accent-soft: #1f2a48;
    --accent-text: #a5bbff;
    --danger: #e5605a;
    --success: #3cbf7a;
    --thumb-bg: #0a0c10;
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    --aud-2b: #6f9cf0;
    --aud-2c: #f0a35e;
    --st-draft: #8a92a2;
    --st-ai_pending: #a08af0;
    --st-ai_review: #f0a35e;
    --st-composing: #6f9cf0;
    --st-publish_pending: #3cc4b6;
    --st-published: #3cbf7a;
    --st-cancelled: #5d6475;
    --kind-sim: #8f74e8;
    --kind-intro: #14a596;
    --kind-outro: #14a596;
    --kind-reference: #e0893a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner, .toolbar-inner, .content {
  max-width: 1440px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; flex: 0 1 auto; }
.brand-logo { flex: none; border-radius: 10px; }
.brand-text { min-width: 0; }
.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub { margin: 2px 0 0; overflow: hidden; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* ---------- 工具栏 ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.toolbar-inner { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
.toolbar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 320px; max-width: 520px; }
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 36px; }
.result-count { margin-left: auto; font-size: 13px; color: var(--muted); }
.result-count:empty + .btn { margin-left: auto; }

/* ---------- 表单控件 ---------- */
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input, select { height: 38px; padding: 0 12px; }
textarea { padding: 8px 12px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8293' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-light { background: #fff; border-color: #fff; color: #1c2230; }
.btn-light:hover { background: #e9ecf1; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 14px; height: 14px; }

/* ---------- 视频卡片 ---------- */
.content { padding-top: 20px; padding-bottom: 48px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; }
.empty { padding: 80px 0; text-align: center; color: var(--muted); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.flash { animation: flash 1.8s ease; }
@keyframes flash {
  0%, 50% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--thumb-bg); }
.thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.card.thumb-ready .thumb video { opacity: 1; }
.thumb-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .22); }
.thumb-placeholder svg { width: 38px; height: 38px; }
.card.thumb-ready .thumb-placeholder { display: none; }

.badge {
  position: absolute;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.badge-duration { right: 8px; bottom: 8px; background: rgba(0, 0, 0, .72); color: #fff; }
.badge-missing { left: 8px; top: 8px; background: var(--danger); color: #fff; }

.card-download {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.card-download svg { width: 16px; height: 16px; }
.card:hover .card-download, .card:focus-within .card-download { opacity: 1; }
.card-download:hover { background: var(--accent); }
@media (hover: none) { .card-download { opacity: 1; } }

.card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.card-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-meta { margin: 0; overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-tags:empty { display: none; }
.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11.5px;
  line-height: 1;
}
.card-desc {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--text-2);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- 弹窗 ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(10, 14, 22, .55); backdrop-filter: blur(2px); }
.dialog-detail { width: min(1120px, calc(100vw - 32px)); }
.dialog-panel { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin: 0; overflow: hidden; font-size: 16px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

.detail-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); overflow: auto; }
.detail-media { padding: 20px; border-right: 1px solid var(--border); }
.player { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #000; }
.player video { display: block; width: 100%; height: 100%; background: #000; }
.player-missing {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  background: var(--thumb-bg);
  color: #cfd4dc;
  text-align: center;
}
.player-missing p { margin: 0; }
.player-missing .progress { width: 60%; margin: 0; }

.info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 18px 2px 0; }
.info dt { font-size: 12px; color: var(--muted); }
.info dd { margin: 2px 0 0; font-size: 13.5px; word-break: break-all; }

.detail-form { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field small { margin-left: 6px; font-weight: 400; color: var(--muted); }
.field-grow textarea { min-height: 170px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 4px; }

/* ---------- 场景宣传文案 ---------- */
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.scenes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scenes-head > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.scene-list { display: flex; flex-direction: column; gap: 10px; }
.scene-list:empty { display: none; }
.scene-empty { margin: 0; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--muted); text-align: center; }
.scene-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--aud, var(--border-strong));
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.scene-item[data-audience="2B"] { --aud: var(--aud-2b); }
.scene-item[data-audience="2C"] { --aud: var(--aud-2c); }
.scene-row { display: flex; align-items: center; gap: 6px; }
.scene-row select { flex: none; width: 86px; height: 34px; padding-left: 10px; font-weight: 600; color: var(--aud, var(--text)); }
.scene-row input { flex: 1; min-width: 0; height: 34px; }
.scene-item textarea { min-height: 92px; }

.tag-aud { font-weight: 600; background: color-mix(in srgb, var(--aud) 14%, transparent); color: var(--aud); }
.tag-aud[data-audience="2B"] { --aud: var(--aud-2b); }
.tag-aud[data-audience="2C"] { --aud: var(--aud-2c); }
.tag-aud[data-audience="通用"] { --aud: var(--muted); }

/* 场景多时保存按钮固定在底部 */
.detail-form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: auto -20px -20px;
  padding: 12px 20px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* ---------- 上传 ---------- */
.upload-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 20px; overflow: auto; border: 0; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--accent); }
.dropzone small { color: var(--muted); }
fieldset:disabled .dropzone { opacity: .6; cursor: not-allowed; }

.file-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.file-list:empty { display: none; }
.file-item { padding: 8px 6px 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; min-height: 26px; font-size: 13px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-size, .file-status { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-status { min-width: 56px; text-align: right; }
.is-done .file-status { color: var(--success); }
.is-failed .file-status, .is-invalid .file-status { color: var(--danger); }
.file-item.is-uploading .progress { margin: 8px 6px 2px 0; }

.progress { height: 4px; overflow: hidden; border-radius: 999px; background: var(--border); }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: #1c2230;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  .detail-body { grid-template-columns: minmax(0, 1fr); }
  .detail-media { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .topbar-inner, .toolbar-inner, .content { padding-left: 16px; padding-right: 16px; }
  .brand-title { font-size: 16px; }
  .hide-sm { display: none; }
  .toolbar-row > .btn-primary { width: 38px; padding: 0; }
  .search { flex-basis: 100%; max-width: none; }
  .toolbar select { flex: 1; min-width: 0; }
  .result-count { flex-basis: 100%; margin-left: 0; }
  .result-count:empty { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-body { padding: 10px 10px 12px; }
  .dialog, .dialog-detail {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }
  .dialog-panel { height: 100%; max-height: none; }
  .detail-media, .detail-form, .upload-body { padding: 16px; }
  .detail-form .form-actions { margin: auto -16px -16px; padding: 12px 16px 16px; }
}

/* =====================================================================
   制作平台新增：导航、用户菜单、筛选标签、资料、任务、周报、管理页
   ===================================================================== */

/* ---------- 导航 ---------- */
.nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }

.user-menu { position: relative; flex: none; margin-left: auto; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--border); background: var(--surface-2); }
.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-meta b { font-size: 13px; font-weight: 600; }
.user-meta small { font-size: 11.5px; color: var(--muted); }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: var(--surface-2); }

/* ---------- 筛选标签 ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 0 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.chip-count { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }

.scope-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
}

/* ---------- 通用补充 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.overdue { color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(.94); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-block { width: 100%; }
.plain-fieldset { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.plain-fieldset:disabled input, .plain-fieldset:disabled select, .plain-fieldset:disabled textarea { background: var(--surface-2); color: var(--text-2); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.info-wide { grid-column: 1 / -1; }
.info dd a { color: var(--accent-text); }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }

.badge-kind { left: 8px; top: 8px; color: #fff; font-weight: 600; background: var(--kind, #555); }
.kind-sim { --kind: var(--kind-sim); }
.kind-intro { --kind: var(--kind-intro); }
.kind-outro { --kind: var(--kind-outro); }
.kind-reference { --kind: var(--kind-reference); }
.badge-missing + .badge-kind { top: 34px; }

/* 通用表单弹窗 */
.dialog-form { width: min(520px, calc(100vw - 32px)); }
.dialog-panel-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.form-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; overflow: auto; }
.dialog-intro { margin: 0; color: var(--text-2); font-size: 13px; }
.dialog-form .info { margin: 0; }

/* ---------- 基础资料 ---------- */
.thumb-asset { background: var(--surface-2); }
.thumb-asset img { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s; }
.thumb-asset.thumb-ready img { opacity: 1; }
.thumb-asset .thumb-placeholder { color: var(--border-strong); }
.thumb-asset.thumb-ready .thumb-placeholder { display: none; }
.file-badge { position: absolute; inset: 0; display: grid; place-items: center; }
.file-badge span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 78px;
  border-radius: 6px 18px 6px 6px;
  background: var(--ft, var(--muted));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
}
.ft-pdf { --ft: #d0443e; }
.ft-office { --ft: #2f6fd6; }
.ft-image { --ft: #1e9a5a; }
.ft-other { --ft: #7a8293; }

.asset-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  max-height: 60vh;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-2);
}
.asset-preview img { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; }
.asset-preview.is-pdf { display: block; height: 60vh; }
.asset-preview iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.asset-preview-badge { position: relative; width: 120px; height: 140px; }
.asset-preview-badge .file-badge span { width: 88px; height: 108px; font-size: 16px; }

/* ---------- 任务列表 ---------- */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.task-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.task-main { flex: 1; min-width: 0; }
.task-title { overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.task-id { margin-right: 8px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.task-sub { margin-top: 2px; overflow: hidden; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.task-side { display: flex; flex: none; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; font-size: 12.5px; }
.task-meta { color: var(--text-2); }
.task-due { color: var(--text-2); }
.task-due.overdue { color: var(--danger); font-weight: 600; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st, var(--muted)) 14%, transparent);
  color: var(--st, var(--muted));
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-draft { --st: var(--st-draft); }
.st-ai_pending { --st: var(--st-ai_pending); }
.st-ai_review { --st: var(--st-ai_review); }
.st-composing { --st: var(--st-composing); }
.st-publish_pending { --st: var(--st-publish_pending); }
.st-published { --st: var(--st-published); }
.st-cancelled { --st: var(--st-cancelled); }
.chip[data-status]:not(.active)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); }
.chip[data-status="draft"] { --st: var(--st-draft); }
.chip[data-status="ai_pending"] { --st: var(--st-ai_pending); }
.chip[data-status="ai_review"] { --st: var(--st-ai_review); }
.chip[data-status="composing"] { --st: var(--st-composing); }
.chip[data-status="publish_pending"] { --st: var(--st-publish_pending); }
.chip[data-status="published"] { --st: var(--st-published); }
.chip[data-status="cancelled"] { --st: var(--st-cancelled); }

/* ---------- 任务详情 ---------- */
.task-detail { max-width: 1280px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--accent-text); }
.back-link svg { width: 16px; height: 16px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; }
.detail-title { min-width: 0; }
.detail-title h2 { margin: 0; font-size: 21px; font-weight: 650; line-height: 1.35; }
.detail-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stepper { display: flex; gap: 0; margin: 20px 0 8px; padding: 0; list-style: none; counter-reset: step; }
.stepper li { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.stepper li::before { content: ""; position: absolute; top: 13px; right: 50%; left: -50%; height: 2px; background: var(--border); }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: var(--accent); }
.step-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.stepper li.done .step-dot { border-color: var(--accent); background: var(--accent); color: #fff; }
.stepper li.current .step-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.current { color: var(--text); font-weight: 600; }
.step-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stepper.is-cancelled { opacity: .45; filter: grayscale(1); }
.next-hint {
  margin: 12px 0 18px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
}

.detail-columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.detail-aside { position: sticky; top: 16px; }

.panel { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.panel-head .panel-title { margin: 0; }
.panel-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.panel-title small { margin-left: 8px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.panel-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-desc { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.panel-empty { margin: 0; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; text-align: center; }

.info-form { display: flex; flex-direction: column; gap: 14px; }
.form-actions-inline { display: flex; justify-content: flex-end; gap: 10px; }

/* 素材槽位 */
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.slot { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.slot[data-slot="real"], .slot[data-slot="asset"] { grid-row: span 2; }
.slot-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.slot-head b { display: block; font-size: 13.5px; }
.slot-head small { display: block; font-size: 11.5px; color: var(--muted); }
.slot-items { display: flex; flex-direction: column; gap: 6px; }
.slot-empty { margin: 0; padding: 8px 0; font-size: 12.5px; color: var(--muted); }
.mat-item { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mat-item.clickable { cursor: pointer; }
.mat-item.clickable:hover { border-color: var(--accent); }
.mat-item.is-deleted { opacity: .6; }
.mini-thumb { position: relative; flex: none; width: 72px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 5px; background: var(--thumb-bg); }
.mini-thumb video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.mini-thumb.thumb-ready video { opacity: 1; }
.mini-thumb .thumb-placeholder svg { width: 20px; height: 20px; }
.mini-thumb.thumb-ready .thumb-placeholder { display: none; }
.mini-asset { position: absolute; inset: 0; background: var(--surface-2); }
.mini-asset img { width: 100%; height: 100%; object-fit: contain; }
.mini-asset .file-badge span { width: 26px; height: 32px; border-radius: 3px 8px 3px 3px; font-size: 8px; }
.mini-asset .thumb-placeholder { color: var(--border-strong); }
.mini-asset .badge { display: none; }
.mat-text { flex: 1; min-width: 0; }
.mat-name { overflow: hidden; font-size: 13px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.mat-meta { overflow: hidden; font-size: 11.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.mat-tools { display: flex; flex: none; }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* 选择素材 */
.dialog-picker { width: min(980px, calc(100vw - 32px)); }
.dialog-picker .dialog-panel { height: min(780px, calc(100vh - 48px)); }
.picker-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.picker-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.picker-tools input[type="search"] { flex: 1 1 260px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-content: start; gap: 12px; flex: 1; padding: 16px 20px; overflow: auto; }
.picker-grid .empty { grid-column: 1 / -1; padding: 40px 0; }
.picker-grid { grid-auto-rows: max-content; }
.pick-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 0 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.pick-card:hover { border-color: var(--border-strong); }
.pick-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--thumb-bg); }
.picker-thumb video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.picker-thumb.thumb-ready video { opacity: 1; }
.picker-thumb.thumb-ready .thumb-placeholder { display: none; }
.pick-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  color: transparent;
}
.pick-check svg { width: 14px; height: 14px; }
.pick-card.selected .pick-check { border-color: var(--accent); background: var(--accent); color: #fff; }
.pick-order {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pick-name { display: block; padding: 6px 10px 0; overflow: hidden; font-size: 13px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.pick-meta { display: block; padding: 0 10px; overflow: hidden; font-size: 11.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* 任务文件 */
.tfiles { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tfile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.tfile-icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tfile-icon svg { width: 16px; height: 16px; }
.tfile-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.tfile-name { overflow: hidden; font-size: 13px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.tfile-meta { overflow: hidden; font-size: 11.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.file-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.tplayer-wrap { margin-bottom: 10px; overflow: hidden; border-radius: 10px; background: #000; }
.tplayer { display: block; width: 100%; max-height: 520px; background: #000; }

.rounds { display: flex; flex-direction: column; gap: 10px; }
.round { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.round > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 12px; cursor: pointer; list-style: none; }
.round > summary::-webkit-details-marker { display: none; }
.round > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.round[open] > summary::before { transform: rotate(90deg); }
.round-body { padding: 0 12px 12px; }
.round-note { margin: 0 0 10px; white-space: pre-wrap; font-size: 13px; color: var(--text-2); }
.round-review { margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); white-space: pre-wrap; font-size: 13px; }
.review-tag { margin-left: auto; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.review-tag.approve { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.review-tag.reject { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.review-tag.pending { background: color-mix(in srgb, var(--st-ai_review) 16%, transparent); color: var(--st-ai_review); }
.review-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--st-ai_review) 10%, transparent); font-size: 13px; }

.links { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.links li, .link-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 13px; }
.links a, .link-line a { overflow: hidden; color: var(--accent-text); white-space: nowrap; text-overflow: ellipsis; }
.link-platform { flex: none; padding: 1px 8px; border-radius: 4px; background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-row input:first-child { flex: 0 0 110px; }
.link-row input[type="url"] { flex: 1; min-width: 0; }

/* 进度记录 */
.timeline { margin: 0; padding: 0; list-style: none; }
.ev { position: relative; padding: 0 0 16px 20px; }
.ev::before { content: ""; position: absolute; top: 6px; left: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.ev::after { content: ""; position: absolute; top: 18px; bottom: 0; left: 6px; width: 2px; background: var(--border); }
.ev:last-child::after { display: none; }
.ev-submit::before, .ev-ai_uploaded::before { background: var(--st-ai_pending); }
.ev-approve::before, .ev-publish::before { background: var(--success); }
.ev-reject::before, .ev-back_to_composing::before, .ev-cancel::before { background: var(--danger); }
.ev-final_uploaded::before { background: var(--st-publish_pending); }
.ev-head { font-size: 13px; }
.ev-meta { font-size: 11.5px; color: var(--muted); }
.ev-comment { margin-top: 4px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); white-space: pre-wrap; font-size: 12.5px; color: var(--text-2); }
.panel-events { max-height: calc(100vh - 40px); overflow: auto; }

/* ---------- 周报、用户、设置 ---------- */
.content-narrow { max-width: 1080px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 650; }
.page-tools { display: flex; gap: 8px; }
.week-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.week-label { font-size: 15px; }
.stat-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-tile.ok .stat-num { color: var(--success); }
.stat-tile.bad .stat-num { color: var(--danger); }
.content-narrow .panel { margin-bottom: 18px; }
.status-bar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.status-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-top: 3px solid var(--st);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
}
.status-cell-num { font-size: 20px; font-weight: 700; color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--border-strong); color: var(--text-2); font-weight: 600; text-align: left; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a { color: var(--accent-text); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.row-muted td { color: var(--muted); }
.role-tag { padding: 2px 8px; border-radius: 4px; background: var(--surface-2); font-size: 12px; white-space: nowrap; }
.role-admin { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.role-sales { background: color-mix(in srgb, var(--aud-2c) 14%, transparent); color: var(--aud-2c); }
.role-provider { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.role-maker { background: var(--accent-soft); color: var(--accent-text); }
.role-help { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.role-help div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.role-help dt { font-size: 13px; font-weight: 600; }
.role-help dd { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.settings-form .panel { display: flex; flex-direction: column; gap: 12px; }
.settings-form .panel-title, .settings-form .panel-desc { margin: 0; }
.recipients { font-size: 13px; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); }

/* ---------- 登录页 ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card {
  width: min(400px, 100%);
  padding: 32px 28px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.login-brand { margin-bottom: 24px; text-align: center; }
.login-brand img { border-radius: 12px; }
.login-brand h1 { margin: 12px 0 4px; font-size: 19px; font-weight: 650; }
.login-brand p { margin: 0; font-size: 13px; color: var(--muted); }
#loginForm { display: flex; flex-direction: column; gap: 14px; }
.login-error { margin: 0; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 13px; }
.login-help { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 新增部分的窄屏适配 ---------- */
@media (max-width: 1100px) {
  .detail-columns { grid-template-columns: minmax(0, 1fr); }
  .detail-aside { position: static; }
  .panel-events { max-height: none; }
  .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .status-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .role-help { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -8px; padding-bottom: 6px; }
  .slots { grid-template-columns: minmax(0, 1fr); }
  .slot[data-slot="real"], .slot[data-slot="asset"] { grid-row: auto; }
  .field-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .task-side { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .brand-text { max-width: calc(100vw - 140px); }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-help { grid-template-columns: minmax(0, 1fr); }
  .stepper .step-label { display: none; }
  .stepper li.current .step-label { display: block; position: absolute; top: 34px; white-space: nowrap; }
  .stepper { margin-bottom: 28px; }
  .panel { padding: 14px; }
  .detail-actions { width: 100%; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 12px; }
  .dialog-picker .dialog-panel { height: 100%; }
  .form-body { padding: 16px; }
  .tfile { flex-wrap: wrap; }
  .file-actions { margin-left: 40px; }
  .link-row { flex-wrap: wrap; }
  .link-row input:first-child { flex-basis: calc(100% - 34px); }
}
