:root {
  --primary: #1e3a8a;
  --primary-soft: #dbeafe;
  --accent: #c9a227;
  --accent-soft: #f7edd0;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #111827;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 14px 32px rgba(15, 23, 42, 0.08);
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --transition: 220ms ease;
  --sidebar-width: 280px;
  --sidebar-collapsed: 92px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.14);
  outline: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.dashboard-bg-shape {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
}

.bg-shape-1 {
  width: 360px;
  height: 360px;
  left: -80px;
  top: -120px;
  background: rgba(30, 58, 138, 0.22);
}

.bg-shape-2 {
  width: 320px;
  height: 320px;
  right: -120px;
  bottom: -140px;
  background: rgba(201, 162, 39, 0.2);
}

.admin-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  transition: width var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px;
}

.brand-logo {
  width: 150px;
  max-width: 100%;
  object-fit: contain;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-item,
.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-item:hover,
.logout-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(2px);
}

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  box-shadow: var(--shadow-sm);
}

.nav-icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.logout-btn {
  margin-top: auto;
  color: #b42318;
}

.content-shell {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: margin-left var(--transition);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 250, 252, 0.93);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-xl);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-start,
.topbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  min-width: 320px;
}

.search-wrap input {
  padding-left: 40px;
  border-radius: 999px;
}

.search-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
}

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.icon-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.icon-btn.ghost {
  background: transparent;
}

.dot-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  background: var(--accent);
  color: #1f2937;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 2px solid #fff;
}

.profile-menu {
  position: relative;
}

.profile-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
  font-weight: 800;
}

.profile-btn span {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.profile-btn small {
  color: var(--muted);
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
}

.dropdown.is-open {
  display: block;
}

.dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--surface-2);
}

.breadcrumb-row {
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 0;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section {
  display: none;
  animation: sectionFade 260ms ease;
}

.section.is-active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-head h1 {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.section-head p {
  color: var(--muted);
  margin-top: 4px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.24);
}

.btn.secondary {
  background: var(--accent-soft);
  color: #7a5b05;
}

.btn.tiny {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  padding: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card .value {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-card .delta {
  display: inline-flex;
  margin-top: 10px;
  background: var(--surface-2);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 8px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chart-wrap {
  min-height: 280px;
}

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

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.list-item small {
  color: var(--muted);
}

.filter-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.data-table thead th {
  background: #f8fbff;
  color: #1f2937;
  border-bottom: 1px solid var(--border);
  padding: 11px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: #fbfdff;
}

.sortable {
  cursor: pointer;
}

.sortable::after {
  content: " <>"; 
  color: #94a3b8;
}

.mobile-cards {
  display: none;
  margin-top: 12px;
}

.data-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.data-card + .data-card {
  margin-top: 10px;
}

.data-card-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
  color: #334155;
}

.kv span:first-child {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.page-info {
  color: var(--muted);
  font-size: 13px;
  margin-right: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.active {
  background: #d1fae5;
  color: #065f46;
}

.badge.sold {
  background: #fee2e2;
  color: #991b1b;
}

.badge.draft {
  background: #e2e8f0;
  color: #334155;
}

.badge.featured {
  background: var(--accent-soft);
  color: #7a5b05;
}

.badge.new {
  background: #eff6ff;
  color: #1e40af;
}

.badge.contacted {
  background: #fef3c7;
  color: #92400e;
}

.badge.visit {
  background: #ede9fe;
  color: #5b21b6;
}

.badge.closed {
  background: #dcfce7;
  color: #166534;
}

.badge.role-super-admin {
  background: #dbeafe;
  color: #1e3a8a;
}

.badge.role-admin {
  background: #ede9fe;
  color: #6b21a8;
}

.badge.role-sales-agent {
  background: #ffe4e6;
  color: #9f1239;
}

.badge.role-content-manager {
  background: #dcfce7;
  color: #166534;
}

.pill-toggle {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  position: relative;
  background: #cbd5e1;
}

.pill-toggle::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}

.pill-toggle.is-on {
  background: var(--primary);
}

.pill-toggle.is-on::after {
  transform: translateX(20px);
}

.note-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.note-item {
  border-left: 2px solid var(--primary-soft);
  padding-left: 10px;
}

.note-item small {
  color: var(--muted);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.modal-root .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  opacity: 0;
  transition: opacity var(--transition);
}

.modal-root .modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(1000px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: var(--radius-2xl);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
}

.modal-root.is-open {
  pointer-events: auto;
}

.modal-root.is-open .modal-backdrop {
  opacity: 1;
}

.modal-root.is-open .modal-panel {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 16px;
}

.modal-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group > span {
  font-size: 13px;
  color: #334155;
  font-weight: 700;
}

.rich-toolbar {
  display: flex;
  gap: 8px;
}

.rich-editor {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  overflow: auto;
  background: #fff;
}

.rich-editor:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.14);
}

.amenity-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.image-preview-grid img {
  width: 100%;
  height: 94px;
  object-fit: cover;
  border-radius: 10px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.media-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 10px;
  background: #fff;
}

.media-item img {
  width: 100%;
  height: 130px;
  border-radius: 12px;
  object-fit: cover;
}

.media-meta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #334155;
  font-size: 13px;
}

.media-meta small {
  color: var(--muted);
}

.settings-card {
  max-width: 760px;
  display: grid;
  gap: 12px;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite linear;
}

.skeleton-line + .skeleton-line {
  margin-top: 10px;
}

.w-40 {
  width: 40%;
}

.w-55 {
  width: 55%;
}

.w-70 {
  width: 70%;
}

.toast-stack {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow-md);
}

.toast.error {
  background: #7f1d1d;
}

.toast.success {
  background: #14532d;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.46);
  z-index: 8;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

@keyframes sectionFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .content-shell {
  margin-left: var(--sidebar-collapsed);
}

body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .brand-logo {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 20;
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open .sidebar-overlay {
    display: block;
  }

  .mobile-only {
    display: inline-flex;
  }

  .content-shell {
    margin-left: 0;
    padding: 12px;
  }

  .search-wrap {
    min-width: auto;
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-start,
  .topbar-end {
    width: 100%;
    justify-content: space-between;
  }

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

  .table-wrap {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  .filter-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-root .modal-panel {
    width: calc(100vw - 14px);
    max-height: calc(100vh - 14px);
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-btn span {
    display: none;
  }
}
