/* ============================================
   Ordo Real Estate CRM — Design System
   ============================================ */
:root {
  --brand-purple: #3D1A6E;
  --brand-purple-dark: #2A1250;
  --brand-purple-light: #6B40A8;
  --brand-orange: #F2A93B;
  --brand-orange-dark: #D88B1F;

  --bg: #F7F6FB;
  --surface: #FFFFFF;
  --surface-2: #FAFAFC;
  --border: #E8E6EF;
  --border-strong: #D4D1DE;

  --text: #1A1430;
  --text-muted: #6B6582;
  --text-soft: #94909F;

  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(20, 14, 48, 0.04);
  --shadow: 0 4px 12px rgba(20, 14, 48, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 14, 48, 0.1);
  --shadow-xl: 0 24px 60px rgba(20, 14, 48, 0.15);

  --sidebar-w: 250px;
  --topbar-h: 64px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-purple); text-decoration: none; }
a:hover { color: var(--brand-purple-dark); }

img { max-width: 100%; display: block; }

/* ============================================
   AUTH (Login / Register)
   ============================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-hero {
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-dark) 100%);
  color: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 360px; height: 360px;
  background: var(--brand-orange);
  opacity: 0.18;
  border-radius: 12px;
  transform: rotate(15deg);
}

.auth-hero::after {
  content: '';
  position: absolute;
  bottom: -180px; left: -180px;
  width: 400px; height: 400px;
  border: 30px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.auth-hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.auth-hero-brand img { width: 44px; height: 44px; }
.auth-hero-brand span {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-hero-content {
  position: relative;
  z-index: 2;
  max-width: 440px;
}
.auth-hero-content h1 {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
}
.auth-hero-content h1 .accent { color: var(--brand-orange); }
.auth-hero-content p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
}

.auth-hero-stats {
  display: flex;
  gap: 32px;
  position: relative;
  z-index: 2;
}
.auth-hero-stats .stat strong {
  display: block;
  font-size: 26px;
  font-weight: 700;
}
.auth-hero-stats .stat span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.auth-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px rgba(61, 26, 110, 0.1);
}

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 13px; }
.field-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.field-row a { font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand-purple);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-purple-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-accent {
  background: var(--brand-orange);
  color: #1A1430;
}
.btn-accent:hover { background: var(--brand-orange-dark); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  font-size: 12px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }

.auth-footer-text { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 28px; }

/* ============================================
   APP LAYOUT (Dashboard, etc)
   ============================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { width: 32px; height: 32px; }
.sidebar-brand strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-soft);
  padding: 12px 12px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-light) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(61, 26, 110, 0.25);
}
.nav-item.active:hover { color: #fff; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-orange));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 13px; }
.user-info span { font-size: 12px; color: var(--text-muted); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  width: 280px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  flex: 1;
  color: var(--text);
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--brand-orange);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.content { padding: 28px 32px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* Cards & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.stat-card .delta { font-size: 12px; font-weight: 500; }
.stat-card .delta.up { color: var(--success); }
.stat-card .delta.down { color: var(--danger); }
.stat-card .stat-icon {
  position: absolute;
  top: 18px; right: 18px;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.purple { background: rgba(61, 26, 110, 0.1); color: var(--brand-purple); }
.stat-icon.orange { background: rgba(242, 169, 59, 0.15); color: var(--brand-orange-dark); }
.stat-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--info); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

.row-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 28px; }
@media (max-width: 1100px) { .row-grid { grid-template-columns: 1fr; } }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pill-success { background: #DCFCE7; color: #15803D; }
.pill-warning { background: #FEF3C7; color: #B45309; }
.pill-info    { background: #DBEAFE; color: #1D4ED8; }
.pill-purple  { background: #EDE5F9; color: var(--brand-purple); }
.pill-orange  { background: #FEF3D9; color: var(--brand-orange-dark); }
.pill-danger  { background: #FEE2E2; color: #B91C1C; }
.pill-muted   { background: #F1F0F5; color: var(--text-muted); }

.activity-list { display: flex; flex-direction: column; gap: 4px; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
}
.activity-item:hover { background: var(--surface-2); }
.activity-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-meta { flex: 1; min-width: 0; }
.activity-meta strong { display: block; font-size: 13px; font-weight: 600; }
.activity-meta span { font-size: 12px; color: var(--text-muted); }

/* Empty / muted */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .search-box { display: none; }
}
