/* AI 美颜调试台 · 暗色「调光室」视觉体系 */
:root {
  --bg: #141210;
  --bg-2: #1b1815;
  --panel: #201c19;
  --panel-2: #26211d;
  --line: #342d27;
  --line-2: #463c34;
  --ink: #f1e9df;
  --ink-2: #b7ab9c;
  --ink-3: #7d7266;
  --amber: #f2b544;
  --amber-2: #ffd27a;
  --amber-dim: rgba(242, 181, 68, 0.14);
  --rose: #e8798e;
  --rose-dim: rgba(232, 121, 142, 0.14);
  --sky: #7fb8d8;
  --sky-dim: rgba(127, 184, 216, 0.14);
  --mint: #8fd3a8;
  --mint-dim: rgba(143, 211, 168, 0.14);
  --danger: #ef6b5a;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
  --r: 14px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(242, 181, 68, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(232, 121, 142, 0.07), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.35; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); margin: 0; letter-spacing: 0.01em; }
h1 { font-size: 30px; font-weight: 900; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; color: var(--ink); }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 28px; backdrop-filter: blur(14px);
  background: rgba(20, 18, 16, 0.78); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-dim), 0 0 24px rgba(242, 181, 68, 0.5); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: var(--serif); font-size: 17px; font-weight: 900; }
.brand-text small { color: var(--ink-3); font-size: 11px; letter-spacing: 0.08em; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 14px; border-radius: 999px; white-space: nowrap; color: var(--ink-2); font-weight: 500; transition: all 0.2s; }
.nav a:hover { color: var(--ink); background: var(--panel-2); }
.nav a.active { color: var(--bg); background: var(--amber); font-weight: 700; }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); font-family: var(--mono); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(143, 211, 168, 0.6); animation: pulse 2s infinite; }
.status.off .pulse { background: var(--danger); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(143, 211, 168, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(143, 211, 168, 0); } 100% { box-shadow: 0 0 0 0 rgba(143, 211, 168, 0); } }

.app { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 32px 28px 80px; }
.foot { position: relative; z-index: 1; display: flex; gap: 14px; align-items: center; justify-content: center; padding: 20px; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line); }
.foot .sep { width: 1px; height: 12px; background: var(--line-2); }

/* ---------- 通用组件 ---------- */
.reveal { animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.reveal:nth-child(2) { animation-delay: 0.06s; } .reveal:nth-child(3) { animation-delay: 0.12s; } .reveal:nth-child(4) { animation-delay: 0.18s; } .reveal:nth-child(5) { animation-delay: 0.24s; } .reveal:nth-child(6) { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--amber); text-transform: uppercase; margin-bottom: 8px; }
.page-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 640px; }

.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head .num { font-family: var(--mono); color: var(--amber); font-size: 12px; margin-right: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .app { padding: 20px 16px 60px; } .topbar { padding: 10px 16px; gap: 8px 14px; flex-wrap: wrap; } .brand-text small { display: none; } .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; } .nav a { padding: 6px 12px; } .status { margin-left: auto; } .panel { padding: 18px 16px; } .thumbs { grid-template-columns: repeat(2, 1fr); } .report-head .btn-row { width: 100%; } }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); cursor: pointer; font-weight: 500; transition: all 0.18s; white-space: nowrap; }
.btn:hover { border-color: var(--amber); color: var(--amber-2); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--amber); color: #1a1408; border-color: var(--amber); font-weight: 700; }
.btn.primary:hover { background: var(--amber-2); color: #1a1408; }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--ink-2); letter-spacing: 0.04em; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); outline: none; transition: border 0.18s; }
.input:focus { border-color: var(--amber); }
textarea.input { min-height: 120px; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.input.sm { padding: 5px 8px; font-size: 12px; border-radius: 7px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); cursor: pointer; transition: all 0.18s; user-select: none; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.on { background: var(--amber-dim); border-color: var(--amber); color: var(--amber-2); font-weight: 600; }
.chip.rose.on { background: var(--rose-dim); border-color: var(--rose); color: #ffb3c1; }

.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; border: 1px solid transparent; }
.tag.amber { background: var(--amber-dim); color: var(--amber-2); border-color: rgba(242, 181, 68, 0.35); }
.tag.rose { background: var(--rose-dim); color: #ffb3c1; border-color: rgba(232, 121, 142, 0.35); }
.tag.sky { background: var(--sky-dim); color: #b7dcf0; border-color: rgba(127, 184, 216, 0.35); }
.tag.mint { background: var(--mint-dim); color: #bdeccd; border-color: rgba(143, 211, 168, 0.35); }
.tag.grey { background: rgba(255,255,255,0.05); color: var(--ink-2); border-color: var(--line-2); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 11px; letter-spacing: 0.08em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table .mono { font-size: 12px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: var(--r); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; pointer-events: none; transition: all 0.25s; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- 采集页 ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.steps { counter-reset: s; }
.dropzone { display: block; border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 28px; text-align: center; color: var(--ink-2); cursor: pointer; transition: all 0.2s; background: rgba(255,255,255,0.015); position: relative; overflow: hidden; }
.dropzone:hover, .dropzone.over { border-color: var(--amber); background: var(--amber-dim); color: var(--amber-2); }
.dropzone b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.dropzone input { display: none; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.thumb { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .lbl { position: absolute; left: 6px; top: 6px; }
.thumb .rm { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; text-align: center; }
.notice { display: block; padding: 10px 12px; border-radius: 10px; background: var(--sky-dim); border: 1px solid rgba(127, 184, 216, 0.25); color: #cfe6f3; font-size: 12px; margin-top: 12px; }
.notice .btn { float: right; margin-left: 10px; }
.notice.warn { background: var(--amber-dim); border-color: rgba(242,181,68,0.3); color: var(--amber-2); }

.summary-card { position: sticky; top: 84px; }
.summary-card .line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.summary-card .line span:first-child { color: var(--ink-3); }
.progress { margin-top: 16px; }
.progress .step { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--ink-3); font-size: 13px; }
.progress .step .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.progress .step.doing { color: var(--amber-2); } .progress .step.doing .dot { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: pulse 1.2s infinite; }
.progress .step.done { color: var(--ink-2); } .progress .step.done .dot { background: var(--mint); border-color: var(--mint); }

/* ---------- 方案报告 ---------- */
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.report-head .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr; } }
.fcard { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fcard h3 { font-size: 13px; color: var(--amber); margin-bottom: 10px; letter-spacing: 0.06em; }
.frow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.frow:last-child { border-bottom: none; }
.frow span:first-child { color: var(--ink-2); }
.frow b { font-weight: 600; }
.frow select { max-width: 120px; }
.meter { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.meter i { width: 10px; height: 6px; border-radius: 2px; background: var(--line-2); }
.meter i.on { background: var(--amber); }
.photos-strip { display: flex; gap: 10px; margin-bottom: 14px; }
.photos-strip img { width: 84px; height: 108px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); }
.blemish { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; background: var(--rose-dim); border: 1px solid rgba(232,121,142,0.25); font-size: 12px; margin: 3px 4px 3px 0; }
.conf { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

.advice p { margin: 0 0 8px; }
.advice .lbl { display: inline-block; min-width: 64px; color: var(--amber); font-family: var(--serif); font-weight: 700; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cloth-item { display: inline-block; padding: 6px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line-2); margin: 3px 6px 3px 0; font-size: 13px; }

.light-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .light-wrap { grid-template-columns: 1fr; } }
.light-svg { width: 100%; background: radial-gradient(circle at 50% 55%, #2a241f, #17140f 70%); border-radius: 12px; border: 1px solid var(--line); }
.light-list .lrow { display: grid; grid-template-columns: 26px 1fr 110px 120px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.light-list .lrow .n { width: 22px; height: 22px; border-radius: 50%; background: var(--amber); color: #1a1408; font-weight: 700; font-family: var(--mono); font-size: 11px; display: grid; place-items: center; }
.light-list .lrow .pos { color: var(--ink-3); font-size: 11px; }
.kelvin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.sw-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.sw-tab { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); cursor: pointer; font-family: var(--mono); font-size: 12px; }
.sw-tab.on { border-color: var(--rose); color: #ffb3c1; background: var(--rose-dim); }
.param-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .param-groups { grid-template-columns: 1fr; } }
.pgroup h4 { margin: 0 0 8px; font-family: var(--serif); color: var(--rose); font-size: 13px; letter-spacing: 0.08em; }
.prow { display: grid; grid-template-columns: 64px 1fr 44px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.prow .nm { color: var(--ink-2); }
.prow input[type=range] { width: 100%; accent-color: var(--rose); height: 4px; }
.prow .val { font-family: var(--mono); text-align: right; font-size: 12px; }
.prow .val.up { color: var(--amber-2); } .prow .val.down { color: var(--sky); }
.prow .range { font-family: var(--mono); font-size: 10px; color: var(--ink-3); display: block; white-space: nowrap; }

.trace { font-size: 12px; }
.trace li { padding: 5px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 12px; }
.trace .adj { font-family: var(--mono); color: var(--ink-3); }
.versions li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; align-items: center; }

/* ---------- 工作台 ---------- */
.filters { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .v { font-family: var(--serif); font-size: 28px; font-weight: 900; color: var(--amber-2); line-height: 1; }
.stat .l { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.row-actions { display: flex; gap: 6px; }

/* ---------- 管理后台 ---------- */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.admin-tabs button { background: none; border: none; padding: 10px 14px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tabs button.on { color: var(--amber-2); border-bottom-color: var(--amber); font-weight: 600; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl-item { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tpl-item.on { border-color: var(--amber); background: var(--amber-dim); }
.tpl-item .name { font-weight: 600; }
.tpl-edit { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.tpl-edit > div, .grid-2 > *, .grid-3 > *, .light-wrap > *, .hero > * { min-width: 0; }
@media (max-width: 900px) { .tpl-edit { grid-template-columns: 1fr; } }
.table input.input.sm { width: 72px; }
.table input.input.sm.wide { width: 120px; }

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; color: #111; font-size: 12px; }
  .topbar, .foot, .grain, .no-print, .toast { display: none !important; }
  .app { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: 1px solid #ccc; background: #fff; break-inside: avoid; padding: 14px; }
  .fcard, .stat, .cloth-item, .tpl-item, .light-svg { background: #fafafa; border-color: #ddd; }
  h1, h2, h3, .frow b, .kv dd { color: #111; }
  .fcard h3, .advice .lbl, .pgroup h4 { color: #8a5a00; }
  .muted, .dim, .frow span:first-child, .prow .nm { color: #555; }
  .tag { border-color: #bbb; color: #333; background: #f2f2f2; }
  input[type=range] { display: none; }
  .prow { grid-template-columns: 80px 1fr 60px; }
}
