.admin-page {
  background: #faf5ec;
  color: #171514;
}

.admin-page [hidden] {
  display: none !important;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid #e3d8ca;
  background: rgba(250, 245, 236, 0.94);
  backdrop-filter: blur(14px);
}

.admin-topbar a:last-child {
  color: #dc3f2d;
  font-weight: 800;
  text-decoration: none;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-link-button {
  background: transparent !important;
  color: #dc3f2d !important;
  padding: 0;
  font-weight: 800;
}

.admin-login-screen {
  display: grid;
  min-height: calc(100vh - 74px);
  place-items: center;
  padding: 2rem;
}

.admin-login-card {
  display: grid;
  gap: 1rem;
  width: min(440px, 100%);
  border: 1px solid #e3d8ca;
  border-radius: 8px;
  background: #fffdf9;
  box-shadow: 0 18px 50px rgba(43, 34, 24, 0.08);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.admin-login-card h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.95;
}

.admin-login-card p {
  margin: 0;
  color: #625c55;
  line-height: 1.45;
}

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

.admin-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.5fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.admin-intro h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.admin-intro p:last-child {
  margin: 0;
  color: #625c55;
  font-size: 1.05rem;
  line-height: 1.5;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.36fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-panel {
  border: 1px solid #e3d8ca;
  border-radius: 8px;
  background: #fffdf9;
  box-shadow: 0 18px 50px rgba(43, 34, 24, 0.08);
}

.search-panel {
  position: sticky;
  top: 86px;
  padding: 1rem;
}

.search-panel label,
.listing-form label {
  display: grid;
  gap: 0.4rem;
  font-weight: 800;
  color: #34302c;
}

.admin-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.token-label {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.token-input {
  margin-top: 0.4rem;
}

.login-panel {
  margin-top: 0.8rem;
  border: 1px solid #eadfce;
  border-radius: 6px;
  background: #fffaf1;
  padding: 0.8rem;
}

.login-panel summary {
  cursor: pointer;
  color: #dc3f2d;
  font-weight: 900;
}

.login-panel label {
  margin-top: 0.7rem;
}

.admin-page input,
.admin-page textarea {
  width: 100%;
  border: 1px solid #d9cdbc;
  border-radius: 6px;
  background: #fff;
  padding: 0.75rem 0.85rem;
  color: #171514;
  font: inherit;
}

.admin-page textarea {
  resize: vertical;
  line-height: 1.45;
}

.admin-page button {
  border: 0;
  border-radius: 6px;
  background: #dc3f2d;
  color: #fff;
  padding: 0.78rem 1rem;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.admin-page button:hover {
  filter: brightness(0.96);
}

.secondary-button {
  width: 100%;
  margin-top: 0.65rem;
  background: #211d1a !important;
}

.google-search-button {
  width: 100%;
  margin-top: 0.65rem;
  background: #4285f4 !important;
}

.admin-note {
  min-height: 1.4rem;
  margin: 0.9rem 0 0.5rem;
  color: #625c55;
  font-size: 0.9rem;
}

.admin-results {
  display: grid;
  gap: 0.55rem;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 0.25rem;
}

.admin-page button.result-card {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  border: 1px solid #eadfce;
  border-radius: 6px;
  background: #fff;
  color: #171514;
  padding: 0.8rem;
  text-align: left;
  font-weight: 700;
}

.admin-page button.result-card[aria-current="true"] {
  border-color: #dc3f2d;
  background: #fffaf1;
  color: #171514;
  box-shadow: 0 0 0 2px rgba(220, 63, 45, 0.14);
}

.admin-page button.result-card.google-result {
  border-color: #cbdcfb;
  background: #f8fbff;
  color: #171514;
}

.admin-page button.result-card.google-result.exists {
  border-color: #dfe6d3;
  background: #fbfdf7;
  color: #171514;
}

.result-card strong {
  font-size: 1rem;
  color: #171514;
}

.result-card span {
  color: #625c55;
  font-size: 0.85rem;
  line-height: 1.35;
}

.result-source {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #e8f0fe;
  color: #174ea6 !important;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem !important;
  font-weight: 900;
  text-transform: uppercase;
}

.editor-panel {
  padding: clamp(1rem, 2vw, 1.5rem);
}

.editor-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.editor-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.save-status {
  color: #6aa342;
  font-weight: 900;
}

.copy-status {
  min-height: 1.4em;
  margin: 0;
  color: #6aa342;
  font-weight: 900;
}

.copy-status.error {
  color: #dc3f2d;
}

.listing-form {
  display: grid;
  gap: 1rem;
}

.listing-form fieldset {
  display: grid;
  gap: 1rem;
  margin: 0;
  border: 1px solid #eadfce;
  border-radius: 8px;
  padding: 1rem;
}

.listing-form legend {
  padding: 0 0.35rem;
  color: #dc3f2d;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkbox-grid label,
.integration-grid label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
}

.checkbox-grid input,
.integration-grid input[type="checkbox"] {
  width: auto;
}

.checkbox-grid.compact {
  padding-top: 0.35rem;
  border-top: 1px solid #eadfce;
}

.integration-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.field-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #eadfce;
  border-radius: 6px;
  background: #fffaf1;
  padding: 0.75rem;
}

.field-action-row span {
  color: #625c55;
  font-size: 0.9rem;
}

.copy-field {
  display: grid;
  gap: 0.4rem;
}

.copy-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.copy-field-heading label {
  display: block;
  font-weight: 800;
  color: #34302c;
}

.icon-generate-button {
  display: inline-grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 999px !important;
  background: #211d1a !important;
  padding: 0 !important;
  font-size: 1rem !important;
  line-height: 1 !important;
}

.photo-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.photo-picker-heading > div {
  display: grid;
  gap: 0.15rem;
}

.photo-picker-heading strong {
  font-size: 1rem;
}

.photo-picker-heading span {
  color: #625c55;
  font-size: 0.9rem;
}

.compact-button {
  width: auto;
  margin-top: 0;
  padding: 0.55rem 0.75rem !important;
  font-size: 0.85rem !important;
}

.photo-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.photo-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.75rem;
}

.photo-choice {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 2px solid #eadfce !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #171514 !important;
  padding: 0 !important;
  text-align: left;
}

.photo-choice-main {
  display: block;
  width: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}

.photo-choice.selected {
  border-color: #dc3f2d !important;
  box-shadow: 0 0 0 3px rgba(220, 63, 45, 0.16);
}

.photo-choice.hidden-photo {
  opacity: 0.58;
}

.photo-choice.hidden-photo .photo-choice-image {
  filter: grayscale(1);
}

.photo-choice-image {
  display: block;
  aspect-ratio: 1;
  background-color: #eadfce;
  background-position: center;
  background-size: cover;
}

.photo-choice-meta {
  display: grid;
  gap: 0.15rem;
  min-height: 4.1rem;
  padding: 0.65rem;
}

.photo-choice-meta strong {
  font-size: 0.9rem;
}

.photo-choice-meta small {
  overflow: hidden;
  color: #625c55;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-hide-toggle {
  margin: 0 0.65rem 0.65rem;
  border: 1px solid #d9cdbc !important;
  background: #fffaf1 !important;
  color: #171514 !important;
  padding: 0.48rem 0.6rem !important;
  font-size: 0.78rem !important;
}

#raw-json {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.form-actions .secondary-button {
  width: auto;
  margin-top: 0;
}

@media (max-width: 900px) {
  .admin-intro,
  .admin-layout,
  .form-grid,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: static;
  }

  .admin-results {
    max-height: 360px;
  }
}
