:root {
  color-scheme: light;
  --ink: #21374c;
  --muted: #526478;
  --accent: #324f73;
  --line: #d5dfeb;
  font: 16px/1.55 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
.topbar small { color: var(--muted); }
main { width: min(1030px, calc(100% - 64px)); margin: 0 auto; padding: 28px 0 56px; }
.heading, .dialog-head, .actions, .image-fields, .kind, .catalog-status {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.heading { margin-bottom: 22px; }
h1, h2, h3, p, dl, dt, dd, figure { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.2; color: var(--ink); }
.primary, .secondary, .pick-file {
  min-height: 42px; padding: 9px 17px; border: 1px solid transparent;
  border-radius: 10px; font-weight: 600; font-size: .94rem; line-height: 1.4;
}
.primary { color: #fff; background: var(--accent); }
.primary:hover { background: #233f5d; }
.secondary, .pick-file { background: #fff; color: var(--accent); border-color: #aebfd1; }
.pick-file { display: inline-flex; align-items: center; cursor: pointer; }
.pick-file:hover, .secondary:hover { background: #f1f5fa; }
.item { border: 1px solid #cbd6e3; border-radius: 13px; background: #fff; overflow: hidden; min-width: 0; }
#items { display: grid; gap: 16px; }
.item h2, .item h3 {
  padding: 14px 24px 12px; border-bottom: 1px solid var(--line); background: #fafcfe;
  font-size: 1.32rem; line-height: 1.4; overflow-wrap: anywhere;
}
.item-body { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.3fr); gap: 27px; padding: 16px 24px 19px; }
figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-bottom: 8px; }
figcaption b, dt { font-size: .95rem; font-weight: 650; color: #385673; }
figcaption span, .hint { color: var(--muted); font-size: .875rem; }
.main-image {
  display: grid; place-items: center; height: clamp(165px, 16vw, 205px); overflow: hidden;
  background: #f0f3f5; border: 1px solid #d8dfe6; border-radius: 7px;
}
.main-image img { display: block; height: 100%; width: 100%; max-height: inherit; min-height: 0; object-fit: contain; }
.item figure, .item dl { min-width: 0; }
.details > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); border-bottom: 1px solid #e1e7ec; padding: 10px 0; min-height: 43px; }
.details > div:first-child { padding-top: 2px; }
.details > div:last-child { border-bottom: 0; padding-bottom: 0; }
.details dd { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.62; min-height: 1.62em; }
.strip { display: flex; flex-wrap: wrap; margin-top: 8px; gap: 7px; }
.strip button { padding: 1px; background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.strip button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.strip img { width: 48px; height: 38px; display: block; object-fit: contain; }
.catalog-status { justify-content: flex-start; color: var(--muted); font-size: .9rem; padding-top: 10px; }
.subtle { border: 0; padding: 4px 0; text-decoration: underline; background: transparent; color: var(--accent); }
dialog {
  width: min(700px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); padding: 0 24px 24px;
  border: 1px solid #bfcbd9; border-radius: 16px; color: var(--ink); background: #fff;
  box-shadow: 0 22px 100px #182b4430; overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(29 42 58 / .52); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { padding: 16px 0 12px; }
.dialog-head h2 { font-size: 1.38rem; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: #eff3f7; color: var(--ink); border-radius: 50%; font-size: 1.5rem; }
form { display: grid; gap: 17px; }
.intro { margin-top: -6px; }
.field { display: grid; gap: 5px; min-width: 0; font-weight: 600; font-size: .95rem; }
.field input, .field textarea, .kind select { border: 1px solid #aebdcb; border-radius: 7px; padding: 9px 10px; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 400; }
.field input, .field textarea { width: 100%; min-width: 0; }
.field textarea { resize: vertical; }
.pictures { padding: 10px 14px 12px; border: 1px solid var(--line); border-radius: 9px; margin: 0; min-width: 0; }
.pictures legend { padding: 0 4px; font-size: .95rem; font-weight: 600; }
.image-fields { flex-wrap: wrap; justify-content: flex-start; }
.kind { font-size: .875rem; gap: 7px; }
.kind select { padding: 8px; max-width: 100%; }
.image-fields > div { position: relative; }
.file-input { position: absolute; opacity: 0; height: 1px; width: 1px; inset: 0; }
.image-fields > div:focus-within .pick-file { outline: 2px solid var(--accent); outline-offset: 2px; }
#file-hint { margin: 8px 0 0; }
.selected-files { display: grid; gap: 5px; list-style: none; margin: 8px 0 0; padding: 0; }
.selected-files:empty { margin: 0; }
.selected-files li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .875rem; }
.selected-files img { display: block; width: 42px; height: 42px; object-fit: contain; border-radius: 4px; background: #eff2f4; }
.selected-files span { overflow-wrap: anywhere; }
.selected-files button { height: 38px; }
.form-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.actions { justify-content: flex-end; flex-wrap: wrap; padding-top: 3px; }
.review-hint, #success-step p { margin: 16px 0; }
.error { color: #9c3043; font-size: .9rem; }
.error:not(:empty) { margin: 9px 0; }
#preview-card .item-body { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 18px; padding: 14px; }
#preview-card .details > div { grid-template-columns: 70px minmax(0,1fr); }
@media (max-width: 680px) {
  main { width: calc(100% - 30px); padding-top: 18px; }
  .heading { margin-bottom: 15px; }
  .heading .primary { padding: 8px 12px; }
  .item h2, .item h3 { font-size: 1.2rem; padding: 11px 15px; }
  .item-body, #preview-card .item-body { grid-template-columns: minmax(0,1fr); gap: 15px; padding: 12px 15px 16px; }
  .main-image { height: clamp(180px, 53vw, 255px); }
  .details > div { grid-template-columns: 75px minmax(0,1fr); }
  dialog { padding: 0 16px 17px; }
}
@media (max-width: 450px) {
  .form-pair { grid-template-columns: minmax(0,1fr); }
}
