/* =====================================================
   REAL ESTATE CRM — BRAND THEME
   Navy #1E40AF  →  Sky Blue #0EA5E9
   Light sidebar / light content, fully responsive
   ===================================================== */

:root {
  /* Brand Colors */
  --color-primary: #2563EB;
  --color-primary-dark: #1E40AF;
  --color-primary-light: #DBEAFE;

  --color-secondary: #0EA5E9;
  --color-secondary-dark: #0284C7;
  --color-secondary-light: #BAE6FD;

  /* Backgrounds */
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-surface-alt: #FBFCFE;

  /* Navigation */
  --color-sidebar: #FFFFFF;
  --color-sidebar-hover: #EFF6FF;
  --color-sidebar-active: #2563EB;
  --color-sidebar-text: #475569;
  --color-sidebar-border: #E2E8F0;

  /* Typography */
  --color-heading: #0F172A;
  --color-text: #475569;
  --color-text-light: #94A3B8;
  --color-text-white: #FFFFFF;

  /* Borders */
  --color-border: #E2E8F0;
  --color-divider: #EEF2F7;

  /* Status */
  --color-success: #16A34A;
  --color-warning: #D97706;
  --color-error: #DC2626;
  --color-info: #0EA5E9;

  /* CRM Pipeline */
  --color-lead: #2563EB;
  --color-qualified: #0EA5E9;
  --color-site-visit: #7C3AED;
  --color-negotiation: #D97706;
  --color-booked: #16A34A;
  --color-lost: #DC2626;

  /* Charts */
  --chart-1: #2563EB;
  --chart-2: #0EA5E9;
  --chart-3: #7C3AED;
  --chart-4: #64748B;
  --chart-5: #D97706;
  --chart-6: #16A34A;

  /* Buttons */
  --btn-primary: #2563EB;
  --btn-primary-hover: #1E40AF;
  --btn-secondary-bg: #EFF6FF;
  --btn-secondary-border: #2563EB;
  --btn-secondary-text: #2563EB;

  /* Tables */
  --table-header: #F1F5F9;
  --table-row-alt: #FBFCFE;

  /* -------- internal aliases (keep the rest of this file unchanged) -------- */
  --brand-purple:      var(--color-primary);
  --brand-purple-dark: var(--color-primary-dark);
  --brand-magenta:     var(--color-primary-dark);
  --brand-gradient:    linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(37,99,235,.08) 0%, rgba(14,165,233,.08) 100%);

  --sidebar-width:      264px;
  --sidebar-width-sm:   76px;
  --topbar-height:      68px;

  --bg-app:      var(--color-background);
  --bg-card:     var(--color-surface);
  --bg-hover:    var(--btn-secondary-bg);

  --text-dark:   var(--color-heading);
  --text-muted:  var(--color-text-light);
  --text-on-brand: var(--color-text-white);

  --border-soft: var(--color-border);

  --success: var(--color-success);
  --warning: var(--color-warning);
  --danger:  var(--color-error);
  --info:    var(--color-info);

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

  /* Linear/Notion-style flat UI: hairline borders instead of drop shadows */
  --shadow-sm: 0 0 0 1px var(--color-border);
  --shadow-md: 0 0 0 1px var(--color-border);
  --shadow-lg: 0 0 0 1px var(--color-border);
}

*{ box-sizing: border-box; }

body{
  background: var(--bg-app);
  color: var(--text-dark);
  font-family: "Montserrat","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

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

/* =====================================================
   APP SHELL
   ===================================================== */

.app-shell{
  display: flex;
  min-height: 100vh;
}

/* -------- Sidebar (light) -------- */

.sidebar{
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: var(--color-sidebar-text);

    position: fixed;
    top: 0;
    left: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    z-index: 1040;

    transition: transform .25s ease;

    border-right: 1px solid var(--color-sidebar-border);
}

.sidebar-brand{
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--color-sidebar-border);
  min-height: var(--topbar-height);
}

.brand-logo-chip{
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.brand-logo-chip img{
  height: 32px;
  width: auto;
  display: block;
}
.brand-logo-chip.brand-logo-lg{
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: .55rem .9rem;
}
.brand-logo-chip.brand-logo-lg img{ height: 42px; }


.sidebar-scroll{
    flex: 1;
    height: 0;                 /* IMPORTANT */
    overflow-y: auto;
    overflow-x: hidden;
    padding: .85rem .75rem 1.5rem;
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}
.sidebar-scroll::-webkit-scrollbar{
    width:8px;
}

.sidebar-scroll::-webkit-scrollbar-track{
    background:transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb{
    background:rgba(29,29,29,.16);
    border-radius:20px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover{
    background:rgba(29,29,29,.3);
}

.nav-section-label{
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-light);
  margin: 1.1rem .6rem .35rem;
  font-weight: 600;
}
.nav-section-label:first-child{ margin-top: .2rem; }

.sidebar-nav{ list-style:none; margin:0; padding:0; }
.sidebar-nav .nav-link{
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .62rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav .nav-link i{ font-size: 1rem; width: 20px; text-align:center; opacity:.9; }
.sidebar-nav .nav-link:hover{ background: var(--color-sidebar-hover); color: var(--color-heading); }
.sidebar-nav .nav-link.active{
  background: var(--color-sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--color-primary-dark);
}
.sidebar-nav .badge-count{
  margin-left: auto;
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  font-size: .68rem;
  padding: .1rem .45rem;
  border-radius: 20px;
}

.badge-soon{
  margin-left: auto;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .12rem .5rem;
  border-radius: 20px;
  flex-shrink: 0;
}
.sidebar-nav .nav-link.active .badge-soon{
  background: rgba(255,255,255,.25);
  color: #fff;
}

.sidebar-footer{
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--color-sidebar-border);
  display:flex; align-items:center; gap:.6rem;
}
.sidebar-footer .avatar{
  width: 34px; height:34px; border-radius:50%;
  background: var(--brand-gradient);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:600; font-size:.8rem;
}
.sidebar-footer .who{ line-height:1.15; overflow:hidden; }
.sidebar-footer .who .u-name{ color: var(--color-heading); font-size:.82rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-footer .who .u-role{ color: var(--color-text-light); font-size: .7rem; }

/* -------- Main column -------- */

.main-col{
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

.topbar{
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar .hamburger{
  display: none;
  border: none;
  background: var(--bg-app);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--brand-purple);
  font-size: 1.1rem;
}

.topbar .search-box{
  flex: 1;
  max-width: 420px;
  position: relative;
}
.topbar .search-box input{
  width: 100%;
  border: 1px solid var(--border-soft);
  background: var(--bg-app);
  border-radius: 999px;
  padding: .55rem 1rem .55rem 2.4rem;
  font-size: .85rem;
}
.topbar .search-box input:focus{
  outline: none;
  border-color: var(--brand-magenta);
  background: #fff;
}
.topbar .search-box i{
  position:absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}

.topbar .icon-btn{
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--bg-app);
  display:flex; align-items:center; justify-content:center;
  color: var(--brand-purple);
}
.topbar .icon-btn .dot{
  position:absolute; top:6px; right:7px;
  width:8px; height:8px; border-radius:50%;
  background: var(--danger); border: 2px solid var(--bg-card);
}

.page-content{
  flex: 1;
  padding: 1.5rem;
}

.page-header{
  display:flex; align-items:flex-start; justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-header h1{
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 .2rem;
}
.page-header .subtitle{ color: var(--text-muted); font-size: .85rem; }
.breadcrumb-trail{ font-size:.78rem; color: var(--text-muted); margin-bottom:.35rem; }
.breadcrumb-trail a{ color: var(--text-muted); }
.breadcrumb-trail .sep{ margin: 0 .35rem; }

/* =====================================================
   COMPONENTS
   ===================================================== */

.btn-brand{
  background: var(--btn-primary);
  border: none;
  color: #fff !important;
  font-weight: 600;
  font-size: .85rem;
  padding: .58rem 1.15rem;
  border-radius: var(--radius-sm);
  transition: background .15s ease, transform .1s ease;
}
.btn-brand:hover{ background: var(--btn-primary-hover); color:#fff; }
.btn-brand:active{ transform: translateY(1px); }

.btn-outline-brand{
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  color: var(--btn-secondary-text);
  font-weight: 600;
  font-size: .85rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
}
.btn-outline-brand:hover{ background: var(--color-primary-light); color: var(--btn-secondary-text); }

.card-surface{
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.kpi-card{
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display:flex; align-items:center; gap: .9rem;
}
.kpi-card .kpi-icon{
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  display:flex; align-items:center; justify-content:center;
  font-size: 1.15rem;
  color:#fff;
  background: var(--brand-gradient);
  flex-shrink:0;
}
.kpi-card .kpi-value{ font-size: 1.35rem; font-weight: 700; color: var(--text-dark); line-height:1.1; }
.kpi-card .kpi-label{ font-size: .76rem; color: var(--text-muted); margin-top:2px; }

.table-surface{
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.table-surface table{ margin-bottom:0; }
.table-surface thead th{
  background: var(--table-header);
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  padding: .6rem .9rem;
  white-space: nowrap;
}
.table-surface tbody td{
  padding: .55rem .9rem;
  font-size: .85rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dark);
}
.table-surface tbody tr:last-child td{ border-bottom:none; }
.table-surface tbody tr:hover{ background: var(--bg-hover); }

.badge-status{
  display:inline-flex; align-items:center;
  font-size: .7rem; font-weight: 600;
  padding: .28rem .65rem;
  border-radius: 999px;
}
.badge-soft-purple{ background: rgba(37,99,235,.12); color: var(--brand-purple); }
.badge-soft-success{ background: rgba(22,163,74,.14); color: var(--success); }
.badge-soft-warning{ background: rgba(217,119,6,.14); color: #92600A; }
.badge-soft-danger{ background: rgba(220,38,38,.12); color: var(--danger); }
/* Non-critical statuses fold into neutral gray — color is reserved for success/warning/danger */
.badge-soft-info{ background: rgba(148,163,184,.16); color: var(--text-dark); }
.badge-soft-muted{ background: rgba(148,163,184,.16); color: var(--text-muted); }

/* =====================================================
   RECORD DETAIL: key-value strip + tabs
   ===================================================== */

.record-meta{
  display:flex; flex-wrap:wrap;
  gap: .4rem 1.5rem;
  padding: .9rem 0 1.1rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1.25rem;
}
.record-meta .meta-item{ font-size:.82rem; color: var(--text-muted); }
.record-meta .meta-item strong{ color: var(--text-dark); font-weight:600; }

.tab-strip{
  display:flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1.25rem;
  overflow-x:auto;
}
.tab-strip .tab-link{
  padding: .65rem 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-strip .tab-link:hover{ color: var(--text-dark); }
.tab-strip .tab-link.active{
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.form-label{ font-size:.82rem; font-weight:600; color: var(--text-dark); }
.form-control, .form-select{
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  font-size: .87rem;
  padding: .55rem .75rem;
}
.form-control:focus, .form-select:focus{
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 .18rem rgba(37,99,235,.18);
}
.form-section-title{
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing:.05em;
  font-weight: 700;
  color: var(--brand-purple);
  margin: 1.4rem 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border-soft);
}
.form-section-title:first-child{ margin-top:0; }

.pagination .page-link{ color: var(--brand-purple); border-color: var(--border-soft); }
.pagination .page-item.active .page-link{ background: var(--brand-gradient); border-color: transparent; }

.empty-state{
  text-align:center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i{ font-size: 2.4rem; color: var(--border-soft); margin-bottom: .75rem; display:block; }

/* mobile backdrop */
.sidebar-backdrop{
  display:none;
  position: fixed; inset:0;
  background: rgba(20,10,30,.45);
  z-index: 1030;
}
.sidebar-backdrop.show{ display:block; }

/* =====================================================
   COMMAND PALETTE (Cmd/Ctrl+K)
   ===================================================== */

.cmdk-overlay{
  position: fixed; inset:0;
  background: rgba(15,23,42,.35);
  z-index: 2000;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding-top: 12vh;
}
.cmdk-panel{
  width: 100%;
  max-width: 560px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cmdk-input-row{
  display:flex;
  align-items:center;
  gap:.65rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
}
.cmdk-input-row i{ color: var(--text-muted); }
.cmdk-input-row input{
  flex:1;
  border:none;
  outline:none;
  font-size: .95rem;
  font-family: inherit;
  background: transparent;
  color: var(--text-dark);
}
.cmdk-input-row kbd{
  font-size:.7rem;
  color: var(--text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: .1rem .4rem;
}
.cmdk-results{
  list-style:none;
  margin:0;
  padding: .4rem;
  max-height: 340px;
  overflow-y:auto;
}
.cmdk-result{
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: var(--text-dark);
  cursor: pointer;
}
.cmdk-result.active{
  background: var(--color-sidebar-hover);
  color: var(--color-primary);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1199.98px){
  .sidebar{ transform: translateX(-100%); }
  .sidebar.show{ transform: translateX(0); }
  .main-col{ margin-left: 0; width: 100%; }
  .topbar .hamburger{ display:flex; }
}

@media (max-width: 767.98px){
  .page-content{ padding: 1rem; }
  .topbar{ padding: 0 1rem; gap: .6rem; }
  .topbar .search-box{ display:none; }
  .page-header h1{ font-size: 1.15rem; }
  .kpi-card{ padding: .9rem 1rem; }
}

@media (min-width: 576px) and (max-width: 767.98px){
  .topbar .search-box{ display:block; max-width: none; }
}

/* =====================================================
   AUTH / LOGIN SPLIT SCREEN
   ===================================================== */

.auth-shell{
  min-height: 100vh;
  display:flex;
}
.auth-visual{
  flex: 1.1;
  background: var(--brand-gradient);
  color:#fff;
  display:flex;
  flex-direction:column;
  justify-content: space-between;
  padding: 3rem;
  position: relative;
  overflow:hidden;
}
.auth-visual::before,.auth-visual::after{
  content:"";
  position:absolute;
  border-radius:50%;
  background: rgba(255,255,255,.08);
}
.auth-visual::before{ width:340px; height:340px; top:-120px; right:-120px; }
.auth-visual::after{ width:220px; height:220px; bottom:-80px; left:-60px; }
.auth-visual .content{ position:relative; z-index:1; }
.auth-form-side{
  flex: 1;
  display:flex; align-items:center; justify-content:center;
  background: var(--bg-card);
  padding: 2rem;
}
.auth-card{ width: 100%; max-width: 380px; }

@media (max-width: 991.98px){
  .auth-visual{ display:none; }
}

/* print utility shared by document templates */
@media print{
  .no-print{ display:none !important; }
}
