/* ============================================
   RAJE REALTY CRM — GLOBAL DESIGN SYSTEM
   Fonts: Playfair Display + DM Sans + DM Mono
   Theme: Luxury Minimal — White/Grey/Navy/Gold
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg-primary:     #FFFFFF;
  --bg-secondary:   #F4F5F7;
  --bg-card:        #FFFFFF;
  --bg-sidebar:     #0F2545;
  --bg-sidebar-hover: #1B3A6B;
  --border:         #E2E4EA;
  --border-light:   #F0F1F4;
  --text-primary:   #0F1F3D;
  --text-secondary: #5A6478;
  --text-muted:     #9BA3B5;
  --text-sidebar:   #C8D4E8;
  --navy:           #1B3A6B;
  --navy-dark:      #0F2545;
  --navy-light:     #2C5299;
  --gold:           #C9A84C;
  --gold-light:     #E8C96A;
  --gold-pale:      #FBF5E6;
  --green:          #2E7D32;
  --green-light:    #E8F5E9;
  --amber:          #E65100;
  --amber-light:    #FFF3E0;
  --red:            #C62828;
  --red-light:      #FFEBEE;
  --teal:           #00695C;
  --teal-light:     #E0F2F1;
  --shadow-sm:      0 1px 4px rgba(15,31,61,0.06);
  --shadow-md:      0 4px 16px rgba(15,31,61,0.10);
  --shadow-lg:      0 8px 32px rgba(15,31,61,0.14);
  --shadow-card:    0 2px 12px rgba(15,31,61,0.08);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --sidebar-width:  240px;
  --topbar-height:  64px;
  --transition:     all 0.2s ease;
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; line-height: 1.25; color: var(--text-primary); }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; font-family: 'DM Sans', sans-serif; }
p { font-size: 1rem; color: var(--text-secondary); }
small { font-size: 0.825rem; color: var(--text-muted); }

.mono { font-family: 'DM Mono', monospace; }
.text-navy { color: var(--navy); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

/* ─── Layout Shell ─── */
.crm-shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-mark {
  width: 40px; height: 40px;
  background: var(--gold);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700; font-size: 1.1rem;
  color: var(--navy-dark); flex-shrink: 0;
}
.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-text span:first-child {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 700;
  color: #FFFFFF; letter-spacing: 0.03em;
}
.sidebar-logo-text span:last-child {
  font-size: 0.7rem; color: var(--gold);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section-label {
  font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(200,212,232,0.45);
  padding: 12px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(201,168,76,0.15); color: #FFFFFF; border-left-color: var(--gold); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  min-width: 20px; text-align: center;
}
.nav-badge.gold { background: var(--gold); color: var(--navy-dark); }
.nav-badge.green { background: var(--green); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-agent { display: flex; align-items: center; gap: 10px; }
.agent-avatar {
  width: 34px; height: 34px; background: var(--gold);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; color: var(--navy-dark); flex-shrink: 0;
}
.agent-info span:first-child { display: block; font-size: 0.85rem; font-weight: 600; color: #fff; }
.agent-info span:last-child { font-size: 0.7rem; color: var(--text-sidebar); }

/* ─── Main Content ─── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 600; }
.topbar-search { flex: 1; max-width: 420px; position: relative; }
.topbar-search input {
  width: 100%; height: 40px;
  padding: 0 16px 0 42px;
  border: 1.5px solid var(--border); border-radius: 20px;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  background: var(--bg-secondary); color: var(--text-primary);
  transition: var(--transition); outline: none;
}
.topbar-search input:focus { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(27,58,107,0.08); }
.topbar-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-icon-btn {
  width: 38px; height: 38px;
  border: 1.5px solid var(--border); background: var(--bg-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  position: relative; color: var(--text-secondary);
}
.topbar-icon-btn:hover { border-color: var(--navy); color: var(--navy); background: var(--bg-secondary); }
.topbar-icon-btn svg { width: 18px; height: 18px; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid #fff; }

/* ─── Page Body ─── */
.page-body { padding: 28px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.page-header p { font-size: 0.9rem; color: var(--text-muted); }

/* ─── Cards ─── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 24px; }
.card-sm { padding: 16px 20px; }
.card-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }

/* ─── Stat Tiles ─── */
.stat-tile {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: var(--transition-slow);
  position: relative; overflow: hidden;
  text-decoration: none; display: block;
}
.stat-tile::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--navy); transform: scaleX(0); transform-origin: left; transition: var(--transition-slow);
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--navy); }
.stat-tile:hover::before { transform: scaleX(1); }
.stat-tile.gold-accent::before { background: var(--gold); }
.stat-tile.green-accent::before { background: var(--green); }
.stat-tile.red-accent::before { background: var(--red); }
.stat-tile.amber-accent::before { background: var(--amber); }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.navy { background: rgba(27,58,107,0.1); color: var(--navy); }
.stat-icon.gold { background: var(--gold-pale); color: var(--gold); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.teal { background: var(--teal-light); color: var(--teal); }
.stat-icon.amber { background: var(--amber-light); color: var(--amber); }
.stat-value { font-family: 'DM Mono', monospace; font-size: 2rem; font-weight: 500; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.stat-delta { font-size: 0.75rem; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 3px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ─── Grids ─── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 20px; height: 44px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  border: none; outline: none; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); box-shadow: 0 4px 14px rgba(27,58,107,0.30); transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--navy-dark); }
.btn-gold:hover { background: var(--gold-light); box-shadow: 0 4px 14px rgba(201,168,76,0.35); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 0.8rem; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 1rem; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #1b5e20; }
.btn-red { background: var(--red); color: #fff; }

/* ─── Badges ─── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; line-height: 1.4; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-navy { background: rgba(27,58,107,0.1); color: var(--navy); }
.badge-gold { background: var(--gold-pale); color: #856A1A; }
.badge-grey { background: #F0F1F4; color: var(--text-secondary); }
.badge-teal { background: var(--teal-light); color: var(--teal); }

/* ─── Tables ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { text-align: left; padding: 10px 16px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border); background: var(--bg-secondary); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(27,58,107,0.02); }
.data-table tr.hot-lead td:first-child { border-left: 3px solid var(--red); }
.data-table tr.warm-lead td:first-child { border-left: 3px solid var(--gold); }
.data-table tr.cold-lead td:first-child { border-left: 3px solid var(--border); }

/* ─── Forms ─── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  color: var(--text-primary); background: var(--bg-primary);
  transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,58,107,0.10); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6478' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ─── Section Headers ─── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-header h3 { font-size: 1rem; color: var(--text-primary); }
.section-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Urgency colours ─── */
.urgency-15 { color: var(--green); }
.urgency-10 { color: var(--teal); }
.urgency-7  { color: #F9A825; }
.urgency-2  { color: var(--amber); }
.urgency-1  { color: var(--red); }
.urgency-expired { color: var(--text-muted); text-decoration: line-through; }

/* ─── Skeleton ─── */
.skeleton { background: linear-gradient(90deg,#f0f1f4 25%,#e2e4ea 50%,#f0f1f4 75%); background-size: 200% 100%; animation: skeleton-pulse 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-pulse { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ─── Alerts ─── */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--radius-md); font-size: 0.875rem; border-left: 4px solid; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--amber-light); border-color: var(--amber); color: #7B3F00; }
.alert-danger   { background: var(--red-light);   border-color: var(--red);   color: var(--red); }
.alert-success  { background: var(--green-light);  border-color: var(--green); color: var(--green); }
.alert-info     { background: rgba(27,58,107,0.06); border-color: var(--navy); color: var(--navy); }

/* ─── Tabs ─── */
.tab-bar { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; font-family: 'DM Sans', sans-serif; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modal ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,31,61,0.55); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-primary); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; transform: translateY(20px); transition: transform 0.25s ease; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 860px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-close { width: 32px; height: 32px; border: 1px solid var(--border); background: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: var(--transition); }
.modal-close:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Utilities ─── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-4{gap:4px}.gap-8{gap:8px}.gap-12{gap:12px}.gap-16{gap:16px}.gap-20{gap:20px}.gap-24{gap:24px}
.mb-4{margin-bottom:4px}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}
.mt-auto{margin-top:auto}.w-full{width:100%}.text-right{text-align:right}.text-center{text-align:center}.overflow-hidden{overflow:hidden}

/* ─── Animations ─── */
@keyframes fadeInUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse-ring { 0%,100%{box-shadow:0 0 0 0 rgba(198,40,40,0.4)} 50%{box-shadow:0 0 0 8px rgba(198,40,40,0)} }
.fade-in{animation:fadeInUp 0.4s ease both}
.fade-in-1{animation-delay:0.05s}.fade-in-2{animation-delay:0.10s}.fade-in-3{animation-delay:0.15s}
.fade-in-4{animation-delay:0.20s}.fade-in-5{animation-delay:0.25s}.fade-in-6{animation-delay:0.30s}
.pulse-red{animation:pulse-ring 2s ease-in-out infinite}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — PHASE 4A
   Breakpoints: 1024px | 768px | 480px
   ═══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  :root { --sidebar-width: 200px; }
  .grid-6 { grid-template-columns: repeat(3,1fr); }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .advisor-layout,.reg-layout,.deals-lower,.dashboard-lower { grid-template-columns: 1fr; }
  .broker-grid,.projects-grid { grid-template-columns: repeat(2,1fr); }
  .calc-layout { grid-template-columns: 1fr; }
  .agent-grid  { grid-template-columns: repeat(2,1fr); }
  .admin-layout { grid-template-columns: 180px 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; --topbar-height: 60px; }

  .sidebar { width:260px; transform:translateX(-260px); transition:transform 0.3s cubic-bezier(0.4,0,0.2,1); z-index:300; }
  .sidebar.open { transform:translateX(0); box-shadow:4px 0 24px rgba(15,31,61,0.25); }
  .sidebar-backdrop { display:none; position:fixed; inset:0; background:rgba(15,31,61,0.5); z-index:299; }
  .sidebar-backdrop.open { display:block; }

  .main-content { margin-left:0; }
  .topbar { padding:0 16px; gap:10px; }
  .topbar-hamburger { display:flex; align-items:center; justify-content:center; width:38px; height:38px; border:1.5px solid var(--border); background:var(--bg-primary); border-radius:var(--radius-sm); cursor:pointer; flex-shrink:0; color:var(--text-secondary); }
  .topbar-hamburger svg { width:18px; height:18px; }
  .topbar-title { font-size:1rem; }
  .topbar-search { max-width:200px; }
  .topbar-date { display:none; }
  .page-body { padding:16px; }
  .page-header h1 { font-size:1.3rem; }

  .grid-6,.grid-4,.grid-3,.grid-2 { grid-template-columns:1fr; }
  .form-row,.form-row-3 { grid-template-columns:1fr; }
  .broker-grid,.projects-grid,.visit-grid,.calc-layout,.agent-grid { grid-template-columns:1fr; }
  .deal-stats-row,.broker-stats-row,.stat-summary { grid-template-columns:repeat(2,1fr); }
  .admin-layout { grid-template-columns:1fr; }
  .admin-nav { display:flex; overflow-x:auto; position:static; border-radius:var(--radius-md); }
  .admin-nav-section { display:none; }
  .admin-nav-item { flex-shrink:0; border-left:none; border-bottom:3px solid transparent; padding:10px 14px; font-size:0.78rem; }
  .admin-nav-item.active { border-bottom-color:var(--navy); }

  .leads-table-wrap,.kanban-board { overflow-x:auto; }
  .data-table { min-width:640px; }
  .kanban-col { min-width:200px; }
  .lead-drawer,.broker-drawer,.project-detail-panel { width:100%; }
  .result-card { flex-direction:column; }
  .result-card-thumb { width:100%; height:120px; }
  .result-card-body { flex-direction:column; gap:12px; }
  .profile-form,.reg-right { position:static; }
  .modal { max-width:100%; border-radius:var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items:flex-end; padding:0; }
  .quick-action-btn { font-size:0.78rem; padding:8px 12px; }

  .visit-row { grid-template-columns:1fr auto; gap:10px; }
  .visit-row > div:nth-child(2),.visit-row > div:nth-child(3) { display:none; }
}

@media (max-width: 480px) {
  body { font-size:15px; }
  .form-control { height:50px; font-size:0.95rem; }
  .btn { height:48px; font-size:0.9rem; }
  .btn-sm { height:40px; padding:0 12px; }
  .broker-actions,.vc-actions { flex-direction:column; }
  .modal-footer { flex-direction:column-reverse; }
  .modal-footer .btn { width:100%; justify-content:center; }
  .topbar-search { display:none; }
  .deal-stats-row,.broker-stats-row { grid-template-columns:1fr; }
  .stat-value { font-size:1.6rem; }
  .stat-tile { padding:16px; }
  .kanban-col { min-width:240px; }
  .search-hero { padding:20px; }
  .search-hero h2 { font-size:1.1rem; }
  .search-hero::after { display:none; }
  .ai-search-bar { flex-direction:column; border-radius:var(--radius-md); }
  .search-suggestions { display:none; }
  .page-header { flex-direction:column; align-items:flex-start; gap:10px; }
  .page-header h1 { font-size:1.2rem; }
  .news-card-head { flex-direction:column; }
}

.topbar-hamburger { display:none; }
@media (max-width:768px) { .topbar-hamburger { display:flex; } }

@media (hover:none) {
  .stat-tile:hover,.project-card:hover,.result-card:hover,.broker-card:hover,.deal-card:hover { transform:none; box-shadow:var(--shadow-card); }
  .btn-primary:hover,.btn-gold:hover { transform:none; }
  .nav-item { padding:14px 20px; }
  .tab-btn  { padding:12px 18px; }
  .data-table td { padding:14px 12px; }
}

/* ═══════════════════════════════════════════════════
   PRINT STYLES — PHASE 4B
   Clean A4 output for lead sheets & deal summaries.
   ═══════════════════════════════════════════════════ */

@media print {
  /* ── Hide everything except the print section ── */
  body * { visibility: hidden; }
  .print-section,
  .print-section * { visibility: visible; }

  /* ── Page setup ── */
  @page {
    size: A4 portrait;
    margin: 18mm 16mm 18mm 16mm;
  }

  /* ── Print section positioning ── */
  .print-section {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: #fff;
    color: #0F1F3D;
    font-family: 'DM Sans', sans-serif;
    font-size: 11pt;
    line-height: 1.5;
  }

  /* ── Typography resets ── */
  .print-section h1,
  .print-section h2,
  .print-section h3,
  .print-section h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #0F1F3D;
    page-break-after: avoid;
  }
  .print-section p,
  .print-section span,
  .print-section td,
  .print-section th { color: #0F1F3D; }

  /* ── Print header ── */
  .print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2pt solid #1B3A6B;
    padding-bottom: 10pt;
    margin-bottom: 16pt;
  }
  .print-header-logo {
    display: flex; align-items: center; gap: 10pt;
  }
  .print-logo-mark {
    width: 36pt; height: 36pt;
    background: #1B3A6B;
    border-radius: 4pt;
    display: flex; align-items: center; justify-content: center;
    color: #C9A84C;
    font-family: Georgia, serif;
    font-weight: 700; font-size: 14pt;
  }
  .print-logo-text { font-size: 13pt; font-weight: 700; color: #1B3A6B; }
  .print-logo-sub  { font-size: 7pt;  color: #5A6478; letter-spacing: 1.5pt; text-transform: uppercase; }
  .print-header-meta { text-align: right; font-size: 8pt; color: #5A6478; }

  /* ── Section headings ── */
  .print-section-heading {
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: 1.5pt;
    text-transform: uppercase;
    color: #1B3A6B;
    border-bottom: 1pt solid #E2E4EA;
    padding-bottom: 4pt;
    margin: 14pt 0 8pt;
  }

  /* ── Field grid ── */
  .print-field-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8pt 16pt;
    margin-bottom: 10pt;
  }
  .print-field-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8pt 16pt;
    margin-bottom: 10pt;
  }
  .print-field { }
  .print-label {
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8pt;
    color: #9BA3B5;
    display: block;
    margin-bottom: 2pt;
  }
  .print-value {
    font-size: 10pt;
    font-weight: 600;
    color: #0F1F3D;
  }
  .print-value.accent { color: #1B3A6B; }
  .print-value.green  { color: #2E7D32; }
  .print-value.gold   { color: #856A1A; }

  /* ── Status badge ── */
  .print-badge {
    display: inline-block;
    padding: 2pt 8pt;
    border: 1pt solid #1B3A6B;
    border-radius: 20pt;
    font-size: 8pt;
    font-weight: 700;
    color: #1B3A6B;
  }

  /* ── Activity timeline ── */
  .print-timeline { border-left: 1.5pt solid #E2E4EA; padding-left: 10pt; }
  .print-timeline-item { margin-bottom: 8pt; position: relative; }
  .print-timeline-item::before {
    content: '';
    position: absolute;
    left: -13pt; top: 4pt;
    width: 6pt; height: 6pt;
    border-radius: 50%;
    background: #1B3A6B;
  }
  .print-timeline-date   { font-size: 7.5pt; color: #9BA3B5; }
  .print-timeline-text   { font-size: 9.5pt; color: #0F1F3D; }
  .print-timeline-author { font-size: 7.5pt; color: #9BA3B5; font-style: italic; }

  /* ── Deal stage pipeline ── */
  .print-pipeline {
    display: flex;
    align-items: center;
    gap: 4pt;
    margin: 8pt 0 14pt;
    flex-wrap: wrap;
  }
  .print-pipeline-step {
    display: flex; align-items: center; gap: 4pt;
  }
  .print-pipeline-node {
    padding: 3pt 8pt;
    border: 1pt solid #E2E4EA;
    border-radius: 4pt;
    font-size: 7.5pt;
    font-weight: 600;
    color: #9BA3B5;
    white-space: nowrap;
  }
  .print-pipeline-node.done    { border-color: #2E7D32; color: #2E7D32; }
  .print-pipeline-node.current { border-color: #1B3A6B; background: #1B3A6B; color: #fff; }
  .print-pipeline-arrow { font-size: 7pt; color: #E2E4EA; }

  /* ── Financial summary box ── */
  .print-finance-box {
    border: 1.5pt solid #1B3A6B;
    border-radius: 6pt;
    padding: 10pt 14pt;
    margin: 10pt 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8pt;
  }
  .print-finance-item { text-align: center; }
  .print-finance-val  { font-size: 14pt; font-weight: 700; color: #1B3A6B; display: block; }
  .print-finance-lbl  { font-size: 7pt;  color: #9BA3B5; text-transform: uppercase; letter-spacing: 0.8pt; }

  /* ── Footer ── */
  .print-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    border-top: 1pt solid #E2E4EA;
    padding-top: 6pt;
    display: flex;
    justify-content: space-between;
    font-size: 7.5pt;
    color: #9BA3B5;
  }

  /* ── Notes box ── */
  .print-notes-box {
    border: 1pt solid #E2E4EA;
    border-radius: 4pt;
    padding: 8pt 10pt;
    min-height: 50pt;
    background: #FAFAFA;
    font-size: 9pt;
    color: #5A6478;
  }

  /* ── Page break ── */
  .print-page-break { page-break-before: always; }
}
