:root {
  --bg: #060604;
  --bg-soft: #0f0d08;
  --panel: rgba(13, 12, 9, 0.92);
  --gold: #d59a34;
  --gold-2: #f2c56a;
  --gold-dark: #805414;
  --text: #f8f5ef;
  --muted: rgba(248, 245, 239, 0.68);
  --line: rgba(214, 160, 63, 0.38);
  --danger: #d65a4a;
  --green: #38b26d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 84% 2%, rgba(214, 160, 63, 0.22), transparent 34%),
    radial-gradient(circle at 12% 18%, rgba(214, 160, 63, 0.16), transparent 32%),
    linear-gradient(135deg, #050504 0%, #100e07 47%, #070604 100%);
  font-family: Inter, Arial, sans-serif;
}

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

button {
  user-select: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(4, 4, 3, 0.84);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-2) 48%, var(--gold-dark));
  color: #141006;
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.08em;
  box-shadow: 0 16px 42px rgba(214, 160, 63, 0.18);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  border-color: var(--line);
  background: linear-gradient(135deg, rgba(214, 160, 63, .18), rgba(214, 160, 63, .04));
}

.workspace {
  padding: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

h1 {
  font-size: clamp(34px, 4vw, 58px);
  line-height: .95;
  margin: 0;
  letter-spacing: -0.05em;
}

h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.topbar-actions,
.filters,
.card-actions,
.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gold-btn,
.ghost-btn,
.filter-chip,
.action-btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: .18s ease;
}

.gold-btn {
  color: #120d05;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  font-weight: 800;
}

.ghost-btn,
.filter-chip,
.action-btn {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}

.gold-btn:hover,
.ghost-btn:hover,
.filter-chip:hover,
.action-btn:hover {
  transform: translateY(-1px);
}

.full {
  width: 100%;
}

.danger,
.danger-lite {
  border-color: rgba(214,90,74,.55);
  color: #ffb1a7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card,
.panel,
.villa-card,
.request-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20,18,13,.92), rgba(5,5,4,.94));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.015);
}

.stat-card {
  border-radius: 22px;
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  color: var(--gold-2);
}

.panel {
  border-radius: 28px;
  padding: 22px;
  display: none;
}

.panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

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

.filter-chip.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #120d05;
  font-weight: 800;
}

.search-field {
  min-width: 240px;
}

.villa-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  color: var(--muted);
}

.villa-card {
  border-radius: 24px;
  overflow: hidden;
}

.villa-card.is-hidden {
  opacity: .62;
}

.villa-image {
  height: 190px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.status-badge,
.type-badge {
  position: absolute;
  top: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.status-badge {
  left: 12px;
}

.type-badge {
  right: 12px;
  background: rgba(0,0,0,.54);
  border: 1px solid var(--line);
  color: var(--gold-2);
}

.status-available {
  background: rgba(56, 178, 109, .92);
  color: #031209;
}

.status-booked {
  background: rgba(214, 90, 74, .92);
  color: #180303;
}

.status-hidden {
  background: rgba(155, 155, 155, .9);
  color: #101010;
}

.villa-body {
  padding: 16px;
}

.villa-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.villa-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.price {
  color: var(--gold-2);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  margin: 12px 0;
  font-size: 13px;
}

.address {
  color: var(--muted);
  min-height: 42px;
  line-height: 1.45;
  font-size: 13px;
}

.booking-info {
  margin: 14px 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(214,160,63,.08);
  border: 1px solid rgba(214,160,63,.25);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.booking-info span {
  display: block;
  margin-top: 4px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1.15fr .8fr .75fr;
}

.request-list {
  display: grid;
  gap: 14px;
}

.request-card {
  padding: 18px;
  border-radius: 22px;
}

.request-card h3 {
  margin: 0 0 10px;
}

.request-meta {
  color: var(--muted);
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(1180px, calc(100% - 28px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  margin: 22px auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: linear-gradient(180deg, #17120a, #070604);
  box-shadow: 0 32px 90px rgba(0,0,0,.62);
}

.small-modal {
  width: min(520px, calc(100% - 28px));
  margin-top: 8vh;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 24px;
}

.modal-eyebrow {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: #171006;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
}

form,
.editor-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 8px;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(214,160,63,.22);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
}

select {
  appearance: none;
}

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

.editor-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  align-items: start;
}

.editor-preview {
  position: sticky;
  top: 0;
  display: grid;
  gap: 14px;
}

.edit-image-preview {
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,.04);
}

.upload-box {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  background: rgba(214,160,63,.06);
}

.upload-box input {
  margin-top: 8px;
  padding: 10px;
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gallery-thumb {
  aspect-ratio: 1;
  border: 1px solid rgba(214,160,63,.22);
  border-radius: 12px;
  background-size: cover;
  background-position: center;
}

.editor-fields {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.field-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.field-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

.editor-actions {
  justify-content: flex-end;
  border-top: 1px solid rgba(214,160,63,.22);
  padding-top: 16px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  min-width: min(520px, calc(100vw - 32px));
  max-width: min(720px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #120d04;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 28px 70px rgba(0,0,0,.42);
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-preview {
    position: static;
  }

  .field-grid.four,
  .field-grid.three {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar,
  .panel-head {
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .stats-grid,
  .villa-list,
  .field-grid.two,
  .field-grid.three,
  .field-grid.four {
    grid-template-columns: 1fr;
  }

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

.sync-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(214, 160, 63, .45);
}

#syncLabel[data-type="success"] + .sync-dot,
#syncLabel[data-type="success"] {
  color: var(--green);
}

#syncLabel[data-type="error"] {
  color: var(--danger);
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 2, 1, .84);
  backdrop-filter: blur(12px);
  z-index: 3000;
  padding: 24px;
}

.login-overlay.open {
  display: flex;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(20, 17, 10, .98), rgba(5, 5, 3, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  padding: 32px;
  display: grid;
  gap: 18px;
}

.login-card h2 {
  margin: 0;
  font-size: 28px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  border: 1px solid rgba(214, 160, 63, .3);
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--gold);
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  font-size: 22px;
}

.request-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.request-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--gold-2);
  white-space: nowrap;
  font-size: 12px;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
