:root {
  --bg: #f4efe5;
  --bg-strong: #ead8ba;
  --surface: rgba(255, 250, 241, 0.92);
  --surface-strong: #fff7ea;
  --line: rgba(57, 51, 43, 0.12);
  --ink: #201c18;
  --muted: #6a6157;
  --accent: #0d7f55;
  --accent-strong: #09583b;
  --accent-soft: rgba(13, 127, 85, 0.12);
  --warn: #a63d27;
  --success: #166847;
  --shadow: 0 24px 80px rgba(37, 26, 7, 0.16);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  background:
    radial-gradient(circle at top left, rgba(242, 184, 86, 0.34), transparent 28%),
    radial-gradient(circle at bottom right, rgba(13, 127, 85, 0.22), transparent 34%),
    linear-gradient(180deg, #f7f2e9 0%, #efe4d1 100%);
  color: var(--ink);
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Avenir Next", "Trebuchet MS", sans-serif;
}

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

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 247, 234, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f5bb53, #0d7f55);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy small,
.auth-hint,
.section-note,
.photo-meta span {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--accent-soft);
}

.profile-label,
.eyebrow,
.person-id,
.panel-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

.messages {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.message {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.message.success {
  background: rgba(22, 104, 71, 0.12);
}

.message.error {
  background: rgba(166, 61, 39, 0.12);
}

.message.warning {
  background: rgba(245, 187, 83, 0.18);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 28px;
}

.hero-copy,
.hero-panel,
.stat-card,
.person-card,
.empty-state,
.detail-sidebar,
.photo-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 42px;
  border-radius: var(--radius-xl);
}

.hero-copy h1,
.section-head h1,
.section-head h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  line-height: 0.98;
}

.hero-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 5vw, 5rem);
}

.hero-text {
  max-width: 56ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.hero-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.metric-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0 18px;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(32, 28, 24, 0.08);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d7f55 0%, #f5bb53 100%);
  transition: width 0.35s ease;
}

.meta-grid {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
}

.meta-grid dt {
  margin-bottom: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.meta-grid dd {
  margin: 0;
  font-weight: 600;
}

.stats-section {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0 0;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-lg);
}

.stat-card span {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 42px 0 20px;
}

.section-head.compact {
  align-items: center;
}

.section-head.narrow {
  margin: 0 0 20px;
}

.dataset-section {
  margin-top: 24px;
}

.dataset-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.94), rgba(255, 252, 246, 0.88));
  box-shadow: var(--shadow);
}

.dataset-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}

.dataset-meta dt {
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.dataset-meta dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field label {
  font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="file"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(32, 28, 24, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  font: inherit;
}

.form-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form {
  margin-top: 12px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.person-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.person-preview {
  display: block;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, rgba(13, 127, 85, 0.14), rgba(245, 187, 83, 0.22));
}

.person-preview img,
.detail-preview img,
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-body {
  padding: 18px;
}

.person-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.person-heading h3 {
  margin: 6px 0 0;
  font-size: 1.35rem;
}

.count-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(32, 28, 24, 0.06);
  font-size: 0.88rem;
}

.status-pill.accent {
  background: rgba(245, 187, 83, 0.24);
}

.status-pill.success {
  background: rgba(22, 104, 71, 0.18);
}

.status-pill.danger {
  background: rgba(166, 61, 39, 0.18);
}

.inline-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent-strong);
  font-weight: 600;
}

.empty-state {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 20px;
}

.detail-sidebar {
  padding: 20px;
  border-radius: var(--radius-xl);
  align-self: start;
}

.detail-preview {
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(13, 127, 85, 0.16), rgba(245, 187, 83, 0.22));
}

.rename-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.rename-form label {
  font-weight: 600;
}

.rename-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(32, 28, 24, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.photo-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.photo-card a {
  display: block;
  aspect-ratio: 4 / 3;
  background: rgba(32, 28, 24, 0.06);
}

.photo-meta {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.placeholder-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.placeholder-face.large {
  font-size: 1.1rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #0a9a65 100%);
  color: #fff;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(32, 28, 24, 0.12);
}

@media (max-width: 1080px) {
  .hero,
  .detail-layout,
  .stats-section {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .hero-copy,
  .hero-panel {
    padding: 24px;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: 2.5rem;
  }

  .person-heading {
    flex-direction: column;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
