/* ============================================================
   LONDON PROPERTY BROKERAGE LIMITED — CRM STYLESHEET
   Colours: Navy #0d2545 | Gold #c8a84b | Cream #faf8f4
   Fonts: Cormorant Garamond (headings) | DM Sans (body)
   ============================================================ */

:root {
  --navy:        #0d2545;
  --navy-mid:    #162f55;
  --navy-light:  #1e3d6b;
  --gold:        #c8a84b;
  --gold-light:  #e2c97e;
  --gold-pale:   #f5edd8;
  --cream:       #faf8f4;
  --white:       #ffffff;
  --text:        #1a1a2e;
  --text-mid:    #4a5568;
  --text-light:  #718096;
  --border:      #e2ddd6;
  --border-dark: #c8c0b4;
  --success:     #276749;
  --success-bg:  #f0fdf4;
  --warning:     #92400e;
  --warning-bg:  #fffbeb;
  --danger:      #9b1c1c;
  --danger-bg:   #fff5f5;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(13,37,69,.12);
  --shadow-lg:   0 8px 32px rgba(13,37,69,.18);
  --transition:  all .2s ease;
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(200,168,75,.2);
}

.brand-mark {
  width: 42px; height: 42px;
  background: var(--gold);
  color: var(--navy);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  letter-spacing: .05em;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name  { color: var(--white); font-size: .8rem; font-weight: 600; line-height: 1.3; }
.brand-sub   { color: var(--gold); font-size: .68rem; opacity: .85; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-section-label {
  color: rgba(200,168,75,.6);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 16px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 400;
  margin-bottom: 2px;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--white);
}

.nav-item.nav-active {
  background: rgba(200,168,75,.15);
  color: var(--gold-light);
  font-weight: 500;
}

.nav-icon { font-size: 1rem; width: 20px; text-align: center; opacity: .8; }

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  flex-shrink: 0;
}

.user-details { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.user-name { color: var(--white); font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--gold); font-size: .68rem; opacity: .8; }

.logout-btn {
  color: rgba(255,255,255,.4);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 4px;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--white); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  gap: 8px;
  flex: 1;
  max-width: 480px;
}

.search-icon { color: var(--text-light); font-size: 1.1rem; }

.search-input {
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: .875rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  flex: 1;
  outline: none;
}

.search-input::placeholder { color: var(--text-light); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date { color: var(--text-light); font-size: .8rem; }
.topbar-btn { color: var(--text-mid); text-decoration: none; font-size: 1.1rem; }
.topbar-btn:hover { color: var(--navy); }

/* ---- PAGE STRUCTURE ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 28px 0;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
}

.page-sub { color: var(--text-light); font-size: .9rem; margin-top: 4px; }

.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- ALERT BANNER ---- */
.alert-banner {
  margin: 20px 28px 0;
  background: var(--warning-bg);
  border: 1px solid #f6ad55;
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  color: var(--warning);
}

.alert-banner a { color: var(--warning); font-weight: 600; }
.alert-icon { font-size: 1rem; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 24px 28px 0;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.stat-card--gold {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.stat-card--gold .stat-label,
.stat-card--gold .stat-sub { color: rgba(255,255,255,.65); }
.stat-card--gold .stat-value { color: var(--gold); }

.stat-card--wide { grid-column: span 2; }

.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; font-weight: 700; color: var(--navy); line-height: 1.1; margin: 6px 0 4px; }
.stat-sub   { font-size: .75rem; color: var(--text-light); }

/* ---- DASHBOARD GRID ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 28px 28px;
}

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card--full { grid-column: 1 / -1; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
}

.card-link { font-size: .8rem; color: var(--gold); text-decoration: none; font-weight: 500; }
.card-link:hover { color: var(--navy); }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cream); }
.data-table a { color: var(--navy); text-decoration: none; font-weight: 500; }
.data-table a:hover { color: var(--gold); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .03em;
}

.badge--active          { background: #d1fae5; color: #065f46; }
.badge--instruction     { background: #e0e7ff; color: #3730a3; }
.badge--under-offer     { background: #fef3c7; color: #92400e; }
.badge--exchanged       { background: #d1fae5; color: #065f46; }
.badge--completed       { background: var(--navy); color: var(--gold); }
.badge--withdrawn       { background: #fee2e2; color: #991b1b; }
.badge--sold            { background: var(--navy); color: var(--white); }
.badge--verified        { background: #d1fae5; color: #065f46; }
.badge--pending         { background: #fef3c7; color: #92400e; }
.badge--failed          { background: #fee2e2; color: #991b1b; }
.badge--in-progress     { background: #e0e7ff; color: #3730a3; }

/* ---- ACTIVITY LOG ---- */
.activity-list { padding: 0 20px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.activity-text { font-size: .875rem; color: var(--text); }
.activity-meta { font-size: .75rem; color: var(--text-light); }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--navy-light); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--navy);
  padding: 9px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-secondary:hover { background: var(--navy); color: var(--white); }

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-gold:hover { background: var(--gold-light); box-shadow: var(--shadow-md); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1.5px solid #feb2b2;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

/* ---- FORMS ---- */
.form-page { padding: 28px; max-width: 900px; }

.form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.form-section-header {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

.form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid--1 { grid-template-columns: 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

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

.form-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(13,37,69,.08);
}

.form-control:disabled { background: var(--cream); color: var(--text-light); }

textarea.form-control { min-height: 100px; resize: vertical; }

.form-hint { font-size: .75rem; color: var(--text-light); }

.form-actions {
  display: flex;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--white);
  position: sticky;
  bottom: 0;
}

/* ---- PROPERTY CARDS ---- */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 24px 28px;
}

.property-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

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

.property-card-img {
  height: 200px;
  background: linear-gradient(135deg, var(--navy-light), var(--navy));
  position: relative;
  overflow: hidden;
}

.property-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.property-card-img .no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(200,168,75,.5);
  font-size: 3rem;
}

.property-card-status {
  position: absolute;
  top: 12px; right: 12px;
}

.property-card-body { padding: 16px; flex: 1; }
.property-card-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.property-card-address {
  font-size: .875rem;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.property-card-specs {
  display: flex;
  gap: 16px;
  font-size: .78rem;
  color: var(--text-light);
}

.spec-item { display: flex; align-items: center; gap: 4px; }

/* ---- FILTERS / LIST VIEW ---- */
.list-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  flex-wrap: wrap;
}

.filter-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--navy); }

.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.view-btn {
  padding: 7px 12px;
  background: var(--white);
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: .9rem;
}

.view-btn.active { background: var(--navy); color: var(--white); }

/* ---- COMPLIANCE ---- */
.compliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 24px 28px;
}

.compliance-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.compliance-card--warning { border-left: 4px solid #f6ad55; }
.compliance-card--ok      { border-left: 4px solid #48bb78; }
.compliance-card--danger  { border-left: 4px solid #fc8181; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  color: var(--text-light);
  font-size: .875rem;
  padding: 1rem;
}

.empty-state a { color: var(--gold); font-weight: 500; }

/* ---- LOGIN ---- */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-brand { text-align: center; margin-bottom: 32px; }
.login-mark {
  width: 60px; height: 60px;
  background: var(--gold);
  color: var(--navy);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 10px;
  margin-bottom: 16px;
  letter-spacing: .05em;
}

.login-title { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: var(--navy); font-weight: 600; }
.login-sub { color: var(--text-light); font-size: .85rem; margin-top: 4px; }
.login-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #feb2b2; border-radius: var(--radius); padding: 10px 14px; font-size: .875rem; margin-bottom: 20px; }

/* ---- FILE UPLOAD ---- */
.upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--cream);
}

.upload-zone:hover { border-color: var(--gold); background: var(--gold-pale); }
.upload-zone-icon { font-size: 2rem; color: var(--text-light); margin-bottom: 8px; }
.upload-zone-text { font-size: .875rem; color: var(--text-mid); }
.upload-zone-hint { font-size: .75rem; color: var(--text-light); margin-top: 4px; }

/* ---- MATCHING ---- */
.match-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  font-weight: 700;
  font-size: .85rem;
  font-family: 'Cormorant Garamond', serif;
}

.match-score--high   { background: #d1fae5; color: #065f46; }
.match-score--medium { background: #fef3c7; color: #92400e; }
.match-score--low    { background: #fee2e2; color: #991b1b; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 1fr 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
}

@media (max-width: 680px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card--wide { grid-column: span 2; }
}

/* ---- UTILITIES ---- */
.text-gold  { color: var(--gold); }
.text-navy  { color: var(--navy); }
.text-light { color: var(--text-light); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.p-4  { padding: 16px; }
.p-6  { padding: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.font-serif { font-family: 'Cormorant Garamond', serif; }
