:root {
  --bg: #f7f1e5;
  --surface: rgba(255, 251, 244, 0.84);
  --surface-strong: rgba(255, 248, 238, 0.96);
  --text: #2c1b12;
  --muted: #6d564b;
  --accent: #c96a2b;
  --accent-dark: #8d4126;
  --accent-soft: #f2d0a9;
  --line: rgba(64, 35, 21, 0.12);
  --shadow: 0 28px 90px rgba(73, 41, 20, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 106, 43, 0.24), transparent 28%),
    radial-gradient(circle at right center, rgba(246, 201, 123, 0.2), transparent 24%),
    linear-gradient(165deg, #fbf4e8 0%, #f3e3ce 48%, #f0eadf 100%);
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero,
.search-layout {
  position: relative;
}

.hero {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
  align-items: end;
  padding: 1rem 0 2rem;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 -0.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(64, 35, 21, 0.15), transparent);
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.04;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.2rem, 9vw, 6.4rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
}

h3 {
  font-size: 1.35rem;
}

.lede,
.panel-copy,
.search-feedback p,
.callout p,
.pig-card-copy,
.pig-card-hint {
  color: var(--muted);
}

.lede {
  max-width: 64ch;
  margin: 1rem 0 0;
  font-size: 1.13rem;
}

.hero-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: flex-end;
  align-items: center;
}

.hero-nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: flex-end;
}

.auth-state-hero {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.8);
  border: 1px solid rgba(64, 35, 21, 0.1);
}

.search-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.3fr);
  align-items: start;
  margin-top: 1.8rem;
}

.panel,
.results-shell {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.panel {
  padding: 1.5rem;
}

.finder-panel {
  position: sticky;
  top: 1rem;
}

.panel-heading {
  margin-bottom: 0.75rem;
}

.panel-copy {
  margin: 0 0 1rem;
}

.finder-form,
.finder-row {
  display: flex;
  gap: 0.85rem;
}

.finder-form {
  flex-direction: column;
}

label {
  color: var(--muted);
  font-size: 0.96rem;
}

.field-group {
  color: var(--muted);
  font-size: 0.96rem;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(64, 35, 21, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

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

.field-hint {
  display: block;
  margin: 0.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 0.25rem;
  border: 1px solid rgba(64, 35, 21, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.password-field input {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.password-field input:focus {
  outline: 0;
}

.password-toggle {
  align-self: center;
  min-width: 4.8rem;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(141, 65, 38, 0.18);
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.88);
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.password-toggle:hover {
  border-color: rgba(141, 65, 38, 0.36);
  background: rgba(242, 208, 169, 0.72);
  transform: translateY(-1px);
}

.password-toggle[aria-pressed="true"] {
  background: var(--accent-dark);
  color: #fffaf4;
  border-color: var(--accent-dark);
}

input:focus,
select:focus,
textarea:focus,
.password-toggle:focus {
  outline: 2px solid rgba(201, 106, 43, 0.22);
  outline-offset: 2px;
}

input.is-field-invalid,
textarea.is-field-invalid {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.field-error {
  display: block;
  margin: -0.35rem 0 0.2rem;
  color: #9f1c14;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.field-error:empty {
  display: none;
}

.password-field:focus-within {
  outline: 2px solid rgba(201, 106, 43, 0.22);
  outline-offset: 2px;
  border-color: rgba(201, 106, 43, 0.36);
  background: rgba(255, 255, 255, 0.92);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fffaf4;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: #b95d21;
}

.button-secondary {
  background: var(--accent-dark);
}

.button-ghost {
  border: 1px solid rgba(64, 35, 21, 0.14);
  background: rgba(255, 252, 247, 0.7);
  color: var(--text);
}

.button-danger {
  background: #9f2f23;
}

.button-danger:hover {
  background: #82251c;
}

.text-button {
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.text-button:hover,
.text-button:focus {
  color: var(--accent);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.status-panel {
  margin-top: 1.25rem;
  padding: 1.15rem;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(64, 35, 21, 0.08);
}

.status-list {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.status-list li + li {
  margin-top: 0.55rem;
}

.results-column {
  display: grid;
  gap: 1.5rem;
}

.results-shell {
  min-height: 360px;
  padding: 1rem;
}

.mobile-search-again {
  display: none;
  margin-bottom: 0.75rem;
}

.search-feedback {
  display: grid;
  place-items: start;
  min-height: 320px;
  padding: 1.25rem;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 250, 243, 0.95), rgba(247, 231, 210, 0.8)),
    linear-gradient(45deg, transparent, rgba(201, 106, 43, 0.04));
}

.search-feedback h3 {
  margin-bottom: 0.6rem;
}

.pig-results {
  display: grid;
  gap: 1rem;
}

.pig-card {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid rgba(64, 35, 21, 0.08);
}

.pig-card-image {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  border-radius: 20px;
  background: #eadccf;
}

.pig-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pig-card-kicker {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pig-card-copy {
  margin: 0;
  font-size: 1rem;
}

.pig-card-meta {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

.pig-card-meta div {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 244, 230, 0.9);
}

.pig-card-meta dt {
  font-size: 0.76rem;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.pig-card-meta dd {
  margin: 0.45rem 0 0;
}

.pig-card-actions {
  display: grid;
  gap: 0.65rem;
}

.pig-card-hint {
  margin: 0;
  font-size: 0.92rem;
}

.pig-card-user-context {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(64, 35, 21, 0.1);
  background: rgba(255, 252, 247, 0.78);
}

.pig-card-user-context p {
  margin: 0;
}

.tag-result-summary {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  margin: 1rem 0;
  padding: 0.85rem;
  border: 1px solid rgba(64, 35, 21, 0.1);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.82);
}

.tag-result-summary img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 14px;
  background: #eadccf;
}

.tag-result-summary p {
  margin: 0.25rem 0 0;
}

.pig-profile-shell {
  display: grid;
  gap: 1.5rem;
}

.pig-profile-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: stretch;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.pig-profile-photo {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 360px;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  background: #eadccf;
}

.pig-profile-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 1rem;
  overflow-wrap: anywhere;
}

.pig-profile-copy .subpage-title {
  max-width: 14ch;
}

.pig-profile-copy .pig-card-meta {
  margin: 1.5rem 0;
}

.profile-discovery-copy {
  margin: 0.8rem 0 0;
  color: var(--accent-dark);
  font-weight: 600;
}

#profile-journal-layout {
  grid-template-columns: 1fr;
}

#profile-journal-panel {
  order: 1;
}

#profile-possession-panel {
  order: 2;
  position: static;
}

.journal-form-panel {
  max-width: 820px;
}

.journal-success-panel {
  display: grid;
  gap: 1rem;
  max-width: 820px;
  border-color: rgba(141, 65, 38, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.96), rgba(246, 222, 194, 0.82)),
    var(--surface-strong);
}

.journal-auth-prompt {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid rgba(141, 65, 38, 0.16);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.76);
}

.journal-auth-prompt h3,
.journal-auth-prompt p {
  margin: 0;
}

.journal-auth-prompt p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.journal-form-panel label {
  color: var(--accent-dark);
  font-weight: 700;
}

.journal-form-panel input,
.journal-form-panel textarea {
  margin-top: 0.3rem;
}

.journal-photo-preview-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid rgba(141, 65, 38, 0.16);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.78);
}

.journal-photo-preview-copy h3,
.journal-photo-preview-copy p {
  margin: 0;
}

.journal-photo-preview-copy p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.journal-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
}

.journal-photo-preview {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.journal-photo-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(64, 35, 21, 0.1);
  background: #eadccf;
}

.journal-photo-preview figcaption {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.88rem;
}

.journal-photo-preview-panel .button.is-confirmed {
  background: #4f7f45;
}

.journal-photo-source-actions {
  margin-top: -0.35rem;
}

#journal-photo-input-panel.is-field-invalid .selected-photo-list,
.selected-photo-list.is-field-invalid {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.journal-existing-photos-panel {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid rgba(64, 35, 21, 0.1);
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.72);
}

.journal-existing-photos-panel h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1rem;
}

.replacement-photo-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.journal-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.post-journal-focus-message {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(79, 127, 69, 0.24);
  border-radius: 12px;
  background: rgba(238, 248, 230, 0.84);
  color: #345c2d;
  font-weight: 700;
}

.journal-entry {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.66);
}

.journal-entry.is-post-journal-focus {
  border-color: rgba(79, 127, 69, 0.34);
  background: rgba(247, 252, 240, 0.9);
  box-shadow: 0 0 0 3px rgba(79, 127, 69, 0.12);
}

.journal-entry.is-post-journal-focus:focus {
  outline: 3px solid rgba(79, 127, 69, 0.28);
  outline-offset: 3px;
}

.journal-entry p {
  margin: 0;
}

.journal-entry-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.journal-location {
  color: var(--accent-dark);
  font-weight: 600;
}

.journal-photos {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.journal-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
}

.journal-photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: zoom-in;
}

.journal-photo-button:focus {
  outline: 3px solid rgba(201, 106, 43, 0.36);
  outline-offset: 3px;
}

.photo-viewer-open {
  overflow: hidden;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.photo-viewer[hidden] {
  display: none;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 8, 0.82);
}

.photo-viewer-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 1120px);
  height: min(100%, 820px);
}

.photo-viewer-figure {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.photo-viewer-image {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.photo-viewer-count {
  color: #fffaf4;
  font-size: 0.95rem;
}

.photo-viewer-close,
.photo-viewer-nav {
  border: 1px solid rgba(255, 250, 244, 0.32);
  background: rgba(255, 250, 244, 0.12);
  color: #fffaf4;
  cursor: pointer;
  font: inherit;
}

.photo-viewer-close:hover,
.photo-viewer-nav:hover,
.photo-viewer-close:focus,
.photo-viewer-nav:focus {
  background: rgba(255, 250, 244, 0.24);
  outline: 2px solid rgba(255, 250, 244, 0.62);
  outline-offset: 2px;
}

.photo-viewer-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.8rem;
  line-height: 1;
}

.photo-viewer-nav {
  width: 48px;
  height: 64px;
  border-radius: 999px;
  font-size: 2.6rem;
  line-height: 1;
}

.callout {
  background:
    linear-gradient(150deg, rgba(255, 247, 236, 0.95), rgba(240, 216, 191, 0.82)),
    linear-gradient(120deg, rgba(201, 106, 43, 0.06), transparent);
}

.possession-toggle {
  display: none;
  margin-bottom: 1rem;
}

.is-post-journal-focus .possession-toggle {
  display: inline-flex;
}

.callout p {
  margin: 0.8rem 0 0;
}

.callout-actions,
.auth-actions,
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.callout-actions {
  margin-top: 1rem;
}

.shell-narrow {
  width: min(760px, calc(100% - 1rem));
}

.shell-wide {
  width: min(1320px, calc(100% - 2rem));
}

.subpage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.back-link,
.auth-links a {
  color: var(--accent-dark);
  text-decoration: none;
}

.auth-state {
  margin: 0;
  color: var(--muted);
}

.auth-state a {
  color: inherit;
  text-decoration: none;
}

.auth-state a:hover,
.auth-state a:focus {
  color: var(--accent-dark);
  text-decoration: underline;
}

.auth-panel {
  display: grid;
  gap: 1rem;
}

.subpage-title {
  max-width: 16ch;
  font-size: clamp(2.7rem, 8vw, 4.4rem);
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-form-compact {
  margin-top: 0.75rem;
}

.auth-message,
.profile-copy,
.form-note,
.policy-content p {
  margin: 0;
  color: var(--muted);
}

.form-note {
  font-size: 0.95rem;
  line-height: 1.45;
}

.form-note a,
.policy-content a,
.site-footer a {
  color: var(--accent-dark);
}

.policy-page {
  gap: 1.2rem;
}

.policy-content {
  display: grid;
  gap: 1.25rem;
}

.policy-content section {
  display: grid;
  gap: 0.55rem;
}

.policy-content h2 {
  font-size: 1.45rem;
}

.policy-content p {
  line-height: 1.55;
}

.site-footer {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(64, 35, 21, 0.12);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  text-decoration: underline;
}

.verification-panel,
.profile-card {
  padding: 1.2rem;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(64, 35, 21, 0.08);
}

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

.account-delete-card {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
  border-color: rgba(159, 47, 35, 0.22);
}

.account-delete-card strong {
  color: var(--text);
}

.profile-history {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.profile-history-header {
  display: grid;
  gap: 0.35rem;
}

.profile-pig-list {
  display: grid;
  gap: 1rem;
}

.profile-pig-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(64, 35, 21, 0.08);
}

.profile-pig-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  background: #eadccf;
}

.profile-pig-card h2 {
  font-size: 1.55rem;
}

.profile-pig-card .profile-copy + .profile-copy {
  margin-top: 0.5rem;
}

.profile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.profile-return-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
}

.profile-return-panel h2 {
  font-size: 1.55rem;
}

.profile-return-panel h2,
.profile-return-panel p {
  margin: 0;
}

.profile-return-panel p {
  margin-top: 0.35rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 36px;
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(201, 106, 43, 0.12);
  color: var(--accent-dark);
}

.admin-shell {
  display: grid;
  gap: 1.5rem;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.admin-summary-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 1rem;
  padding: 0.25rem 0;
}

.admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.admin-summary-tile {
  min-height: 118px;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-summary-tile p,
.admin-summary-tile span {
  margin: 0;
  color: var(--muted);
}

.admin-summary-tile strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 2rem;
  line-height: 1;
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

.admin-pig-editor-panel {
  order: 1;
}

.admin-pig-list-panel {
  order: 3;
}

.admin-user-editor-panel {
  order: 2;
}

.admin-user-list-panel {
  order: 4;
}

.admin-wide-panel {
  order: 5;
}

.admin-wide-panel {
  grid-column: 1 / -1;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.45fr);
  gap: 0.85rem;
  align-items: end;
}

.admin-location-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-location-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.72);
}

.admin-location-item.is-retired {
  opacity: 0.72;
}

.admin-location-item h3,
.admin-location-item p {
  margin: 0;
}

.location-suggestion-list {
  display: grid;
  gap: 0.45rem;
  margin-top: -0.45rem;
  margin-bottom: 0.85rem;
}

.location-suggestion-list[hidden] {
  display: none;
}

.location-suggestion-option {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.location-suggestion-option:hover,
.location-suggestion-option:focus {
  border-color: var(--accent);
  outline: none;
}

.location-suggestion-option span {
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.admin-table th,
.admin-table td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--accent-dark);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-table-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.admin-inline-button {
  min-height: 40px;
  padding: 0.55rem 0.9rem;
}

.admin-journal-list {
  display: grid;
  gap: 1rem;
}

.admin-journal-entry {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 251, 244, 0.74);
}

.admin-journal-entry.is-hidden {
  background: rgba(64, 35, 21, 0.06);
}

.admin-journal-entry-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.admin-journal-entry h3 {
  margin: 0;
  font-size: 1.2rem;
}

.admin-journal-entry p {
  margin: 0;
}

.admin-journal-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.admin-journal-photo {
  display: block;
  width: 88px;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.admin-journal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

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

.credential-label {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.credential-value {
  overflow-wrap: anywhere;
  min-height: 2.4rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 251, 244, 0.74);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.qr-code {
  display: inline-grid;
  min-width: 176px;
  min-height: 176px;
  place-items: center;
  margin: 0 0 0.75rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.qr-code canvas {
  width: 176px;
  height: 176px;
}

.table-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-dark);
  font-size: 0.82rem;
}

.table-select-all input,
.admin-table input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.admin-bulk-actions,
.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.print-materials-panel {
  align-content: start;
}

.print-materials-controls {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) repeat(auto-fit, minmax(130px, max-content));
  gap: 0.85rem 1rem;
  align-items: end;
}

.print-material-sheet {
  display: grid;
  gap: 0.16in;
  justify-content: start;
  align-items: start;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.material-sheet-2 {
  grid-template-columns: repeat(auto-fill, minmax(2in, 2in));
}

.material-sheet-1 {
  grid-template-columns: repeat(auto-fill, minmax(1in, 1in));
}

.print-material-card {
  position: relative;
  overflow: hidden;
  width: 2in;
  height: 2in;
  padding: 0.12in;
  border: 1px dashed rgba(44, 27, 18, 0.58);
  background: #fff;
  color: #20120b;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.1;
  break-inside: avoid;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.material-card-no-border {
  border-color: transparent;
}

.material-punch-guide {
  position: absolute;
  top: 0.12in;
  left: 0.12in;
  width: 0.28in;
  height: 0.28in;
  border: 1px dashed rgba(44, 27, 18, 0.54);
  border-radius: 999px;
  background: transparent;
}

.material-card-no-punch .material-punch-guide {
  display: none;
}

.material-card-content {
  display: grid;
  grid-template-rows: 0.36in minmax(0, 1fr) 0.2in;
  gap: 0.05in;
  height: 100%;
}

.material-card-title {
  min-width: 0;
  margin: 0 0 0 0.42in;
  overflow: hidden;
  font-size: 0.15in;
  font-weight: 700;
  line-height: 0.18in;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card-title-placeholder {
  visibility: hidden;
}

.material-card-main {
  display: grid;
  grid-template-columns: 0.96in minmax(0, 1fr);
  gap: 0.08in;
  align-items: center;
  min-height: 0;
}

.material-card-qr {
  display: grid;
  place-items: center;
  width: 0.94in;
  height: 0.94in;
  background: #fff;
}

.material-card-qr canvas,
.material-card-qr img {
  width: 100% !important;
  height: 100% !important;
}

.material-card-copy {
  min-width: 0;
}

.material-card-copy p,
.material-card-footer p {
  margin: 0;
}

.material-card-primary {
  font-size: 0.15in;
  font-weight: 700;
}

.material-card-secondary {
  margin-top: 0.05in !important;
  font-size: 0.095in;
}

.material-card-code {
  margin-top: 0.07in !important;
  font-size: 0.13in;
  font-weight: 700;
}

.material-card-footer {
  display: flex;
  gap: 0.05in;
  align-items: end;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  font-size: 0.1in;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
}

.material-card-site {
  display: block;
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.material-card-1 {
  width: 1in;
  height: 1in;
  padding: 0.05in;
  background: #fff;
}

.material-card-1 .material-punch-guide {
  display: none;
}

.material-card-1 .material-card-content {
  grid-template-rows: minmax(0, 1fr) 0.12in;
  gap: 0.02in;
}

.material-card-1 .material-card-title,
.material-card-1 .material-card-copy {
  display: none;
}

.material-card-1 .material-card-main {
  grid-template-columns: 1fr;
  justify-items: center;
}

.material-card-1 .material-card-qr {
  width: 0.72in;
  height: 0.72in;
}

.material-card-1 .material-card-footer {
  justify-content: center;
  gap: 0.03in;
  font-size: 0.055in;
  line-height: 0.07in;
}

.material-card-1 .material-card-code {
  margin-top: 0 !important;
}

.print-materials-empty {
  padding: 1rem;
  color: var(--muted);
}

.selected-photo-list {
  margin-top: -0.35rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 251, 244, 0.66);
  color: var(--muted);
  font-size: 0.92rem;
}

.selected-photo-list p {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.selected-photo-list span {
  display: block;
  margin-bottom: 0.45rem;
  line-height: 1.4;
}

.selected-photo-list ul {
  margin: 0;
  padding-left: 1.1rem;
}

.journal-photo-preview figcaption {
  display: grid;
  gap: 0.35rem;
  align-items: start;
}

@media (max-width: 900px) {
  .hero,
  .search-layout,
  .journal-auth-prompt,
  .pig-card,
  .pig-profile-hero {
    grid-template-columns: 1fr;
  }

  .pig-profile-hero {
    align-items: start;
  }

  .main-search-results-active #main-finder-panel {
    display: none;
  }

  .main-search-results-active .mobile-search-again {
    display: inline-flex;
  }

  .pig-profile-photo {
    align-self: start;
    height: auto;
    min-width: 0;
    min-height: 0;
    max-height: 420px;
    aspect-ratio: 4 / 3;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-nav {
    justify-content: flex-start;
  }

  .finder-panel {
    position: static;
  }

}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1rem, 1180px);
    padding-top: 1.4rem;
  }

  h1 {
    max-width: 100%;
  }

  .finder-row {
    flex-direction: column;
  }

  .tag-result-summary {
    grid-template-columns: 76px minmax(0, 1fr);
    padding: 0.7rem;
  }

  .tag-result-summary img {
    width: 76px;
    height: 76px;
  }

  .results-shell,
  .panel {
    padding: 1rem;
  }

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

  .pig-profile-copy {
    padding: 0.25rem;
  }

  .pig-profile-photo {
    max-height: 320px;
  }

  .pig-profile-copy .pig-card-meta {
    margin: 1rem 0;
  }

  .journal-success-actions,
  .journal-form-panel .auth-actions,
  .journal-photo-preview-panel .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-return-panel {
    grid-template-columns: 1fr;
  }

  .journal-success-actions .button,
  .journal-form-panel .auth-actions .button,
  .journal-photo-preview-panel .auth-actions .button,
  .profile-return-panel .button {
    width: 100%;
  }

  .admin-panel-header,
  .admin-hero,
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

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

  .admin-summary-grid {
    grid-template-columns: 1fr;
  }

  .credential-grid {
    grid-template-columns: 1fr;
  }

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

  .print-materials-controls {
    grid-template-columns: 1fr;
  }

  .journal-photos {
    grid-template-columns: 1fr;
  }

  .profile-pig-card {
    grid-template-columns: 1fr;
  }

  .profile-pig-card img {
    max-height: 260px;
  }

  .photo-viewer {
    padding: 0.5rem;
  }

  .photo-viewer-dialog {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    padding: 3.5rem 0.5rem 0.75rem;
  }

  .photo-viewer-image {
    max-height: calc(100vh - 8.5rem);
  }

  .photo-viewer-nav {
    position: absolute;
    top: 50%;
    width: 42px;
    height: 54px;
    transform: translateY(-50%);
  }

  .photo-viewer-prev {
    left: 0.5rem;
  }

  .photo-viewer-next {
    right: 0.5rem;
  }
}

@media print {
  @page {
    size: letter;
    margin: 0.25in;
  }

  body.print-materials-active {
    min-height: auto;
    background: #fff;
    color: #111;
  }

  body.print-materials-active .admin-shell {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
  }

  body.print-materials-active .admin-shell > :not(#admin-dashboard),
  body.print-materials-active #admin-dashboard > :not(#pig-materials-panel),
  body.print-materials-active .print-materials-screen-only {
    display: none !important;
  }

  body.print-materials-active #admin-dashboard,
  body.print-materials-active #pig-materials-panel {
    display: block !important;
  }

  body.print-materials-active #pig-materials-panel {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  body.print-materials-active .print-material-sheet {
    overflow: visible;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  body.print-materials-active .material-sheet-2 {
    grid-template-columns: repeat(4, 2in);
    gap: 0.08in;
  }

  body.print-materials-active .material-sheet-1 {
    grid-template-columns: repeat(7, 1in);
    gap: 0.08in;
  }
}
