/* ===== PROPAPP - RESPONSIVE CSS ===== */
:root {
  --primary: #1a56e8;
  --primary-d: #1341c0;
  --primary-l: #e8f0fe;
  --accent: #00c896;
  --accent2: #ff6b35;
  --danger: #e53935;
  --warning: #f59e0b;
  --bg: #f4f6fb;
  --card: #fff;
  --sidebar: #0f172a;
  --sidebar-t: #94a3b8;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --r: 12px;
  --rsm: 8px;
  --sb-w: 230px;
  --tb-h: 58px;
  font-family: 'DM Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #0f172a, #1e3a8a); padding: 20px; }
.login-box { background: #fff; border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { width: 60px; height: 60px; background: var(--primary); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; margin: 0 auto 16px; }
.login-title { text-align: center; font-size: 26px; font-weight: 900; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-hint { text-align: center; font-size: 12px; color: #94a3b8; margin-top: 12px; }

/* ===== SIDEBAR ===== */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sb-w); height: 100vh; background: var(--sidebar); display: flex; flex-direction: column; z-index: 200; transition: transform .3s; }
.sb-logo { padding: 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sb-logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
.sb-logo-text { font-size: 18px; font-weight: 900; color: #fff; }
.sb-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sb-section { padding: 10px 16px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.25); font-weight: 700; }
.sb-link { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--sidebar-t); border-left: 3px solid transparent; font-size: 14px; font-weight: 500; transition: all .2s; position: relative; }
.sb-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.sb-link.active { color: #fff; background: rgba(26,86,232,.18); border-left-color: var(--primary); }
.sb-link i { width: 18px; text-align: center; font-size: 15px; }
.sb-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 700; }
.sb-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px; }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { color: var(--sidebar-t); font-size: 11px; text-transform: capitalize; }
.sb-logout { color: var(--sidebar-t); font-size: 16px; cursor: pointer; transition: color .2s; }
.sb-logout:hover { color: var(--danger); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }

/* ===== MAIN WRAP ===== */
.main-wrap { margin-left: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ===== TOPBAR ===== */
.topbar { height: var(--tb-h); background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.tb-left { display: flex; align-items: center; gap: 12px; }
.tb-title { font-size: 17px; font-weight: 800; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.hamburger { display: none; width: 36px; height: 36px; background: var(--bg); border: none; border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--text); align-items: center; justify-content: center; }
.tb-icon-btn { width: 36px; height: 36px; background: var(--bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 16px; position: relative; }
.tb-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }

/* ===== PAGE CONTENT ===== */
.page-content { padding: 20px; flex: 1; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--r); padding: 18px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.si-bl { background: #e8f0fe; color: var(--primary); }
.si-gn { background: #e6f9f3; color: var(--accent); }
.si-or { background: #fff3ed; color: var(--accent2); }
.si-rd { background: #fef2f2; color: var(--danger); }
.si-pu { background: #f3e8ff; color: #7c3aed; }
.si-yw { background: #fffbeb; color: var(--warning); }
.stat-info { flex: 1; }
.stat-val { font-size: 26px; font-weight: 900; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ===== CARDS ===== */
.card { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 800; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--rsm); border: none; cursor: pointer; font-size: 13px; font-weight: 700; transition: all .18s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-wa { background: #25d366; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ===== FORMS ===== */
.form-section { margin-bottom: 20px; }
.form-section-title { font-size: 12px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; display: flex; align-items: center; gap: 5px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-l); }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-label .req { color: var(--danger); }
.form-control { width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--rsm); font-size: 14px; color: var(--text); background: #fff; transition: border-color .2s; -webkit-appearance: none; }
.form-control:focus { outline: none; border-color: var(--primary); }
.form-control::placeholder { color: #94a3b8; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.toggle-group { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-opt { padding: 8px 16px; border: 1.5px solid var(--border); border-radius: var(--rsm); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .18s; }
.toggle-opt:hover { border-color: var(--primary); color: var(--primary); }
.toggle-opt.selected { border-color: var(--primary); background: var(--primary); color: #fff; }
.toggle-opt.selected-green { border-color: var(--accent); background: var(--accent); color: #fff; }
.auto-label { background: #e6f9f3; color: #0d7a52; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 8px; margin-left: 6px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ===== STEPS ===== */
.step-bar { display: flex; align-items: center; background: #fff; border-radius: var(--r); padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); overflow-x: auto; gap: 0; }
.step-item { display: flex; align-items: center; flex: 1; min-width: 100px; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; transition: all .3s; }
.sd-done { background: var(--accent); color: #fff; }
.sd-active { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-l); }
.sd-idle { background: var(--border); color: var(--muted); }
.step-info { margin-left: 8px; }
.step-num { font-size: 10px; color: var(--muted); }
.step-name { font-size: 12px; font-weight: 700; }
.step-name.done { color: var(--accent); }
.step-name.active { color: var(--primary); }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; }
.step-line.done { background: var(--accent); }

/* ===== PROPERTY CARDS ===== */
.prop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.prop-card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; border: 1.5px solid transparent; }
.prop-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(26,86,232,.15); }
.prop-thumb { width: 100%; height: 170px; background: linear-gradient(135deg, #e8f0fe, #dbeafe); display: flex; align-items: center; justify-content: center; font-size: 52px; position: relative; overflow: hidden; }
.prop-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prop-thumb-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.45)); }
.prop-status { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.ps-av { background: rgba(0,200,150,.9); color: #fff; }
.ps-so { background: rgba(229,57,53,.9); color: #fff; }
.ps-ho { background: rgba(245,158,11,.9); color: #fff; }
.prop-id-tag { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.prop-body { padding: 13px 14px 14px; }
.prop-type-label { font-size: 11px; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.prop-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.prop-loc { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.prop-price { font-size: 20px; font-weight: 900; color: var(--primary); }
.prop-rate { font-size: 12px; color: var(--muted); margin-top: 1px; }
.prop-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.chip { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.chip-g { background: #e6f9f3; color: #0d7a52; border-color: #a7f3d0; }
.chip-b { background: var(--primary-l); color: var(--primary); border-color: #bfdbfe; }
.prop-actions { display: flex; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg); padding: 10px 13px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; text-align: left; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 11px 13px; font-size: 13px; }
tbody tr:last-child { border-bottom: none; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.badge-av { background: #e6f9f3; color: #0d7a52; }
.badge-so { background: #fef2f2; color: #c53030; }
.badge-ho { background: #fffbeb; color: #92400e; }
.badge-pr { background: var(--primary-l); color: var(--primary); }

/* ===== FILTER BAR ===== */
.filter-bar { background: var(--card); border-radius: var(--r); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.filter-item select, .filter-item input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--rsm); font-size: 13px; min-width: 130px; font-family: inherit; }
.filter-item select:focus, .filter-item input:focus { outline: none; border-color: var(--primary); }

/* ===== DETAIL PAGE ===== */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.detail-item { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.detail-lbl { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 3px; }
.detail-val { font-size: 14px; font-weight: 700; }

/* ===== SHARE VIEW ===== */
.share-card { background: #fff; border-radius: var(--r); overflow: hidden; max-width: 480px; margin: 0 auto; box-shadow: var(--shadow-lg); }
.share-hdr { background: var(--primary); color: #fff; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; }
.share-photo { width: 100%; height: 220px; background: linear-gradient(135deg, #e8f0fe, #bfdbfe); display: flex; align-items: center; justify-content: center; font-size: 64px; }
.share-photo img { width: 100%; height: 100%; object-fit: cover; }
.share-body { padding: 16px; }
.share-price { font-size: 28px; font-weight: 900; color: var(--primary); }
.share-highlights { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.share-hi { background: var(--bg); border-radius: 8px; padding: 10px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.share-hi i { color: var(--primary); width: 16px; }
.share-acts { display: flex; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }

/* ===== FOLLOW-UP ===== */
.fu-card { background: var(--card); border-radius: var(--rsm); padding: 13px; margin-bottom: 8px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.fu-card.overdue { border-left-color: var(--danger); }
.fu-card.today { border-left-color: var(--warning); }
.fu-card.done { border-left-color: var(--accent); opacity: .75; }

/* ===== MISC ===== */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: .2; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 15px; font-weight: 800; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 900; color: #fff; flex-shrink: 0; }
.fw7 { font-weight: 700; }
.fw8 { font-weight: 800; }
.text-p { color: var(--primary); }
.text-m { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.flex { display: flex; }
.fca { display: flex; align-items: center; }
.g2 { gap: 8px; }
.mt2 { margin-top: 8px; }
.mt3 { margin-top: 12px; }
.mb2 { margin-bottom: 8px; }
.w100 { width: 100%; }
.internal-note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #92400e; }
.alert { padding: 12px 16px; border-radius: var(--rsm); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.alert-success { background: #e6f9f3; color: #0d7a52; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #c53030; border: 1px solid #fecaca; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 999; background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; opacity: 0; transform: translateY(16px); transition: all .3s; pointer-events: none; max-width: 320px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .prop-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .prop-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .filter-bar { gap: 8px; }
  .page-content { padding: 14px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .hide-xs { display: none; }
  .step-bar { padding: 12px 14px; gap: 2px; }
  .step-info { display: none; }
}

@media (max-width: 480px) {
  .prop-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-ico { width: 40px; height: 40px; font-size: 17px; }
  .stat-val { font-size: 22px; }
  .share-highlights { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}
