:root {
  --green: #123e36;
  --gold: #c4a369;
  --cream: #f7f6f1;
  --ink: #242a27;
  --line: #d9ddd8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

.admin-shell {
  width: min(1120px, 92%);
  margin: 0 auto;
  padding: 45px 0 100px;
}

header,
.section-heading,
.article-toolbar,
.save-bar,
.header-actions,
.section-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

header { margin-bottom: 32px; }

header p,
.section-heading p {
  margin: 0 0 5px;
  color: #90764d;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 10px;
}

h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 500;
  margin: 0;
}

h1 { font-size: 35px; }
h2 { font-size: 25px; }

.header-actions,
.section-actions { justify-content: flex-end; }

.section-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions a {
  font-size: 12px;
  color: var(--green);
}

.card {
  background: #fff;
  padding: 34px;
  margin-bottom: 24px;
  box-shadow: 0 14px 35px #17392f12;
}

.auth-card {
  max-width: 480px;
  margin: 70px auto;
}

.auth-card > p {
  color: #68716c;
  line-height: 1.6;
}

.auth-card form {
  display: grid;
  gap: 16px;
  margin-top: 25px;
}

.auth-chatgpt {
  display: block;
  margin-top: 24px;
  text-align: center;
  text-decoration: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0 !important;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

label,
.upload-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #68716c;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  background: #fbfbf8;
  padding: 12px;
  font: 14px Arial, sans-serif;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus,
select:focus { border-color: var(--gold); }

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

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

button {
  border: 0;
  background: var(--green);
  color: white;
  padding: 13px 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .55;
}

.quiet {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--line);
  padding: 9px 12px;
}

.section-heading > span {
  font-size: 11px;
  color: #7b837e;
}

.article-editor {
  border-top: 1px solid var(--line);
  padding: 25px 0;
}

.article-editor:first-child { margin-top: 25px; }

.save-bar {
  position: sticky;
  bottom: 16px;
  background: #fff;
  padding: 16px 20px;
  box-shadow: 0 8px 30px #17392f26;
  z-index: 5;
}

.message {
  font-size: 12px;
  color: #8a3d32;
  margin: 0;
}

.message.success { color: #24714d; }

.content-list button.has-errors {
  border-color: #c43f35;
  background: #fff2f0;
  color: #7b211b;
}

.content-list button.active.has-errors {
  border-color: #7b211b;
  background: #7b211b;
  color: #fff;
}

.validation-badge {
  display: inline-block !important;
  width: fit-content;
  margin-top: 8px;
  border-radius: 999px;
  background: #c43f35;
  color: #fff;
  padding: 4px 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .7px;
  line-height: 1;
  text-transform: uppercase;
}

.active.has-errors .validation-badge {
  background: #fff;
  color: #7b211b;
}

.field-error input,
.field-error textarea,
.field-error select,
.field-error .image-dropzone {
  border: 2px solid #c43f35;
  background: #fff5f3;
  box-shadow: 0 0 0 3px #c43f3520;
}

.field-error input:focus,
.field-error textarea:focus,
.field-error select:focus,
.field-error .image-dropzone:focus {
  border-color: #9d261f;
  box-shadow: 0 0 0 4px #c43f3530;
}

.field-error-message {
  display: block;
  margin-top: 7px;
  color: #a12d25;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.save-publish-button {
  display: inline-flex;
  min-width: 184px;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.save-publish-button.loading::before {
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff65;
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  animation: save-publish-spin .7s linear infinite;
}

@keyframes save-publish-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .save-publish-button.loading::before { animation-duration: 1.4s; }
}

dialog {
  width: min(480px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px #092d2850;
}

dialog::backdrop { background: #092d2875; }

dialog form {
  display: grid;
  gap: 18px;
  padding: 74px 34px 34px;
}

dialog form > p {
  color: #68716c;
  line-height: 1.6;
  margin: 0;
}

.dialog-close {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dialog-close span {
  font-size: 18px;
  line-height: 0;
}

.market-badge {
  display: inline-block;
  margin-top: 6px;
  color: #90764d;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.listing-search-panel {
  width: min(880px, 100%);
  margin-top: 24px;
  margin-right: auto;
  margin-left: auto;
  padding: 22px;
  border: 1px solid #d5ddda;
  background: #f5f8f5;
}

.content-workspace.properties-workspace {
  grid-template-columns: minmax(0, 880px);
  justify-content: center;
}

.properties-workspace > .content-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  width: 100%;
  gap: 10px;
}

.properties-workspace > .content-list button {
  min-height: 104px;
}

.properties-workspace > .content-editor {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
  scroll-margin-top: 24px;
}

.listing-search-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.listing-search-heading strong {
  display: block;
  color: var(--green);
  font: 19px Georgia, serif;
  font-weight: 500;
}

#listing-results-count {
  display: block;
  margin-top: 5px;
  color: #6c756f;
  font-size: 11px;
}

.listing-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.listing-search-field {
  grid-column: span 2;
}

.listing-filter-grid input,
.listing-filter-grid select {
  min-height: 43px;
  background: #fff;
}

.listing-search-empty {
  margin: 0;
  padding: 18px 14px;
  border: 1px dashed var(--line);
  color: #68716c;
  font-size: 12px;
  line-height: 1.5;
}

.image-upload-field {
  min-width: 0;
}

.upload-label {
  display: block;
  margin-bottom: 7px;
}

.upload-picker {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.image-dropzone {
  display: flex;
  min-height: 170px;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  border: 2px dashed #b9c4bd;
  border-radius: 3px;
  background: #f8faf7;
  color: var(--green);
  text-transform: none;
  letter-spacing: 0;
  transition: border-color .18s, background .18s, transform .18s;
}

.image-dropzone:hover,
.image-dropzone:focus-visible,
.image-dropzone.dragging {
  border-color: var(--gold);
  background: #fbf7ed;
  outline: none;
}

.image-dropzone.dragging { transform: scale(1.008); }

.image-dropzone.uploading {
  border-style: solid;
  background: #f2f7f3;
}

.image-dropzone strong {
  font: 18px Georgia, serif;
  font-weight: 500;
}

.image-dropzone > span:not(.drop-icon) {
  color: #66716b;
  font-size: 12px;
}

.image-dropzone small {
  color: #8a938e;
  font-size: 10px;
}

.drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 23px;
  font-weight: 300;
}

.upload-status {
  min-height: 17px;
  margin: 8px 0 0;
  color: #24714d;
  font-size: 12px;
}

.upload-status.error { color: #8a3d32; }

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.upload-preview[hidden] { display: none; }

.upload-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.upload-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #edf0ed;
}

.upload-card figcaption {
  display: grid;
  gap: 8px;
  padding: 9px;
  font-size: 11px;
}

.upload-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.preview-action {
  border: 1px solid var(--line);
  background: #f7f7f3;
  color: var(--green);
  padding: 6px 7px;
  font-size: 8px;
}

.preview-action.remove-photo { color: #8a3d32; }

.article-url-importer {
  padding: 18px;
  border: 1px solid #d5ddda;
  background: #f2f7f3;
}

.article-url-importer > p {
  margin: 9px 0 0;
  color: #66716b;
  font-size: 12px;
  line-height: 1.55;
}

.article-import-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.article-import-status {
  margin: 0;
  color: #8a3d32;
  font-size: 12px;
  line-height: 1.45;
}

.article-import-status.success { color: #24714d; }

.article-image-preview {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfbf8;
}

.listing-description-generator {
  padding: 20px;
  border: 1px solid #d5ddda;
  background: #f2f7f3;
}

.listing-description-generator h3 {
  margin: 0;
  color: var(--green);
  font: 21px Georgia, serif;
  font-weight: 500;
}

.listing-description-generator > p {
  margin: 8px 0 16px;
  color: #66716b;
  font-size: 12px;
  line-height: 1.55;
}

.description-generator-input {
  min-height: 82px;
}

.description-generator-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.description-generator-status {
  margin: 0;
  color: #8a3d32;
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.description-generator-status.success { color: #24714d; }

.listing-private-section {
  margin-top: 10px;
  padding: 22px;
  border: 1px solid #c8b17f;
  background: #fffaf0;
}

.listing-private-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e3d6b9;
}

.listing-private-heading span {
  display: block;
  margin-bottom: 5px;
  color: #8a6b31;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.listing-private-heading h3 {
  margin: 0;
  color: var(--green);
  font: 22px Georgia, serif;
  font-weight: 500;
}

.listing-private-heading p {
  margin: 2px 0 0;
  color: #806f50;
  font-size: 11px;
  line-height: 1.45;
  text-align: right;
}

.listing-private-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.listing-private-section input,
.listing-private-section textarea {
  background: #fff;
  border-color: #d8c9a8;
}

.listing-private-notes-field {
  display: block;
  margin-top: 18px;
}

.listing-private-notes-field textarea {
  min-height: 170px;
  line-height: 1.55;
}

@media (max-width: 620px) {
  .description-generator-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.article-image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #edf0ed;
}

.article-image-preview figcaption {
  color: #68716c;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

@media (max-width: 960px) {
  .listing-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .admin-shell { padding-top: 25px; }

  header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .card { padding: 24px; }
  .save-bar { bottom: 8px; }
  dialog form { padding: 70px 24px 24px; }
  .upload-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-import-actions { align-items: flex-start; flex-direction: column; }
  .article-image-preview { grid-template-columns: 1fr; }
  .listing-search-heading { align-items: flex-start; flex-direction: column; }
  .listing-filter-grid { grid-template-columns: 1fr; }
  .listing-search-field { grid-column: auto; }
  .properties-workspace > .content-list { grid-template-columns: 1fr; }
  .properties-workspace > .content-editor { padding: 20px; }
  .listing-private-heading { flex-direction: column; }
  .listing-private-heading p { text-align: left; }
  .listing-private-fields { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .upload-preview { grid-template-columns: 1fr; }
}
