:root {
  --bg: #f5f4f1; --panel: #ffffff; --ink: #1b1a17; --muted: #6f6c66; --line: #e4e1db;
  --accent: #1b1a17; --accent-ink: #fff; --ok: #1f7a4d; --warn: #b4620b; --danger: #b3261e;
  --radius: 10px; --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
#app { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.sidebar { background: #121211; color: #e8e6e1; display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: #fff; color: #121211; display: grid; place-items: center; font-weight: 800; letter-spacing: -0.5px; }
.brand small { display: block; color: #9a978f; font-size: 11px; }
#nav a { display: block; padding: 8px 10px; border-radius: 7px; color: #d6d3cc; cursor: pointer; margin-bottom: 2px; }
#nav a:hover { background: #22211f; }
#nav a.active { background: #fff; color: #121211; font-weight: 600; }
.nav-group { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7d7a73; padding: 14px 10px 4px; }
.sidebar-foot { margin-top: auto; padding: 8px; color: #7d7a73; font-size: 11px; display: flex; flex-direction: column; gap: 6px; }
.badge { display: inline-block; background: var(--warn); color: #fff; padding: 2px 8px; border-radius: 99px; font-size: 11px; }
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar h1 { font-size: 18px; margin: 0; }
.topbar-actions { display: flex; gap: 8px; }
.view { padding: 24px 28px 60px; overflow: auto; }
.hidden { display: none !important; }

.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.btn:hover { border-color: #bcb8b0; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #e8c8c5; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.link { border: none; background: none; color: #2b5fb8; padding: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h2 small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field input[type=password], .field textarea, .field select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%; }
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid #cfd8ea; border-color: #9fb4da; }
.media { display: flex; gap: 12px; align-items: center; }
.media img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; background: #eee; border: 1px solid var(--line); }
.media .meta { font-size: 12px; color: var(--muted); word-break: break-all; }
.media .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fcfbf9; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-head strong { font-size: 13px; }
.item-tools { display: flex; gap: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.photo img { width: 100%; height: 120px; object-fit: cover; display: block; background: #eee; }
.photo .body { padding: 8px; }
.photo .body input { width: 100%; font: inherit; font-size: 12px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; }
.photo .tools { display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap; }
.photo.cover { outline: 2px solid var(--ok); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eef3ea; color: var(--ok); margin-left: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 700; }
.tile .l { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 160px; }
.bar { fill: #1b1a17; opacity: .85; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b1a17; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 50; max-width: 70vw; }
.toast.error { background: var(--danger); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 40; }
.modal-card { background: #fff; border-radius: 12px; padding: 22px 24px; width: 520px; max-width: 92vw; max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 12px; }
.progress { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--ok); width: 0; transition: width .2s; }
.status-ok { color: var(--ok); } .status-warn { color: var(--warn); } .status-err { color: var(--danger); }
.diff-list { max-height: 220px; overflow: auto; font-size: 12px; }
.diff-list .a { color: var(--ok); } .diff-list .m { color: var(--warn); } .diff-list .d { color: var(--danger); }
.step { display: flex; gap: 10px; margin-bottom: 8px; }
.step b { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.kbd { font-family: ui-monospace, monospace; background: #f0efec; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
