:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #162033;
  --muted: #6b7688;
  --line: #dfe5ef;
  --primary: #246bff;
  --primary-soft: #eaf1ff;
  --success: #16a34a;
  --success-soft: #e8f8ee;
  --warning: #d97706;
  --warning-soft: #fff4e8;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --shadow: 0 14px 36px rgba(17, 24, 39, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f7f9fd 0%, var(--bg) 100%);
  color: var(--text);
}

.hidden {
  display: none !important;
}

a { color: inherit; }
button, input, textarea, select {
  font: inherit;
}
button {
  cursor: pointer;
}

.container {
  width: min(1120px, calc(100% - 28px));
  margin: 28px auto 40px;
}
.container.narrow {
  width: min(860px, calc(100% - 24px));
}

.hero-card,
.panel,
.notice,
.summary-card,
.detail-card,
.login-card,
.record-card {
  background: var(--card);
  border: 1px solid rgba(223, 229, 239, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 5vw, 38px);
}

.hero-desc {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-badge,
.status-badge,
.small-badge {
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.hero-badge {
  padding: 10px 14px;
  color: var(--primary);
  background: var(--primary-soft);
}

.panel,
.login-card,
.summary-card,
.detail-card,
.record-card {
  padding: 22px;
}

.form-stack,
.login-form,
.toolbar,
.detail-content,
.record-list,
.summary-grid,
.photo-grid,
.stats-row,
.info-grid,
.inline-actions {
  display: grid;
  gap: 16px;
}

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

.field {
  display: grid;
  gap: 8px;
}
.field > span {
  font-size: 14px;
  font-weight: 700;
}
.field.invalid input,
.field.invalid textarea,
.field.invalid select {
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}
.field.invalid input[type="range"] {
  box-shadow: none;
}
.field-error {
  margin-top: -2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--danger);
}
.range-control {
  display: grid;
  gap: 10px;
}
.range-control input[type="range"] {
  width: 100%;
  padding: 0;
  border: none;
  box-shadow: none;
  accent-color: var(--primary);
}
.range-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.range-value {
  justify-self: center;
  font-size: 16px;
  color: var(--primary);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(36, 107, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(36, 107, 255, 0.12);
}

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

.section-title-row,
.toolbar,
.page-head,
.record-row,
.status-row,
.detail-head,
.login-head,
.card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.section-title-row h2,
.detail-head h2,
.page-head h2,
.login-head h2,
.card-head h3 {
  margin-bottom: 0;
}

.subsection {
  border-top: 1px solid #edf1f7;
  padding-top: 18px;
}

.people-list {
  display: grid;
  gap: 14px;
}

.person-card,
.empty-state-box,
.empty-state,
.photo-item,
.info-item,
.soft-box {
  border-radius: 16px;
  border: 1px solid #ebeff6;
  background: #fafcff;
}

.person-card,
.empty-state-box,
.empty-state,
.soft-box {
  padding: 16px;
}

.empty-state-box,
.empty-state {
  color: var(--muted);
}

.upload-box {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 112px;
  padding: 18px;
  border: 1.5px dashed #bfd0f9;
  background: #f7faff;
  border-radius: 18px;
  color: var(--primary);
  font-weight: 700;
}
.upload-box.upload-box-error {
  border-color: rgba(220, 38, 38, 0.7);
  background: #fff7f7;
  color: var(--danger);
}

.upload-box input {
  display: none;
}

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.photo-item {
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #edf2ff;
}

.photo-item figcaption {
  padding: 10px 12px 12px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.actions,
.inline-actions,
.status-actions,
.mobile-stack {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(223, 229, 239, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.btn.success {
  background: var(--success-soft);
  color: var(--success);
}
.btn.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice {
  margin-top: 18px;
  padding: 15px 18px;
  line-height: 1.6;
}
.notice.hidden {
  display: none;
}
.notice.info {
  color: var(--primary);
  background: #f4f8ff;
}
.notice.success {
  color: var(--success);
  background: var(--success-soft);
}
.notice.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}

.page-admin .layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card h3 {
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--muted);
}
.summary-card strong {
  font-size: 30px;
}

.record-list {
  margin-top: 18px;
}

.record-card {
  padding: 16px 18px;
}

.record-row {
  align-items: flex-start;
}

.record-title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 6px;
}

.record-meta,
.info-grid {
  color: var(--muted);
  line-height: 1.7;
}

.status-badge {
  padding: 8px 12px;
}
.status-pending {
  color: var(--warning);
  background: var(--warning-soft);
}
.status-approved {
  color: var(--success);
  background: var(--success-soft);
}
.status-rejected {
  color: var(--danger);
  background: var(--danger-soft);
}

.detail-card {
  position: sticky;
  top: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.info-item {
  padding: 14px;
}
.info-item .label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.info-item .value {
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.people-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.people-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f3f6fb;
  color: #304055;
  font-size: 13px;
}

.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.detail-photos a {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #edf1f7;
  background: #fff;
}
.detail-photos img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(480px, 100%);
}

code.inline {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f6fb;
}

@media (max-width: 980px) {
  .page-admin .layout,
  .summary-grid,
  .grid.two,
  .grid.three,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .detail-card {
    position: static;
  }

  .hero-card,
  .section-title-row,
  .toolbar,
  .page-head,
  .record-row,
  .status-row,
  .detail-head,
  .login-head,
  .card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .container,
  .container.narrow {
    width: min(100% - 16px, 100%);
    margin: 16px auto 30px;
  }

  .hero-card,
  .panel,
  .login-card,
  .summary-card,
  .detail-card,
  .record-card,
  .notice {
    border-radius: 16px;
    padding: 16px;
  }

  .btn {
    width: 100%;
  }

  .actions,
  .inline-actions,
  .status-actions,
  .mobile-stack {
    flex-direction: column;
  }
}

/* Summary row for record list stats */
.summary-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.summary-row span {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f6fb;
}

.divider {
  border: none;
  border-top: 1px solid #edf1f7;
  margin: 14px 0;
}
