:root {
  --primary: #ff385c;
  --primary-dark: #e0294c;
  --primary-light: #ffe4e9;
  --accent: #00a699;
  --accent-dark: #00857a;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.9);
  --input-bg: #ffffff;
  --hover-bg: #fafafa;
  --border: #e8e8ec;
  --text: #222222;
  --text-muted: #6b7280;
  --danger: #d93025;
  --success: #1e8e3e;
  --warning: #b06000;
  --image-placeholder-bg: #e9ecef;
  --dropzone-bg: #fbfbfc;
  --dropzone-border: #d8d8dc;
  --badge-neutral-bg: #eee; --badge-neutral-color: #555;
  --badge-warning-bg: #fff4e0;
  --badge-success-bg: #e1f7ec;
  --badge-danger-bg: #fdeaea;
  --badge-info-bg: #e6f6f5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] {
  --primary: #ff5470;
  --primary-dark: #ff7a90;
  --primary-light: rgba(255, 84, 112, 0.18);
  --accent: #2dd4c4;
  --accent-dark: #5eeade;
  --bg: #14161a;
  --card-bg: #1c1f25;
  --header-bg: rgba(20, 22, 26, 0.85);
  --input-bg: #22262d;
  --hover-bg: #22262d;
  --border: #2c313a;
  --text: #eef0f2;
  --text-muted: #9aa1ac;
  --danger: #ff6b60;
  --success: #4ade80;
  --warning: #ffb84d;
  --image-placeholder-bg: #2c313a;
  --dropzone-bg: #1c1f25;
  --dropzone-border: #3a4049;
  --badge-neutral-bg: #2c313a; --badge-neutral-color: #c3c9d1;
  --badge-warning-bg: rgba(255, 184, 77, 0.16);
  --badge-success-bg: rgba(74, 222, 128, 0.16);
  --badge-danger-bg: rgba(255, 107, 96, 0.16);
  --badge-info-bg: rgba(45, 212, 196, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* Пока JS не применил сохранённую тему (см. api.js), уважаем системную настройку
   ОС/браузера для первого визита, чтобы не было навязанной светлой темы. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

header.topbar {
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.topbar .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1160px;
  margin: 0 auto;
}
.logo { font-weight: 800; font-size: 21px; color: var(--text); letter-spacing: -0.02em; }
.logo span { color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.nav-links a { color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-links .role-badge {
  background: linear-gradient(135deg, var(--primary), #ff7a59);
  color: #fff;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
}

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn.secondary { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.secondary:hover { background: var(--hover-bg); transform: none; box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b3261e; }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.theme-toggle:hover { background: var(--hover-bg); border-color: var(--primary); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.grid { display: grid; gap: 22px; }
.listing-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.listing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.listing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.listing-card img { width: 100%; height: 180px; object-fit: cover; background: var(--image-placeholder-bg); }
.listing-card .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.listing-card .title { font-weight: 700; font-size: 15.5px; color: var(--text); }
.listing-card .city { color: var(--text-muted); font-size: 13px; }
.listing-card .price { font-weight: 800; margin-top: auto; font-size: 15px; }
.listing-card .rating { font-size: 13px; color: var(--warning); font-weight: 600; }

.search-bar {
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--primary-light) 140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field label { color: var(--text-muted); font-weight: 600; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; }

.amenities-list { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.amenities-list label { display: flex; align-items: center; gap: 6px; font-size: 14px; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.draft { background: var(--badge-neutral-bg); color: var(--badge-neutral-color); }
.badge.pending { background: var(--badge-warning-bg); color: var(--warning); }
.badge.published { background: var(--badge-success-bg); color: var(--success); }
.badge.rejected { background: var(--badge-danger-bg); color: var(--danger); }
.badge.confirmed, .badge.paid, .badge.completed { background: var(--badge-success-bg); color: var(--success); }
.badge.cancelled { background: var(--badge-danger-bg); color: var(--danger); }
.badge.requested, .badge.checked_in { background: var(--badge-info-bg); color: var(--accent-dark); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs button {
  background: none; border: none; padding: 11px 18px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent; color: var(--text-muted); font-family: inherit; font-weight: 600;
  transition: color 0.12s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.dropzone {
  border: 2px dashed var(--dropzone-border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--dropzone-bg);
  transition: border-color 0.15s ease, background 0.15s ease;
  font-weight: 500;
}
.dropzone:hover { border-color: var(--primary); }
.dropzone.dragover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

.photo-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.photo-thumb { position: relative; width: 112px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .cover-tag { position: absolute; top: 5px; left: 5px; background: var(--primary); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.photo-thumb .actions { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 4px; padding: 4px; background: rgba(0,0,0,0.55); }
.photo-thumb .actions button { flex: 1; font-size: 10px; padding: 3px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
table.data-table th { color: var(--text-muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
table.data-table tr:hover td { background: var(--hover-bg); }

.muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex.wrap { flex-wrap: wrap; }
.space-between { display: flex; justify-content: space-between; align-items: center; }

.alert { padding: 11px 15px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; font-weight: 500; }
.alert.error { background: var(--badge-danger-bg); color: var(--danger); }
.alert.success { background: var(--badge-success-bg); color: var(--success); }
.alert.warning { background: var(--badge-warning-bg); color: var(--warning); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat-box {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--primary);
}
.stat-box .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat-box .label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.gallery-main { width: 100%; height: 380px; object-fit: cover; border-radius: var(--radius); background: var(--image-placeholder-bg); box-shadow: var(--shadow-sm); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery-thumbs img { width: 92px; height: 70px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: 0.6; transition: opacity 0.12s ease; }
.gallery-thumbs img:hover { opacity: 0.85; }
.gallery-thumbs img.active { opacity: 1; outline: 2px solid var(--primary); outline-offset: 2px; }

.map-embed { width: 100%; height: 260px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--image-placeholder-bg); margin-top: 12px; }
.map-embed iframe, .map-embed ymaps { width: 100%; height: 100%; border: 0; }

.review-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.review-item:last-child { border-bottom: none; }

.price-hero { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }

footer.site-footer { margin-top: 60px; padding: 34px 0; color: var(--text-muted); font-size: 13px; text-align: center; border-top: 1px solid var(--border); }
