/* =====================================================
   Eldoret City Realtors - Admin Dashboard CSS
   ===================================================== */

:root {
  --primary: #219ebc;
  --secondary: #023047;
  --accent: #ffb703;
  --sky: #8ecae6;
  --sky-light: #d8edf5;
  --bg: #f4f7fa;
  --white: #fff;
  --gray-100: #f0f3f5;
  --gray-200: #e2e8ec;
  --gray-300: #cbd5db;
  --gray-500: #6b7a85;
  --gray-700: #3d4a55;
  --shadow-sm: 0 2px 6px rgba(2, 48, 71, 0.06);
  --shadow-md: 0 6px 18px rgba(2, 48, 71, 0.10);
  --radius: 8px;
  --transition: 0.3s ease;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--gray-700);
  margin: 0;
  font-size: 0.94rem;
}

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(2,48,71,0.92), rgba(33,158,188,0.85)),
    url('https://images.unsplash.com/photo-1564013799919-ab600027ffc6?w=1600') center/cover;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 430px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}
.login-card::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 16px 16px 0 0;
}
.login-card .brand {
  text-align: center;
  margin-bottom: 30px;
}
.login-card .brand .logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 1.8rem;
  margin-bottom: 16px;
}
.login-card h2 { font-family: 'Cormorant Garamond', serif; color: var(--secondary); margin-bottom: 6px; }
.login-card .sub { color: var(--gray-500); font-size: 0.9rem; }
.login-card label { font-size: 0.85rem; font-weight: 500; color: var(--secondary); margin-bottom: 6px; }
.login-card .form-control {
  border: 1px solid var(--gray-200);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.login-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(33,158,188,0.12);
}
.login-card .password-wrap { position: relative; }
.login-card .password-wrap .toggle-pwd {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--gray-500);
}
.login-card .btn-login {
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background var(--transition);
}
.login-card .btn-login:hover { background: var(--secondary); }
.login-card .btn-login:disabled { opacity: 0.7; }

/* ===== LAYOUT ===== */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--secondary);
  color: var(--sky-light);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex; flex-direction: column;
  transition: transform var(--transition);
}
.admin-sidebar .sb-brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.admin-sidebar .sb-brand .mark {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary);
  font-size: 1.2rem;
}
.admin-sidebar .sb-brand .txt {
  font-family: 'Cormorant Garamond', serif;
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.1;
}
.admin-sidebar .sb-brand .txt small { font-size: 0.65rem; color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase; display: block; }
.admin-sidebar .sb-nav { padding: 16px 0; flex: 1; overflow-y: auto; }
.admin-sidebar .sb-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  color: var(--sky-light);
  text-decoration: none;
  font-size: 0.93rem;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.admin-sidebar .sb-nav a:hover {
  background: rgba(255,255,255,0.04);
  color: var(--accent);
}
.admin-sidebar .sb-nav a.active {
  background: rgba(33,158,188,0.18);
  color: var(--accent);
  border-left-color: var(--accent);
}
.admin-sidebar .sb-nav a i { width: 18px; text-align: center; }
.admin-sidebar .sb-foot {
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem;
}
.admin-sidebar .sb-foot a { color: var(--accent); }

.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  background: var(--white);
  padding: 14px 26px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 100;
}
.admin-topbar .page-title { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; color: var(--secondary); margin: 0; }
.admin-topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--gray-100);
  padding: 6px 14px;
  border-radius: 50px;
}
.admin-topbar .user-chip .ava {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-weight: 600;
}
.admin-topbar .toggle-side {
  display: none;
  background: none; border: none;
  font-size: 1.3rem;
  color: var(--secondary);
  cursor: pointer;
}

.admin-content { padding: 26px; flex: 1; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--white);
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  border-left: 4px solid var(--primary);
  transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.secondary { border-left-color: var(--secondary); }
.stat-card.sky { border-left-color: var(--sky); }
.stat-card .ico {
  width: 56px; height: 56px;
  background: var(--sky-light);
  color: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.stat-card.accent .ico { background: #fff4d6; color: #b67e00; }
.stat-card.secondary .ico { background: #d8e3eb; color: var(--secondary); }
.stat-card .meta .num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1;
}
.stat-card .meta .lbl { font-size: 0.85rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; }

/* ===== ADMIN CARD ===== */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 22px;
}
.admin-card .ad-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}
.admin-card .ad-head h3 { margin: 0; font-family: 'Cormorant Garamond', serif; color: var(--secondary); font-size: 1.4rem; }

/* ===== TABLE ===== */
.tbl-clean { width: 100%; border-collapse: collapse; }
.tbl-clean th { text-align: left; padding: 12px; background: var(--gray-100); font-weight: 600; color: var(--secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tbl-clean td { padding: 12px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.tbl-clean tr:hover { background: var(--gray-100); }
.tbl-clean .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.badge-status {
  display: inline-block; padding: 4px 10px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-status.sale { background: #fff4d6; color: #b67e00; }
.badge-status.rent { background: #d8edf5; color: var(--primary); }
.badge-status.new  { background: #ffe2e6; color: #d63b4a; }
.badge-status.read { background: var(--gray-100); color: var(--gray-500); }
.badge-status.available { background: #d8f0e0; color: #2a8048; }
.badge-status.sold,
.badge-status.rented { background: var(--gray-200); color: var(--gray-700); }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 0.85rem;
  margin: 0 2px;
}
.btn-icon:hover { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-icon.danger:hover { background: #d63b4a; border-color: #d63b4a; }

/* ===== FORMS ===== */
.admin-card label { font-size: 0.85rem; color: var(--secondary); margin-bottom: 6px; font-weight: 500; display: block; }
.admin-card .form-control, .admin-card .form-select { border: 1px solid var(--gray-200); border-radius: 6px; padding: 10px 14px; font-size: 0.93rem; height: 42px; }
.admin-card .form-control:focus, .admin-card .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(33,158,188,0.12);
}
.admin-card textarea.form-control { height: auto; }
.btn-primary-ecr {
  background: var(--primary); color: var(--white); border: none;
  padding: 11px 26px; border-radius: 6px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; transition: background var(--transition);
}
.btn-primary-ecr:hover { background: var(--secondary); color: var(--white); }
.btn-accent-ecr {
  background: var(--accent); color: var(--secondary); border: none;
  padding: 11px 26px; border-radius: 6px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; transition: background var(--transition);
}
.btn-accent-ecr:hover { background: var(--secondary); color: var(--accent); }
.btn-ghost {
  background: transparent; border: 1px solid var(--gray-200); color: var(--gray-700);
  padding: 11px 22px; border-radius: 6px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--secondary); }

/* ===== IMAGE UPLOAD ===== */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--gray-100);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: var(--sky-light);
}
.upload-area i { font-size: 2.3rem; color: var(--primary); margin-bottom: 10px; }
.upload-area .hint { color: var(--gray-500); font-size: 0.85rem; }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 10px; margin-top: 14px; }
.preview-grid .item { position: relative; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden; border: 2px solid var(--gray-200); }
.preview-grid .item img { width: 100%; height: 100%; object-fit: cover; }
.preview-grid .item .rm {
  position: absolute; top: 5px; right: 5px;
  background: rgba(214,59,74,0.95); color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.75rem;
}

/* Feature checkbox grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 8px; max-height: 280px; overflow-y: auto; padding: 10px; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.feature-grid label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  background: var(--gray-100);
  margin: 0;
  font-size: 0.88rem;
  cursor: pointer;
  font-weight: 500;
}
.feature-grid label:hover { background: var(--sky-light); }
.feature-grid label input { margin: 0; }
.feature-grid label i { color: var(--primary); }

/* Flash messages */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.flash.success { background: #d8f0e0; color: #2a8048; border-left: 4px solid #2a8048; }
.flash.error   { background: #ffe2e6; color: #d63b4a; border-left: 4px solid #d63b4a; }
.flash.warning { background: #fff4d6; color: #b67e00; border-left: 4px solid #b67e00; }

/* Responsive */
@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar .toggle-side { display: inline-flex; }
}

/* ============================================================ */
/*  LOGIN PAGE                                                  */
/* ============================================================ */
.login-page {
    margin: 0;
    min-height: 100vh;
    position: relative;
    font-family: 'DM Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-bg {
    position: fixed;
    inset: 0;
    background-image: linear-gradient(135deg, rgba(2,48,71,.92), rgba(33,158,188,.85)),
                      url('https://images.unsplash.com/photo-1560518883-ce09059eeffa?w=1600&q=80');
    background-size: cover;
    background-position: center;
    z-index: -1;
}
.login-shell {
    width: 100%;
    max-width: 460px;
}
.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 44px 38px 36px;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.login-card-head {
    text-align: center;
    margin-bottom: 24px;
}
.login-card-head .brand-mark {
    width: 64px; height: 64px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: var(--accent);
    font-weight: 800;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center; justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 10px 24px rgba(2,48,71,.25);
}
.login-card-head h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.85rem;
    color: var(--secondary);
    margin: 0;
}
.login-card-head p {
    color: #777;
    font-size: .92rem;
    margin: 6px 0 0;
}
.login-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    border-left: 4px solid #ef4444;
    font-size: .9rem;
}
.login-form .input-wrap {
    position: relative;
    margin-bottom: 16px;
}
.login-form .input-wrap input {
    width: 100%;
    padding: 14px 44px 14px 44px;
    border: 1px solid #e2e8ed;
    border-radius: 10px;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
}
.login-form .input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33,158,188,.1);
}
.login-form .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #99a;
}
.login-form .toggle-pwd {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #99a;
    cursor: pointer;
}
.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--secondary);
    color: var(--accent);
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .15s;
    margin-top: 4px;
}
.btn-login:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.back-link {
    display: block;
    text-align: center;
    margin-top: 22px;
    color: #777;
    text-decoration: none;
    font-size: .88rem;
}
.back-link:hover { color: var(--primary); }

/* ============================================================ */
/*  TABLES — Cell Thumb Row                                     */
/* ============================================================ */
.cell-thumb-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cell-thumb-row .thumb {
    width: 56px; height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.cell-thumb-row .thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* ============================================================ */
/*  FILTER BAR                                                  */
/* ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    background: #f9fafb;
    border-bottom: 1px solid #ecf0f3;
}
.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 220px;
}

/* ============================================================ */
/*  RECENT LISTINGS (dashboard)                                 */
/* ============================================================ */
.recent-listings { padding: 8px 0; }
.mini-prop {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f4f7;
    position: relative;
    transition: background .15s;
}
.mini-prop:hover { background: #fafbfc; }
.mini-prop:last-child { border-bottom: 0; }
.mini-thumb {
    width: 52px; height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-meta { flex: 1; min-width: 0; }
.mini-meta strong {
    display: block;
    color: var(--secondary);
    font-size: .94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-meta small { color: #888; font-size: .78rem; }
.mini-price {
    display: block;
    color: var(--primary);
    font-weight: 700;
    font-size: .85rem;
}

/* ============================================================ */
/*  BELL ICON                                                   */
/* ============================================================ */
.bell-icon {
    position: relative;
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--secondary);
    background: #f4f7fa;
    text-decoration: none;
    transition: background .2s;
}
.bell-icon:hover { background: var(--accent); color: var(--secondary); }
.bell-dot {
    position: absolute;
    top: -2px; right: -2px;
    background: #e74c3c;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center; justify-content: center;
}

/* ============================================================ */
/*  PURPOSE TOGGLE (radio pill)                                 */
/* ============================================================ */
.purpose-toggle {
    display: flex;
    gap: 10px;
}
.purpose-toggle label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}
.purpose-toggle input[type="radio"] {
    display: none;
}
.purpose-toggle span {
    display: block;
    text-align: center;
    padding: 12px 16px;
    background: #f4f7fa;
    border: 2px solid #e2e8ed;
    border-radius: 10px;
    color: #777;
    font-weight: 600;
    transition: all .2s;
}
.purpose-toggle span i { margin-right: 6px; }
.purpose-toggle input[type="radio"]:checked + span {
    background: var(--secondary);
    color: var(--accent);
    border-color: var(--secondary);
}

/* ============================================================ */
/*  FEATURED TOGGLE (switch)                                    */
/* ============================================================ */
.featured-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
}
.featured-toggle input { display: none; }
.featured-toggle .slider {
    width: 46px; height: 24px;
    background: #cbd5db;
    border-radius: 20px;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}
.featured-toggle .slider::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}
.featured-toggle input:checked + .slider {
    background: var(--primary);
}
.featured-toggle input:checked + .slider::after {
    transform: translateX(22px);
}
.featured-toggle .lbl {
    color: var(--secondary);
    font-weight: 600;
}
.featured-toggle .lbl i { color: var(--accent); margin-right: 4px; }

/* ============================================================ */
/*  CURRENT IMAGE                                               */
/* ============================================================ */
.current-image {
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f4f7fa;
}
.current-image img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================ */
/*  GALLERY PREVIEW THUMBS                                      */
/* ============================================================ */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.gal-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f4f7fa;
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb .btn-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(220,53,69,.92);
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: .7rem;
}
.gal-thumb .btn-remove:hover { background: #dc3545; }

/* Main image preview */
#main-image-preview {
    position: relative;
}
#main-image-preview img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
#main-image-preview .btn-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    background: rgba(220,53,69,.92);
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

/* ============================================================ */
/*  ADMIN TABS                                                  */
/* ============================================================ */
.admin-tabs {
    border-bottom: 2px solid #e2e8ed;
    gap: 4px;
}
.admin-tabs .nav-link {
    border: 0;
    background: transparent;
    color: #777;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 0;
    position: relative;
}
.admin-tabs .nav-link:hover { color: var(--primary); }
.admin-tabs .nav-link.active {
    color: var(--secondary);
    background: transparent;
}
.admin-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

/* Row unread highlight */
.tbl-clean .row-unread {
    background: #fff8e1;
}
.tbl-clean .row-unread td:first-child {
    border-left: 3px solid var(--accent);
}
.msg-cell {
    max-width: 300px;
    font-size: .88rem;
    color: #555;
    line-height: 1.55;
}

/* ============================================================ */
/*  INPUT ICON WRAP (password show/hide)                        */
/* ============================================================ */
.input-icon-wrap {
    position: relative;
}
.input-icon-wrap input {
    padding-right: 42px;
}
.input-icon-wrap .toggle-pwd {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #99a;
    cursor: pointer;
}
.input-icon-wrap .toggle-pwd:hover { color: var(--primary); }

/* btn-sm */
.btn-ghost.btn-sm,
.btn-primary-ecr.btn-sm {
    padding: 6px 12px;
    font-size: .82rem;
}

/* Brand mark/text in sidebar */
.admin-brand .brand-mark {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--secondary);
    font-weight: 800;
    border-radius: 10px;
    display: inline-flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}
.admin-brand .brand-text {
    line-height: 1.2;
}
.admin-brand .brand-text small {
    display: block;
    color: rgba(255,255,255,.5);
    font-size: .72rem;
}

/* ad-head-link */
.ad-head-link {
    color: var(--primary);
    font-size: .85rem;
    text-decoration: none;
    font-weight: 600;
}
.ad-head-link:hover { color: var(--secondary); }
.ad-head-link i { margin-left: 4px; font-size: .75rem; }

/* user chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-av {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--accent);
    font-weight: 700;
    display: inline-flex;
    align-items: center; justify-content: center;
}
.user-meta strong { display: block; font-size: .88rem; color: var(--secondary); line-height: 1.2; }
.user-meta small { color: #888; font-size: .72rem; }

/* Flash fade */
.flash.fade-out {
    opacity: 0;
    transition: opacity .8s;
}
.flash-close {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.4rem;
    margin-left: auto;
    cursor: pointer;
    line-height: 1;
    opacity: .6;
}
.flash-close:hover { opacity: 1; }

/* ============================================================ */
/*  FIXES & ADDITIONS                                            */
/* ============================================================ */

/* Map height (was missing — caused blank map area) */
#admin-map {
    height: 380px;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
}

/* Alias h4 to h3 styles inside .ad-head (templates use h4) */
.admin-card .ad-head h4 {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    color: var(--secondary);
    font-size: 1.4rem;
    font-weight: 600;
}
.admin-card .ad-head h4 i,
.admin-card .ad-head h3 i { color: var(--primary); margin-right: 6px; }

/* Topbar layout helpers */
.admin-topbar .topbar-right {
    display: flex; align-items: center; gap: 14px;
    margin-left: auto;
}
.admin-topbar .user-chip .user-meta { line-height: 1.15; }
.admin-topbar .user-chip .user-meta strong { display: block; font-size: 0.85rem; color: var(--secondary); }
.admin-topbar .user-chip .user-meta small { color: var(--gray-500); font-size: 0.72rem; }
.bell-icon {
    position: relative;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--secondary);
    background: var(--gray-100);
    text-decoration: none;
    transition: background var(--transition);
}
.bell-icon:hover { background: var(--accent); color: var(--secondary); }
.bell-dot {
    position: absolute;
    top: -2px; right: -2px;
    background: #d63b4a;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* sb-foot helper */
.admin-sidebar .sb-foot a {
    display: inline-flex; align-items: center; gap: 6px;
    line-height: 2;
    text-decoration: none;
}
.admin-sidebar .sb-foot a:hover { color: var(--white); }

/* Cell with thumbnail + text in tables */
.cell-thumb-row {
    display: flex; align-items: center; gap: 12px;
}
.cell-thumb-row .thumb {
    width: 56px; height: 56px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-100);
}
.cell-thumb-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell-thumb-row strong { color: var(--secondary); font-weight: 600; }

/* Table responsive container fix */
.table-responsive { overflow-x: auto; }

/* Filter bar above tables */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
    align-items: center;
}
.filter-bar .form-control,
.filter-bar .form-select { max-width: 240px; height: 42px; }

/* Purpose toggle (sale/rent radio pills) */
.purpose-toggle {
    display: flex; gap: 10px;
}
.purpose-toggle label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}
.purpose-toggle input[type="radio"] { display: none; }
.purpose-toggle span {
    display: block;
    text-align: center;
    padding: 12px 14px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-700);
    font-weight: 600;
    transition: all var(--transition);
}
.purpose-toggle span i { margin-right: 6px; color: var(--primary); }
.purpose-toggle input[type="radio"]:checked + span {
    background: var(--secondary);
    color: var(--accent);
    border-color: var(--secondary);
}
.purpose-toggle input[type="radio"]:checked + span i { color: var(--accent); }

/* Featured/published switch toggle */
.featured-toggle {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    margin: 0;
}
.featured-toggle input { display: none; }
.featured-toggle .slider {
    width: 46px; height: 24px;
    background: var(--gray-300);
    border-radius: 20px;
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}
.featured-toggle .slider::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.featured-toggle input:checked + .slider { background: var(--primary); }
.featured-toggle input:checked + .slider::after { transform: translateX(22px); }
.featured-toggle .lbl {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.95rem;
}
.featured-toggle .lbl i { color: var(--accent); margin-right: 4px; }

/* Current image preview (edit mode) */
.current-image {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-100);
}
.current-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Upload placeholder text inside .upload-area */
.upload-placeholder {
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
}
.upload-placeholder i { font-size: 2rem; color: var(--primary); }
.upload-placeholder span { color: var(--gray-500); font-size: 0.88rem; }

/* Main image preview */
#main-image-preview { display: block; cursor: pointer; }
#main-image-preview img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: var(--radius);
}
#main-image-preview .btn-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    background: rgba(214,59,74,0.95);
    color: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
#main-image-preview { position: relative; }

/* Gallery thumb preview (uses .gal-thumb) — keep alongside .preview-grid .item */
.gal-thumb {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--gray-200);
    background: var(--gray-100);
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-thumb .btn-remove {
    position: absolute; top: 5px; right: 5px;
    background: rgba(214,59,74,0.95); color: #fff;
    width: 24px; height: 24px;
    border: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.7rem;
}

/* Admin tabs (settings, enquiries) */
.admin-tabs {
    border-bottom: 2px solid var(--gray-200);
    gap: 4px;
    margin-bottom: 0;
}
.admin-tabs .nav-item button.nav-link {
    border: 0;
    background: transparent;
    color: var(--gray-500);
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 0;
    position: relative;
}
.admin-tabs .nav-item button.nav-link:hover { color: var(--primary); }
.admin-tabs .nav-item button.nav-link.active {
    color: var(--secondary);
    background: transparent;
}
.admin-tabs .nav-item button.nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

/* Unread message row */
.tbl-clean tr.row-unread { background: #fff8e1; }
.tbl-clean tr.row-unread:hover { background: #fff3c4; }
.tbl-clean tr.row-unread td:first-child { border-left: 3px solid var(--accent); }
.msg-cell {
    max-width: 320px;
    font-size: 0.88rem;
    color: var(--gray-700);
    line-height: 1.55;
}

/* Input icon wrap (password show/hide etc.) */
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 42px !important; }
.input-icon-wrap .toggle-pwd {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    cursor: pointer;
}
.input-icon-wrap .toggle-pwd:hover { color: var(--primary); }

/* Dashboard recent listings (mini-prop tiles) */
.recent-listings { display: flex; flex-direction: column; }
.mini-prop {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.mini-prop:hover { background: var(--gray-100); }
.mini-prop:last-child { border-bottom: 0; }
.mini-thumb {
    width: 52px; height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-100);
}
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-meta { flex: 1; min-width: 0; }
.mini-meta strong {
    display: block;
    color: var(--secondary);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-meta small { color: var(--gray-500); font-size: 0.78rem; display: block; }
.mini-meta .mini-price { color: var(--primary); font-weight: 700; font-size: 0.82rem; }

/* Header link in admin-card head */
.ad-head-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}
.ad-head-link:hover { color: var(--secondary); }
.ad-head-link i { margin-left: 4px; font-size: 0.72rem; }

/* Button sizes */
.btn-primary-ecr.btn-sm,
.btn-ghost.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-primary-ecr.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* Login (newer markup) overrides legacy login-card */
.login-page { background: none; }
.login-bg {
    position: fixed; inset: 0; z-index: -1;
    background:
        linear-gradient(135deg, rgba(2,48,71,.92), rgba(33,158,188,.85)),
        url('https://images.unsplash.com/photo-1560518883-ce09059eeffa?w=1600') center/cover;
}
.login-shell { width: 100%; max-width: 460px; }
.login-card-head { text-align: center; margin-bottom: 26px; }
.login-card-head .brand-mark {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: var(--accent);
    font-weight: 800;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center; justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 10px 24px rgba(2,48,71,0.25);
}
.login-card-head h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.85rem;
    color: var(--secondary);
    margin: 0;
}
.login-card-head p { color: var(--gray-500); font-size: 0.92rem; margin: 6px 0 0; }
.login-form .input-wrap {
    position: relative;
    margin-bottom: 16px;
}
.login-form .input-wrap input {
    width: 100%;
    padding: 13px 44px 13px 44px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
}
.login-form .input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33,158,188,0.12);
}
.login-form .input-icon {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}
.login-form .toggle-pwd {
    position: absolute;
    right: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    cursor: pointer;
}
.btn-login {
    width: 100%;
    padding: 13px;
    background: var(--secondary);
    color: var(--accent);
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.95rem;
}
.btn-login:hover { background: var(--primary); color: var(--white); }
.login-error {
    background: #ffe2e6;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    border-left: 4px solid #d63b4a;
    font-size: 0.9rem;
}
.back-link {
    display: block; text-align: center;
    margin-top: 22px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.88rem;
}
.back-link:hover { color: var(--primary); }

/* Pretty up NiceSelect inside admin */
.nice-select { width: 100%; height: 42px; line-height: 40px; }

/* Quill editor surface */
.ql-toolbar.ql-snow {
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius) var(--radius) 0 0;
}
.ql-container.ql-snow {
    border: 1px solid var(--gray-200) !important;
    border-top: 0 !important;
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: 'DM Sans', sans-serif;
}
.ql-editor { min-height: 220px; }

/* Tab content spacing */
.tab-content > .tab-pane { padding-top: 18px; }

/* Flash close button */
.flash-close {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.3rem;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.6;
    line-height: 1;
}
.flash-close:hover { opacity: 1; }
.flash {
    display: flex; align-items: center; gap: 10px;
}
.flash.fade-out { opacity: 0; transition: opacity .8s; }

/* Confirm-delete cursor */
.confirm-delete { cursor: pointer; }

/* Empty state in tables */
.empty-state-row { padding: 40px 20px; }
