:root {
  color-scheme: light dark;
  --brand: #df2345;
  --brand-hover: #c61c3b;
  --brand-ink: light-dark(#cf1e3e, #ff8397);
  --brand-soft: light-dark(#fff0f3, #3a242b);
  --bg: light-dark(#f7f7f8, #171719);
  --surface: light-dark(#ffffff, #202024);
  --ink: light-dark(#252529, #f2f2f4);
  --muted: light-dark(#71717b, #adadb8);
  --line: light-dark(#e8e8ed, #37373e);
  --success: light-dark(#277647, #91d7a9);
  --success-bg: light-dark(#edf7f1, #203d2d);
  --pending: light-dark(#936213, #ebc07c);
  --pending-bg: light-dark(#fff6e4, #44331d);
  --error: light-dark(#a32922, #ffaaa2);
  --error-bg: light-dark(#fce9e8, #472324);
  --focus: light-dark(#a91531, #ff8397);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: 27px; line-height: 1.35; letter-spacing: -.5px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
button,input,textarea,select { font: inherit; }
button,.button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 15px; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover,.button:hover { border-color: var(--brand); background: var(--brand-soft); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.primary:hover { background: var(--brand-hover); color: #fff; border-color: var(--brand-hover); }
.danger { color: var(--error); }
button:focus-visible,.button:focus-visible,a:focus-visible,summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
a { color: var(--brand-ink); }
input,textarea,select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--surface); color: var(--ink); min-width: 0; }
textarea { min-height: 120px; resize: vertical; }
label { display: block; margin: 12px 0; color: var(--ink); font-size: 13px; }
label input,label select,label textarea { margin-top: 5px; }
input[type=checkbox] { width: auto; margin-right: 8px; accent-color: var(--brand); }
input:focus,textarea:focus,select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
aside { width: 224px; position: fixed; inset: 0 auto 0 0; background: var(--surface); border-right: 1px solid var(--line); padding: 28px 18px; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 650; margin-bottom: 28px; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: #ff2442; display: grid; place-items: center; }
.brand-mark img { display: block; width: 34px; height: 34px; filter: brightness(0) invert(1); }
.brand small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 1.5px; }
.team { padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; border-radius: 9px; margin-bottom: 25px; overflow-wrap: anywhere; }
nav { display: grid; gap: 4px; }
nav button { text-align: left; border: 0; background: transparent; padding: 11px 13px; color: var(--muted); font-size: 13px; }
nav button:hover { background: var(--bg); color: var(--ink); }
nav button.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; box-shadow: inset 3px 0 var(--brand); }
.foot { margin-top: auto; padding-top: 24px; font-size: 11px; color: var(--muted); }
.shell { margin-left: 224px; min-width: 0; }
header { min-height: 76px; border-bottom: 1px solid var(--line); background: var(--surface); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
header small { color: var(--muted); }
main { max-width: 1440px; margin: auto; padding: 32px; }
.sub { color: var(--muted); margin: 10px 0 26px; font-size: 13px; }
.panel { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 22px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.grid > .panel:first-child { border-color: light-dark(#f2bdc8, #653342); background: var(--brand-soft); }
.grid > .panel:first-child .metric { color: var(--brand-ink); }
.two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.tag { font-size: 12px; background: var(--brand-soft); color: var(--brand-ink); padding: 3px 8px; border-radius: 5px; display: inline-block; }
.status-success { background: var(--success-bg); color: var(--success); }
.status-pending { background: var(--pending-bg); color: var(--pending); }
.status-error { background: var(--error-bg); color: var(--error); }
.status-neutral { background: var(--bg); color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.note { padding: 12px 16px; background: var(--pending-bg); color: var(--pending); border-radius: 8px; font-size: 13px; margin-bottom: 20px; }
.note.status-success { background: var(--success-bg); color: var(--success); }
.note.status-neutral { background: var(--bg); color: var(--muted); }
.error,.note.status-error { color: var(--error); background: var(--error-bg); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.metric { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(270px,100%),1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; background: var(--surface); min-width: 0; }
.card h3,.card p,.note,.sub { overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 8px; overflow: auto; margin: 12px 0; }
.thumbs img { width: 88px; height: 116px; object-fit: cover; border-radius: 6px; }
.thumbs a { display: block; flex: 0 0 auto; }
.images { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 12px; }
.images img { width: 100%; border-radius: 5px; border: 1px solid var(--line); }
.images a { display: block; min-width: 0; }
.compare { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 15px; }
.compare .images { grid-template-columns: 1fr; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; line-height: 1.8; background: var(--bg); padding: 15px; border-radius: 8px; max-height: 500px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
details { border-top: 1px solid var(--line); padding-top: 12px; margin: 16px 0; }
summary { cursor: pointer; font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td,th { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 500; }
.scroll { overflow: auto; }
.scroll table { min-width: 620px; }
.login { max-width: 480px; margin: 8vh auto; }
.login .brand { margin: 0 0 30px; }
.login main { padding: 24px; }
.login .primary { width: 100%; margin-top: 12px; }
.login .muted { margin: 18px 0 0; font-size: 12px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
#toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: light-dark(#29292f, #efeff3); color: light-dark(#fff, #252529); padding: 12px 22px; border-radius: 8px; z-index: 99; max-width: 90%; display: none; }
.checks { padding: 8px 15px; background: var(--bg); border-radius: 8px; }
.nowrap { white-space: nowrap; }
body[data-busy=true]::before { content: '正在保存…'; position: fixed; top: 0; left: 0; right: 0; background: var(--brand); color: #fff; text-align: center; padding: 4px; z-index: 100; font-size: 12px; }
@media(max-width:1100px) { .grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:900px) {
  aside { width: 188px; padding: 22px 12px; }
  .shell { margin-left: 188px; }
  main { padding: 24px; }
  .two { grid-template-columns: minmax(0,1fr); }
  header { padding: 12px 24px; }
  .brand { font-size: 18px; gap: 8px; }
  .brand small { font-size: 9px; letter-spacing: 1px; }
}
@media(max-width:620px) {
  aside { position: static; width: auto; padding: 18px; }
  .brand { margin-bottom: 16px; }
  .team,.foot { display: none; }
  nav { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
  nav button { text-align: center; padding: 10px 4px; font-size: 12px; }
  .shell { margin: 0; }
  header { min-height: 0; padding: 12px 18px; }
  main { padding: 24px 15px; }
  .panel { padding: 18px; }
  .grid { gap: 12px; }
  .grid > .panel { padding: 16px; }
  .metric { font-size: 28px; }
  h1 { font-size: 24px; }
  .compare { gap: 8px; }
  .title-row { display: block; }
  .images { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .login { margin: 5vh 12px; }
  input,textarea,select { font-size: 16px; }
}
@media(pointer:coarse) { button,.button { min-height: 44px; } }
