:root {
  --adm-border: #e4e7e9;
  --adm-muted: #5b403d;
}

.adm-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.adm-panel {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 0.5rem;
  padding: 1rem;
}

.adm-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.adm-panel-head h2 {
  font-size: 0.9375rem;
  font-weight: 700;
}

.adm-panel-head p {
  font-size: 0.75rem;
  color: #5b403d;
}

.adm-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}

.adm-stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.adm-stat {
  background: #f2f4f6;
  border-radius: 0.75rem;
  padding: 0.875rem;
}

.adm-stat b {
  display: block;
  font-size: 1.5rem;
  line-height: 1.2;
}

.adm-stat span {
  font-size: 0.75rem;
  color: #5b403d;
}

.adm-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b403d;
  margin-bottom: 0.25rem;
}

.adm-field {
  margin-bottom: 0.75rem;
}

.adm-input,
.adm-select,
.adm-textarea {
  width: 100%;
  border: 1px solid var(--adm-border);
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  color: #191c1e;
  font-family: inherit;
}

.adm-input:focus,
.adm-select:focus,
.adm-textarea:focus {
  outline: 2px solid #93000b;
  outline-offset: 1px;
  border-color: #93000b;
}

.adm-textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.7;
}

.adm-textarea-body {
  min-height: 20rem;
}

.adm-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.adm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: #eceef0;
  color: #191c1e;
  font-family: inherit;
}

.adm-btn:hover {
  background: #e0e3e5;
}

.adm-btn-primary {
  background: #93000b;
  color: #fff;
}

.adm-btn-primary:hover {
  background: #b91c1c;
}

.adm-btn-ghost {
  background: transparent;
  border-color: var(--adm-border);
}

.adm-btn-danger {
  background: #ffdad6;
  color: #410002;
}

.adm-btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.adm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.adm-table th,
.adm-table td {
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--adm-border);
  vertical-align: top;
}

.adm-table th {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b403d;
  background: #f2f4f6;
}

.adm-scroll {
  overflow-x: auto;
}

.adm-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--adm-border);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
}

.adm-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #5b403d;
  font-size: 0.875rem;
  border: 1px dashed var(--adm-border);
  border-radius: 0.5rem;
}

.adm-media {
  border: 1px solid var(--adm-border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.adm-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: #eceef0;
}

.adm-media .adm-media-body {
  padding: 0.625rem;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.adm-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
}

.adm-pill-pub {
  background: #d0d8f2;
  color: #131b2e;
}

.adm-pill-draft {
  background: #e0e3e5;
  color: #191c1e;
}

.adm-pill-warn {
  background: #fe932c;
  color: #2f1500;
}

.adm-pill-ok {
  background: #dae2fd;
  color: #131b2e;
}

.adm-pill-bad {
  background: #ffdad6;
  color: #410002;
}

.adm-muted {
  color: #5b403d;
  font-size: 0.75rem;
}

/* The real file input is visual-hidden but focusable; the visible
   "Choose image" button forwards its click. Keeps the label binding intact. */
.adm-input-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

[data-upload-status="hero"] {
  display: block;
  margin-top: 0.375rem;
}

.adm-upload-error {
  color: #b3261e;
}

.adm-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

.adm-warn {
  background: #fff4e5;
  border: 1px solid #ffb77d;
  color: #663500;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
}

.adm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(25, 28, 30, 0.55);
}

.adm-modal.is-open {
  display: flex;
}

.adm-modal-card {
  background: #fff;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 46rem;
  max-height: 88vh;
  overflow: auto;
  padding: 1rem;
}

.adm-modal-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  background: #f2f4f6;
  padding: 0.75rem;
  border-radius: 0.5rem;
}

.adm-preview {
  font-size: 0.9375rem;
  line-height: 1.8;
}

.adm-preview h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}

.adm-preview p {
  margin: 0 0 0.875rem;
}

.adm-preview .adm-note {
  background: #f2f4f6;
  border-left: 3px solid #93000b;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
}

.adm-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
  display: block;
  background: #eceef0;
}

@media (max-width: 767px) {
  .adm-stack {
    gap: 0.75rem;
  }

  .adm-textarea-body {
    min-height: 14rem;
  }
}

/* Dialog. Mirrors the public site's .dot-overlay pair, but named for the CMS
   so admin/index.html does not have to pull in site.css. UI.openOverlay()
   toggles .is-open; UI.closeAllOverlays() runs on Escape and backdrop click. */
.adm-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 25, 23, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem;
}

.adm-overlay.is-open {
  display: flex;
}

.adm-dialog {
  background: #fff;
  border-radius: 0.75rem;
  width: min(28rem, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

/* The identity block in the desk header is a button, so it needs a visible
   hover and keyboard ring to read as one. */
.adm-identity {
  border-radius: 9999px;
  transition: background-color 0.15s ease;
}

.adm-identity:hover {
  background: rgba(0, 0, 0, 0.05);
}

.adm-identity:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
