:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-soft: #eef3ee;
  --text: #1d2522;
  --muted: #5f6d68;
  --border: #d8e0dc;
  --accent: #2f6f67;
  --accent-strong: #245850;
  --accent-soft: #dcebe7;
  --warning: #b05f24;
  --danger: #b42318;
  --success: #1f7a4d;
  --shadow: 0 18px 48px rgba(31, 58, 52, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(47, 111, 103, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(176, 95, 36, 0.08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 32px;
  align-items: center;
  padding: 48px 0;
}

.intro-panel,
.form-panel,
.login-panel,
.table-panel,
.toolbar,
.stat-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.intro-panel {
  min-height: 560px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(145deg, rgba(47, 111, 103, 0.94), rgba(30, 67, 62, 0.94)),
    var(--accent);
  color: #fff;
}

.brand-mark {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 7px 12px;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
}

.intro-panel h1,
.login-panel h1,
.admin-header h1 {
  margin: 22px 0 16px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-panel p,
.login-panel p {
  max-width: 30rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.intro-list {
  display: grid;
  gap: 12px;
  margin-top: 40px;
}

.intro-list span {
  display: block;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  padding-top: 12px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.form-panel {
  padding: 32px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span,
.source-box legend {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.field b,
.source-box b {
  color: var(--warning);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 136px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 103, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: #8a9692;
}

small {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.source-box {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.segmented-control input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.hidden {
  display: none !important;
}

.upload-field {
  margin-bottom: 6px;
  cursor: pointer;
}

.upload-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-surface {
  display: grid;
  gap: 4px;
  min-height: 112px;
  place-items: center;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: center;
}

.upload-surface em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

#image-preview,
.detail-image {
  display: block;
  width: 100%;
  max-height: 280px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.admin-nav a {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:active,
.secondary-button:active,
.admin-nav a:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-button.full {
  width: 100%;
}

.secondary-button,
.admin-nav a {
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--accent);
  border-color: var(--border);
}

.status-success {
  color: var(--success);
  font-weight: 800;
}

.status-error {
  color: var(--danger);
  font-weight: 800;
}

.admin-login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  padding: 32px;
}

.login-panel .brand-mark {
  border-color: var(--border);
  color: var(--accent);
}

.login-panel h1 {
  font-size: 34px;
}

.login-panel p {
  color: var(--muted);
  margin-bottom: 24px;
}

.admin-body {
  background: var(--bg);
}

.admin-header,
.admin-layout {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 0 16px;
}

.admin-header .brand-mark {
  border-color: var(--border);
  color: var(--accent);
}

.admin-header h1 {
  margin: 12px 0 0;
  font-size: 34px;
}

.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-layout {
  display: grid;
  gap: 16px;
  padding-bottom: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat-box {
  padding: 18px;
  box-shadow: none;
}

.stat-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-box strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 240px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  box-shadow: none;
}

.field.compact {
  margin: 0;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 13px;
  font-weight: 900;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f7fbfa;
}

.description-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.empty-cell {
  height: 120px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

dialog {
  width: min(720px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(24, 42, 38, 0.24);
}

dialog::backdrop {
  background: rgba(13, 26, 23, 0.42);
}

.detail-panel {
  position: relative;
  padding: 26px;
}

.icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.detail-panel h2 {
  margin: 0 44px 18px 0;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 900;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 840px) {
  .site-shell {
    grid-template-columns: 1fr;
    padding: 24px 0;
  }

  .intro-panel {
    min-height: auto;
    padding: 28px;
  }

  .intro-list {
    margin-top: 28px;
  }

  .field-grid,
  .stats-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .site-shell,
  .admin-header,
  .admin-layout {
    width: min(100% - 20px, 1220px);
  }

  .form-panel,
  .login-panel {
    padding: 20px;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .primary-button {
    width: 100%;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
