:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e5e7eb;
  --line-2: #eef0f3;
  --ink: #14161a;
  --ink-2: #3f4550;
  --muted: #6b7280;
  --brand: #c0392b;
  --brand-2: #a5301f;
  --ok: #17795e;
  --warn: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ── 登录 ── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #fff 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-logo, .side .logo { font-weight: 800; letter-spacing: .12em; }
.login-logo { font-size: 15px; color: var(--brand); }
.login-logo span, .side .logo span { color: var(--ink); font-weight: 500; margin-left: 4px; }
.login-card h1 { font-size: 22px; margin: 14px 0 4px; }
.login-card p { margin: 0 0 22px; font-size: 13px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.login-card input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.login-card input:disabled { background: #f7f8fa; color: var(--muted); }
.login-err { color: var(--brand); font-size: 12.5px; min-height: 18px; margin: 10px 0 0 !important; }
.login-tip { font-size: 12px; color: var(--muted); margin: 6px 0 0 !important; }

/* ── 布局 ── */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: #14161c; color: #cbd0da; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side .logo { font-size: 15px; color: #fff; padding: 0 8px; }
.side .logo span { color: #fff; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: #b9bfcb; cursor: pointer; }
.side nav a:hover { background: #1d2029; color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.side-foot a { color: #8b93a3; padding: 0 8px; }
.side-foot a:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.crumb { font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.save-hint { font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.save-hint.dirty { color: var(--warn); }
.content { padding: 22px; max-width: 1180px; width: 100%; }

/* ── 基础控件 ── */
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 500; transition: .12s; white-space: nowrap; }
.btn:hover { border-color: var(--line); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: transparent; }
.btn-ghost { border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #f7f8fa; }
.btn-danger { color: var(--brand); border-color: #f0d3ce; }
.btn-danger:hover { background: #fdf4f2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #c8ccd4; box-shadow: 0 0 0 3px rgba(192, 57, 43, .08); }
textarea { resize: vertical; line-height: 1.6; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── 概览 ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--muted); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── 列表 ── */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { max-width: 200px; }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: grid; grid-template-columns: 28px 64px 1fr 150px 110px 190px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.item:last-child { border-bottom: 0; }
.item:hover { background: #fafbfc; }
.item .ord { color: var(--muted); font-size: 12px; text-align: right; }
.item .thumb { width: 64px; height: 40px; border-radius: 6px; background: #f3f4f6; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.item .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.item .t { font-weight: 600; font-size: 13.5px; }
.item .s { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.item .acts { display: flex; gap: 6px; justify-content: flex-end; }
.item .acts button { padding: 4px 8px; font-size: 12px; }

/* ── 编辑器 ── */
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.editor-head h2 { font-size: 18px; margin: 0; }
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.sec > h3 { margin: 0; padding: 13px 18px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--line-2); background: #fcfcfd; }
.sec > .body { padding: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.count { float: right; font-variant-numeric: tabular-nums; }
.count.ok { color: var(--ok); }
.count.bad { color: var(--brand); }

/* 图片槽 */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.slot { border: 1px dashed #d3d7de; border-radius: 8px; background: #fbfbfc; aspect-ratio: 4/3; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.slot img { max-width: 100%; max-height: 100%; object-fit: contain; }
.slot .ph { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; padding: 8px; }
.slot .tag { position: absolute; left: 6px; top: 6px; font-size: 10.5px; background: rgba(20,22,26,.78); color: #fff; padding: 2px 6px; border-radius: 4px; }
.slot .del { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(20,22,26,.7); color: #fff; border: 0; cursor: pointer; font-size: 13px; line-height: 1; }
.slot:hover { border-color: var(--brand); }
.slot.main { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }

/* 正文块 */
.blk { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #fcfcfd; }
.blk-head { display: flex; gap: 6px; align-items: center; margin-bottom: 7px; }
.blk-head select { width: 120px; padding: 4px 8px; font-size: 12px; }
.blk-head .mini { padding: 3px 8px; font-size: 11.5px; }
.blk-head .grow { flex: 1; }
.blk textarea { border-color: var(--line); background: #fff; font-size: 13px; }
.blk.h2 textarea { font-weight: 700; font-size: 15px; }
.blk.h3 textarea { font-weight: 600; font-size: 14px; }

/* 规格表 */
.spec-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 28px; gap: 8px; margin-bottom: 8px; }
.spec-row input { padding: 7px 9px; font-size: 13px; }
.spec-row.head input { font-weight: 600; background: #f7f8fa; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--muted); width: 28px; height: 30px; }
.icon-btn:hover { color: var(--brand); border-color: #f0d3ce; }

/* 询盘 */
.inq { border-bottom: 1px solid var(--line-2); padding: 14px 18px; }
.inq:last-child { border-bottom: 0; }
.inq .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.inq .who { font-weight: 600; }
.inq .meta { font-size: 12px; color: var(--muted); }
.inq .msg { margin-top: 8px; white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--ink-2); }
.pill.new { background: #fdf0ee; color: var(--brand); }
.pill.done { background: #eaf6f1; color: var(--ok); }

/* 发布 */
.console { background: #14161c; color: #d6dae2; font: 12.5px/1.65 ui-monospace, Consolas, monospace; padding: 14px; border-radius: 8px; max-height: 300px; overflow: auto; white-space: pre-wrap; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; }

/* 任务条 */
.jobbar { position: fixed; right: 22px; bottom: 22px; width: 420px; background: #14161c; color: #d6dae2; border-radius: 10px; box-shadow: 0 20px 50px -12px rgba(0,0,0,.5); overflow: hidden; z-index: 60; }
.jobbar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #262a33; font-size: 13px; color: #fff; }
.jobbar-head .x { background: none; border: 0; color: #8b93a3; font-size: 18px; cursor: pointer; line-height: 1; }
.jobbar pre { margin: 0; padding: 12px 14px; max-height: 240px; overflow: auto; font: 12px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; }

/* 提示 */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #14161c; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); z-index: 80; }
.toast.err { background: var(--brand); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; gap: 12px; }
  .side nav { flex-direction: row; }
  .side-foot { display: none; }
  .stats, .quick, .grid2, .grid3 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 50px 1fr 100px; }
  .item .ord, .item .s, .item .thumb + .t ~ .s { display: none; }
  .slots { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 14px; }
}
