:root {
  --ink: #111216;
  --muted: #686d75;
  --line: #dedfdf;
  --paper: #f2f3f4;
  --surface: #fff;
  --orange: #ff4817;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-height: 64px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.admin-top strong {
  margin-right: 14px;
  font-size: 24px;
}

.admin-top span {
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions a,
.actions button,
.panel-title button,
.card-actions button,
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.actions button {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.admin-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h1 {
  margin: 0;
  font-size: 24px;
}

.panel-hint {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
}

.category-editor,
.product-editor {
  display: grid;
  gap: 14px;
}

.edit-card {
  border: 1px solid var(--line);
  background: #fbfbfa;
  padding: 16px;
}

.edit-card .edit-mode {
  display: none;
}

.edit-card.is-editing .view-mode {
  display: none;
}

.edit-card.is-editing .edit-mode {
  display: block;
}

.summary-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.summary-head button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.summary-head button:hover,
.panel-title button:hover,
.actions a:hover {
  background: var(--ink);
  color: #fff;
}

.summary-title {
  display: block;
  margin-bottom: 7px;
  font-size: 22px;
  line-height: 1.2;
}

.summary-meta {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.summary-text,
.summary-position {
  margin: 12px 0 0;
  color: #333840;
  font-size: 14px;
  line-height: 1.7;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-grid span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: #333840;
  font-size: 13px;
  font-weight: 800;
}

.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row.compact {
  grid-template-columns: minmax(0, 1fr) 100px;
}

.card-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.card-actions button {
  min-width: 74px;
}

.card-actions .primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.card-actions .secondary {
  border-color: var(--ink);
  color: var(--ink);
}

.card-actions .danger {
  border-color: #b92a12;
  color: #b92a12;
}

.image-area {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.image-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.upload-button input {
  display: none;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 12px;
}

.image-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.image-item img {
  width: 100%;
  height: 88px;
  object-fit: contain;
}

.image-item button {
  min-height: 30px;
  border: 1px solid #b92a12;
  background: transparent;
  color: #b92a12;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .row,
  .row.two {
    grid-template-columns: 1fr;
  }
}
