:root {
  --kbit-green: #1f9d55;
  --kbit-green-light: #3ecf8e;
  --kbit-green-soft: #e8f8ef;
  --kbit-blue: #1a73e8;
  --kbit-blue-deep: #0b4f9c;
  --kbit-blue-soft: #e8f1fc;
  --kbit-sky: #4aa3ff;
  --kbit-ink: #10233f;
  --kbit-muted: #5b6b7c;
  --kbit-border: #d7e2ee;
  --kbit-bg: #f5f9fc;
  --kbit-white: #ffffff;
  --kbit-shadow: 0 10px 30px rgba(16, 35, 63, 0.08);
  --kbit-radius: 18px;
  --font-display: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--kbit-ink);
  background:
    radial-gradient(circle at top right, rgba(74, 163, 255, 0.18), transparent 28%),
    radial-gradient(circle at top left, rgba(62, 207, 142, 0.16), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, var(--kbit-bg) 45%, #eef6f2 100%);
  min-height: 100vh;
}

a { color: var(--kbit-blue-deep); text-decoration: none; }
a:hover { color: var(--kbit-green); }

.kbit-navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--kbit-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.kbit-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  color: var(--kbit-ink);
}

.kbit-brand img {
  height: 48px;
  width: auto;
}

.kbit-brand span { font-size: 1.05rem; letter-spacing: 0.02em; }

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.65rem 0.25rem 0.25rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--kbit-border);
  color: var(--kbit-ink);
  text-decoration: none;
  max-width: 220px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.header-user:hover {
  color: var(--kbit-ink);
  border-color: var(--kbit-blue);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.12);
}
.header-user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--kbit-blue-soft);
  flex-shrink: 0;
}
.header-user .header-user-meta {
  min-width: 0;
  line-height: 1.15;
}
.header-user .header-user-name {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-user .header-user-role {
  display: block;
  font-size: 0.7rem;
  color: var(--kbit-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-kbit {
  background: linear-gradient(135deg, var(--kbit-blue), var(--kbit-green));
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.25);
}

.btn-kbit:hover { color: #fff; filter: brightness(1.05); }

.btn-outline-kbit {
  border: 1.5px solid var(--kbit-blue);
  color: var(--kbit-blue-deep);
  border-radius: 999px;
  font-weight: 600;
  background: #fff;
}

.hero {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(11, 79, 156, 0.88), rgba(31, 157, 85, 0.78)),
    url('../images/logo.jpeg') center/cover no-repeat;
  opacity: 0.95;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  color: #fff;
}

.hero-logo {
  max-width: min(340px, 80vw);
  background: rgba(255,255,255,0.95);
  border-radius: 24px;
  padding: 0.75rem 1rem;
  box-shadow: var(--kbit-shadow);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  max-width: 16ch;
}

.hero .tagline {
  font-size: 1.05rem;
  opacity: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.search-panel {
  background: rgba(255,255,255,0.97);
  border-radius: var(--kbit-radius);
  padding: 1rem;
  box-shadow: var(--kbit-shadow);
}

.search-panel .form-control,
.search-panel .form-select {
  border-radius: 12px;
  border-color: var(--kbit-border);
  min-height: 48px;
}

.section-title {
  font-weight: 800;
  color: var(--kbit-ink);
  margin-bottom: 0.35rem;
}

.section-sub {
  color: var(--kbit-muted);
  margin-bottom: 1.5rem;
}

.property-card {
  background: var(--kbit-white);
  border: 1px solid var(--kbit-border);
  border-radius: var(--kbit-radius);
  overflow: hidden;
  box-shadow: var(--kbit-shadow);
  height: 100%;
  transition: transform .2s ease, box-shadow .2s ease;
}

.property-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(16, 35, 63, 0.12);
}

.property-card .thumb {
  height: 190px;
  background: linear-gradient(135deg, var(--kbit-blue-soft), var(--kbit-green-soft));
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.property-card .thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.property-card .badge-verify {
  position: absolute;
  top: 12px;
  left: 12px;
}

.property-card .body { padding: 1rem 1.1rem 1.2rem; }
.property-card .price {
  color: var(--kbit-blue-deep);
  font-weight: 800;
  font-size: 1.15rem;
}

.category-chip {
  display: block;
  text-align: center;
  padding: 1.2rem 0.75rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--kbit-border);
  font-weight: 700;
  color: var(--kbit-ink);
  box-shadow: var(--kbit-shadow);
  transition: .2s ease;
}

.category-chip:hover {
  background: linear-gradient(135deg, var(--kbit-blue-soft), var(--kbit-green-soft));
  color: var(--kbit-ink);
}

.dashboard-body {
  height: 100vh;
  overflow: hidden;
  background: var(--kbit-bg);
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  flex-shrink: 0;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  overflow: hidden;
}

.dashboard-side {
  background: linear-gradient(180deg, #0b4f9c, #127a4c);
  color: #fff;
  padding: 1.25rem;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dashboard-side::-webkit-scrollbar,
.dashboard-main::-webkit-scrollbar {
  width: 8px;
}
.dashboard-side::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}
.dashboard-main::-webkit-scrollbar-thumb {
  background: rgba(16, 35, 63, 0.25);
  border-radius: 999px;
}

.dashboard-side a {
  display: block;
  color: rgba(255,255,255,0.92);
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  margin-bottom: 0.25rem;
}

.dashboard-side a:hover,
.dashboard-side a.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.dashboard-main {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--kbit-border);
  box-shadow: var(--kbit-shadow);
}

.stat-card .label { color: var(--kbit-muted); font-size: 0.9rem; }
.stat-card .value { font-size: 1.8rem; font-weight: 800; color: var(--kbit-blue-deep); }

.auth-card {
  max-width: 480px;
  margin: 2.5rem auto;
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  border: 1px solid var(--kbit-border);
  box-shadow: var(--kbit-shadow);
}

.auth-card .logo {
  display: block;
  max-width: 220px;
  margin: 0 auto 1rem;
}

.kbit-footer {
  margin-top: 4rem;
  background: #0d2a4a;
  color: rgba(255,255,255,0.88);
  padding: 2.5rem 0 1.5rem;
}

.kbit-footer a { color: #9fd0ff; }
.mobile-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--kbit-border);
  display: none;
  z-index: 1000;
}

.mobile-nav a {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.25rem;
  font-size: 0.75rem;
  color: var(--kbit-muted);
}

.mobile-nav a.active { color: var(--kbit-blue-deep); font-weight: 700; }

@media (max-width: 991px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - 70px);
  }
  .dashboard-side { display: none; }
  .dashboard-main {
    height: 100%;
    padding-bottom: 5rem;
  }
  .dashboard-body { padding-bottom: 0; }
  .mobile-nav { display: flex; }
  body:not(.dashboard-body) { padding-bottom: 64px; }
  .hero { padding-top: 2.5rem; }
}

.low-data img.lazy-pending { filter: blur(8px); }
.table thead { background: var(--kbit-blue-soft); }
.badge-kbit { background: linear-gradient(135deg, var(--kbit-blue), var(--kbit-green)); }
.fade-up { animation: fadeUp .5s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Messaging / chat */
.chat-thread {
  background: #eef3f8;
  border: 1px solid var(--kbit-border);
  border-radius: 18px;
  padding: 1rem;
  max-height: 520px;
  overflow-y: auto;
}
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}
.chat-row-mine {
  justify-content: flex-end;
}
.chat-row-theirs {
  justify-content: flex-start;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--kbit-blue-soft);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(16, 35, 63, 0.12);
}
.chat-bubble {
  max-width: min(70%, 520px);
  padding: 0.75rem 1rem;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(16, 35, 63, 0.06);
  word-wrap: break-word;
}
.chat-bubble-mine {
  background: linear-gradient(135deg, var(--kbit-blue), var(--kbit-green));
  color: #fff;
  border-bottom-right-radius: 6px;
}
.chat-bubble-mine .chat-meta {
  color: rgba(255, 255, 255, 0.8);
}
.chat-bubble-theirs {
  background: #ffffff;
  color: var(--kbit-ink);
  border: 1px solid var(--kbit-border);
  border-bottom-left-radius: 6px;
}
.chat-bubble-theirs .chat-sender {
  color: var(--kbit-blue-deep);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}
.chat-bubble-theirs .chat-meta {
  color: var(--kbit-muted);
}
.chat-composer {
  background: #fff;
  border: 1px solid var(--kbit-border);
  border-radius: 16px;
  padding: 0.75rem;
}

.kbit-swal {
  border-radius: 18px !important;
  font-family: var(--font-body) !important;
}
.swal2-confirm {
  border-radius: 999px !important;
  font-weight: 600 !important;
}
.swal2-cancel {
  border-radius: 999px !important;
}

/* Password show/hide toggle */
.password-field {
  position: relative;
}
.password-field > .form-control {
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  background: transparent;
  color: var(--kbit-muted, #6c757d);
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--kbit-blue-deep, #0f4c81);
  background: rgba(15, 76, 129, 0.08);
  outline: none;
}
.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  pointer-events: none;
}
.password-toggle[aria-pressed="true"] {
  color: var(--kbit-blue-deep, #0f4c81);
}

/* Dashboard mobile nav */
.dashboard-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 40, 0.45);
  z-index: 1035;
}
body.dashboard-nav-open { overflow: hidden; }
@media (max-width: 991.98px) {
  .dashboard-side {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 300px);
    z-index: 1040;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.dashboard-nav-open .dashboard-side {
    transform: translateX(0);
  }
}

/* Chat bubble wrap */
.chat-bubble {
  max-width: min(78%, 520px);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chat-body {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Messenger layout */
.messenger-page { height: calc(100vh - 110px); min-height: 480px; }
.messenger-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 0;
  height: 100%;
  border: 1px solid var(--kbit-border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.messenger-list-pane {
  border-right: 1px solid var(--kbit-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem;
  background: #f8fafc;
}
.messenger-conversations {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.messenger-convo-item {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .7rem .6rem;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
.messenger-convo-item:hover,
.messenger-convo-item.active { background: rgba(15,76,129,.08); }
.messenger-chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.messenger-chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--kbit-border);
}
.messenger-empty {
  margin: auto;
  text-align: center;
  padding: 2rem;
}
.messenger-chat-pane .chat-thread {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 1rem;
}
.messenger-chat-pane .chat-composer {
  border: 0;
  border-top: 1px solid var(--kbit-border);
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-end;
  padding: .65rem .75rem;
  position: relative;
}
.chat-composer-tools { display: flex; gap: .15rem; }
.chat-tool-btn { padding: .15rem .35rem; text-decoration: none; font-size: 1.15rem; line-height: 1; }
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: .75rem;
  background: #fff;
  border: 1px solid var(--kbit-border);
  border-radius: 12px;
  padding: .35rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .2rem;
  z-index: 6;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.emoji-btn { border: 0; background: transparent; font-size: 1.2rem; padding: .2rem; }
.attach-preview { width: 100%; order: -1; }
.messenger-avatar-wrap { position: relative; flex-shrink: 0; }
.presence-dot {
  position: absolute;
  right: 0; bottom: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #fff;
}
.presence-dot.online { background: #22c55e; }
.messenger-typing {
  display: flex; gap: 4px; padding: 0 1rem .5rem;
}
.messenger-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: typingBounce 1s infinite ease-in-out;
}
.messenger-typing span:nth-child(2) { animation-delay: .15s; }
.messenger-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}
.chat-attach-image img {
  max-width: min(220px, 70vw);
  border-radius: 10px;
  display: block;
  margin-bottom: .35rem;
}
.chat-attach-card {
  display: block;
  background: rgba(0,0,0,.06);
  border-radius: 10px;
  padding: .5rem .65rem;
  margin-bottom: .35rem;
  text-decoration: none;
  color: inherit;
}
.msg-search-results {
  position: relative;
  background: #fff;
  border: 1px solid var(--kbit-border);
  border-radius: 12px;
  margin-top: .35rem;
  max-height: 240px;
  overflow: auto;
  z-index: 5;
}
.msg-search-item {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  gap: .65rem;
  align-items: center;
  padding: .55rem .7rem;
  text-align: left;
}
.msg-search-item:hover { background: rgba(15,76,129,.06); }
.msg-search-item img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
}
@media (max-width: 991.98px) {
  .messenger-layout { grid-template-columns: 1fr; height: calc(100vh - 96px); }
  .messenger-page:has(.messenger-chat-header) .messenger-list-pane { display: none; }
  .messenger-page:not(:has(.messenger-chat-header)) .messenger-chat-pane { display: none; }
}

/* Discover vertical feed */
.discover-feed {
  height: calc(100vh - 72px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  background: #000;
}
.discover-slide {
  position: relative;
  height: calc(100vh - 72px);
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.discover-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.discover-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff;
}
.discover-title { color: #fff; font-weight: 700; text-decoration: none; }
.discover-actions { display: flex; flex-direction: column; gap: .5rem; }
.discover-like-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  padding: .45rem .8rem;
  text-decoration: none;
  text-align: center;
}
.discover-like-btn.liked { background: #e11d48; }
.discover-empty {
  min-height: 60vh;
  display: grid;
  place-content: center;
  text-align: center;
  background: #fff;
}

/* Contained home property rows */
.home-scroll-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}
.home-scroll-row > .col,
.home-scroll-row > .home-scroll-item {
  flex: 0 0 min(280px, 80vw);
  scroll-snap-align: start;
}
