:root {
  --ink: #102033;
  --muted: #647084;
  --line: #dfe5ee;
  --soft: #f5f7fa;
  --brand: #0f766e;
  --danger: #b42318;
  --white: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: var(--soft);
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  background: var(--white);
  border: 1px solid var(--line);
}

.login-card h1 {
  margin: 0 0 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 12px 13px;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  background: var(--white);
}

input[type="checkbox"] {
  width: auto;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  background: var(--brand);
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}

.button.muted {
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  background: var(--ink);
  color: var(--white);
}

.admin-header strong,
.admin-header span {
  display: block;
}

.admin-header span {
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
}

.admin-header nav {
  display: flex;
  gap: 12px;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 60px;
}

.panel {
  margin-bottom: 22px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  scroll-margin-top: 96px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-note,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.form-note {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.checkbox-label {
  align-content: start;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding-top: 28px;
}

.checkbox-label.compact {
  margin-top: 10px;
  padding-top: 0;
  font-size: 13px;
  font-weight: 700;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  font-weight: 700;
}

.alert.success {
  color: #05603a;
  background: #ecfdf3;
  border: 1px solid #abefc6;
}

.alert.error {
  color: var(--danger);
  background: #fff1f3;
  border: 1px solid #fecdca;
}

.product-table {
  display: grid;
  gap: 12px;
}

.user-table,
.category-table,
.inquiry-table {
  display: grid;
  gap: 12px;
}

.user-table article,
.category-table article,
.inquiry-table article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
}

.user-table strong,
.user-table span,
.user-table small,
.category-table strong,
.category-table span,
.category-table small,
.inquiry-table strong,
.inquiry-table span,
.inquiry-table small {
  display: block;
}

.user-table span,
.user-table small,
.category-table span,
.category-table small,
.inquiry-table span,
.inquiry-table small {
  margin-top: 5px;
  color: var(--muted);
}

.inquiry-table small {
  max-width: 680px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.product-table article {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
}

.product-table img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  background: var(--soft);
}

.product-table strong,
.product-table span,
.product-table small {
  display: block;
}

.product-table span,
.product-table small {
  margin-top: 5px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.product-form {
  display: grid;
  gap: 20px;
}

.media-fields,
.two-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.preview {
  display: block;
  width: 180px;
  height: 130px;
  margin-bottom: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gallery-choice {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.gallery-choice:has(input:checked) {
  border-color: var(--brand);
  background: #ecfdf3;
}

.gallery-choice input {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 18px;
  height: 18px;
  margin: 0;
}

.gallery-choice img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.gallery-choice span {
  color: var(--muted);
  line-height: 1.3;
}

@media (max-width: 760px) {
  .admin-header,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid-form,
  .media-fields,
  .two-columns,
  .user-table article,
  .category-table article,
  .inquiry-table article,
  .product-table article {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }
}
