/* ============================================================
   沐沐造像局 · 统一设计系统 (ui.css)
   设计语言：Vercel 结构（shadow-as-border / 近黑 #171717 / 负字距标题）
            + 品牌红 #e5484d 作为唯一强调色
   所有页面（首页 / 生图中心 / 后台）共用同一套令牌与组件。
   ============================================================ */

:root {
  /* 文字 */
  --ink: #171717;          /* 主文字 / 标题（近黑，带微暖） */
  --ink-2: #404040;        /* 次级标题 */
  --muted: #6f6f6f;        /* 次要文字 */
  --faint: #9a9a9a;        /* 三级 / 占位 */

  /* 线条（shadow-as-border） */
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);

  /* 表面 */
  --paper: #ffffff;        /* 卡片 / 弹层表面 */
  --bg: #fafafa;           /* 页面底色 */
  --soft: #f5f5f5;         /* 浅填充 */

  /* 品牌红（唯一强调色） */
  --red: #e5484d;
  --red-ink: #c93b40;
  --red-soft: #fdecec;

  /* 功能色 */
  --green: #1a7f37;  --green-soft: #eaf6ee;
  --amber: #b7791f;  --amber-soft: #fdf3e3;
  --blue: #2a6aff;

  /* 圆角 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* 阴影栈（border + elevation + inner glow） */
  --shadow-card: rgba(0, 0, 0, 0.08) 0 0 0 1px, rgba(0, 0, 0, 0.04) 0 2px 2px, #fafafa 0 0 0 1px;
  --shadow-hover: rgba(0, 0, 0, 0.10) 0 0 0 1px, rgba(0, 0, 0, 0.06) 0 12px 30px -16px;
  --ring: rgba(0, 0, 0, 0.08) 0 0 0 1px;

  /* 字体 */
  --font: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid #171717; outline-offset: 2px; border-radius: 4px; }
::selection { background: #ffd8d9; color: #171717; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: 600 14px/1 var(--font);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:hover { background: var(--soft); border-color: #c9c9c9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn.danger { color: var(--red); border-color: #f0c2c4; }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #333; border-color: #333; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); }

/* ---------------- 表单 ---------------- */
.field { display: block; margin: 0 0 16px; }
.field > span,
.field > label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.input,
.select,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: 14px/1.5 var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.field textarea,
textarea.input { min-height: 96px; resize: vertical; }

/* ---------------- 卡片 ---------------- */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* ---------------- 状态 / 标签 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.status.disabled,
.status.off {
  background: var(--red-soft);
  color: var(--red-ink);
}
.status.disabled:before,
.status.off:before {
  background: var(--red-ink);
}
.fav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fav-tab {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  border-radius: 9px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.fav-tab:hover { border-color: var(--red); color: var(--red-ink); }
.fav-tab.is-active {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 3px 10px rgba(229,72,77,.18);
}
.meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.row-title { font-weight: 600; color: var(--ink); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.anomaly-actions,.log-actions,.cdk-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.anomaly-actions .select,.log-actions .select,.cdk-actions .select{min-width:130px}
.cdk-actions .input#cdkNote{min-width:180px;flex:1 1 180px;max-width:280px}

/* ---------------- 表格 ---------------- */
.tablebox {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.tablebox table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tablebox th,
.tablebox td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tablebox th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}
.tablebox tbody tr:last-child td { border-bottom: 0; }
.tablebox tbody tr:hover { background: #fcfcfc; }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}
.pager button,
.pager select {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.pager input {
  width: 64px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font: 13px/1 var(--font);
}

/* ---------------- 空 / 加载 ---------------- */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.loading { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 弹层（后台 modal） ---------------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 15, 14, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 40px;
  overflow: auto;
}
.modal-layer.show { display: flex; }
.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.modal.wide { width: min(760px, 100%); }
.modal.xwide {
  width: min(1280px, 96vw);
  max-height: min(90vh, 980px);
  display: flex;
  flex-direction: column;
}
.modal.xwide .modal-body {
  overflow: auto;
  max-height: calc(min(90vh, 980px) - 72px);
}
.modal-layer:has(.modal.xwide) {
  padding: 24px 16px 24px;
  align-items: center;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--soft); }

/* ---------------- 仪表盘统计卡 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-icon { width: 34px; height: 36px; margin-bottom: 12px; color: var(--muted); }
.stat label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat strong {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* ---------------- 排序条 ---------------- */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.sort-label { color: var(--muted); font-size: 13px; }
.sort-options { display: flex; gap: 8px; flex-wrap: wrap; }
.sort-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  padding: 7px 16px;
  border-radius: 9999px;
  font-size: 13px;
  cursor: pointer;
  transition: all .16s ease;
}
.sort-btn:hover { border-color: var(--ink); color: var(--ink); }
.sort-btn.is-active { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------------- 分享右侧抽屉 ---------------- */
.share-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 50px -28px rgba(0,0,0,.35);
  transform: translateX(100%);
  transition: transform .26s ease;
  z-index: 60;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.share-drawer.open { transform: translateX(0); }
.share-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.share-drawer-head h2 { font-size: 17px; margin: 0; }
.share-drawer-body { padding: 18px 20px 28px; }
.share-drawer .field { margin-bottom: 16px; }
.share-drawer .auth-submit { width: 100%; margin-top: 6px; }

/* 分类多选 */
.cat-block { margin-bottom: 14px; }
.cat-block > .cat-type { font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.cat-options { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 6px 12px; border-radius: 9999px; font-size: 13px; cursor: pointer;
  transition: all .16s ease; user-select: none;
}
.cat-chip input[type="checkbox"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.cat-chip:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.cat-chip:hover { border-color: var(--ink); }
.cat-chip.checked { background: var(--red); border-color: var(--red); color: #fff; }
.file-hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.share-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.share-previews img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ---------------- 我的提示词 / 通用页面式覆盖层 ---------------- */
.page-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.42);
  z-index: 55; display: flex; justify-content: center; align-items: flex-start;
  padding: 40px 16px; overflow-y: auto;
}
.page-overlay[hidden] { display: none; }
.page-card {
  width: 860px; max-width: 100%; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover); overflow: hidden;
}
.page-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.page-card-head h2 { margin: 0; font-size: 18px; }
.page-card-body { padding: 18px 22px 26px; }

/* 状态徽章 */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge-pending { background: #fff5e6; color: #b7791f; }
.badge-approved { background: #e9f7ef; color: #1a7f37; }
.badge-rejected { background: #fdecec; color: #c0392b; }
.badge-used { background: #e9f7ef; color: #1a7f37; }
.badge-unused { background: #eef0f3; color: #6f6f6f; }

/* 我的提示词列表 */
.mp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mp-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.mp-thumb { aspect-ratio: 1/1; background: #f3f3f3; }
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mp-info { padding: 12px 14px; }
.mp-info h4 { margin: 0 0 6px; font-size: 14px; }
.mp-info .mp-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

.balance-history-overlay{position:fixed;inset:0;z-index:80;display:none;background:rgba(0,0,0,.72);overflow:auto;padding:72px 20px 40px}
.balance-history-overlay.on{display:block}
.balance-history-card{position:relative;width:min(640px,100%);margin:0 auto;background:#fff;border-radius:22px;padding:32px 36px 28px;box-shadow:0 24px 80px rgba(0,0,0,.22)}
.balance-history-card h2{margin:0;text-align:center;font-size:26px}
.balance-history-card .auth-lead{text-align:center;color:#787878;font-size:14px;margin:8px 0 20px}
.balance-history-card .auth-close{position:absolute;right:16px;top:14px;border:0;background:transparent;color:#777;padding:8px 10px;border-radius:8px;cursor:pointer}
.balance-history-card .auth-close:hover{background:#f2f2f2;color:#111}
.balance-history-list{display:flex;flex-direction:column;gap:10px;max-height:min(56vh,520px);overflow:auto}
.balance-history-item{display:grid;gap:4px;border:1px solid rgba(0,0,0,.08);border-radius:12px;padding:12px 14px}
.balance-history-item b{font-size:15px}
.balance-history-item span,.balance-history-item small{color:#777;font-size:12px;line-height:1.6}
.generate-empty{color:#888;text-align:center;padding:28px 8px}

/* CDK 弹窗 */
.cdk-modal { width: 420px; max-width: 100%; }
.cdk-modal .field { margin-bottom: 14px; }

/* 公告弹窗 */
.ann-modal { width: 520px; max-width: 100%; }
.ann-content { font-size: 14px; line-height: 1.8; color: var(--ink-2); white-space: normal; word-break: break-word; max-height: 56vh; overflow-y: auto; margin: 6px 0 18px; }
.ann-content a { color: var(--red); }

/* 首页顶部滚动公告 */
.ann-ticker {
  overflow: hidden;
  background: #f7f7f7;
  color: #555;
  height: 36px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e9e9e9;
}
.ann-ticker[hidden] { display: none !important; }
.ann-ticker-viewport { overflow: hidden; flex: 1; min-width: 0; }
.ann-ticker.is-center .ann-ticker-viewport { display: flex; justify-content: center; }
.ann-ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.ann-ticker.is-scroll .ann-ticker-track {
  animation: ann-ticker-scroll 32s linear infinite;
  will-change: transform;
}
.ann-ticker-item { padding: 0 8px; font-size: 13px; letter-spacing: 0.02em; }
.ann-ticker-gap { padding: 0 28px; opacity: 0.4; }
.ann-ticker-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #666;
  font: 22px/1 inherit;
  cursor: pointer;
  opacity: 0.78;
}
.ann-ticker-close:hover { opacity: 1; }
@keyframes ann-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* 异常/日志图片缩略 */
.tiny-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* 必填标记 */
.req { color: var(--red); font-style: normal; margin-left: 2px; }

/* Matching creative-studio controls across image, video, reverse and series pages. */
body .workspace :is(#modelSelect,#gifModel,#count,#gifDuration,#style){height:38px;min-height:38px;box-sizing:border-box;font-size:14px}
body :is(#submit,#gifSubmit,#runBtn,#copyBtn).submit{height:42px;min-height:42px;border-radius:var(--radius-sm);font-size:14px}
