/* ==========================================================================
   Real Estate CRM — custom Bootstrap 5.3 theme
   Deep navy primary, white surfaces, soft grey canvas.
   ========================================================================== */

:root {
  --brand-950: #070f24;
  --brand-900: #0b1736;
  --brand-800: #10214a;
  --brand-700: #162d63;
  --brand-600: #1f3f8a;
  --brand-500: #2c55b3;
  --brand-100: #e6ecfa;
  --brand-50:  #f2f5fc;
  --accent:    #c79a2e;
  --accent-soft: #fbf3df;

  --canvas:   #f4f6fa;
  --surface:  #ffffff;
  --surface-2:#f8f9fc;
  --border:   #e4e8f0;
  --border-strong: #d3d9e5;
  --text:     #0f1a33;
  --text-2:   #44506a;
  --muted:    #6b7690;

  --success: #12805c; --success-soft: #e3f5ee;
  --warning: #a36500; --warning-soft: #fdf1dc;
  --danger:  #c0362c; --danger-soft:  #fbe7e5;
  --info:    #1d6fb8; --info-soft:    #e3f0fb;
  --neutral: #5b6478; --neutral-soft: #eef0f4;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 26, 51, .05);
  --shadow-sm: 0 1px 3px rgba(15, 26, 51, .06), 0 1px 2px rgba(15, 26, 51, .04);
  --shadow-md: 0 8px 24px -8px rgba(15, 26, 51, .14), 0 2px 6px rgba(15, 26, 51, .05);
  --shadow-lg: 0 24px 48px -16px rgba(11, 23, 54, .28);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --mobile-nav-h: 64px;

  --font: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Bootstrap overrides */
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--border);
  --bs-primary: var(--brand-700);
  --bs-primary-rgb: 22, 45, 99;
  --bs-link-color: var(--brand-600);
  --bs-link-color-rgb: 31, 63, 138;
  --bs-link-hover-color: var(--brand-800);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-focus-ring-color: rgba(44, 85, 179, .28);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--canvas);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--text); letter-spacing: -.01em; font-weight: 650; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.small, small { font-size: .8125rem; }
.fw-semibold { font-weight: 600 !important; }
.tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 2000;
  background: var(--brand-800); color: #fff; padding: .5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; color: #fff; }

/* -------------------------------------------------------------- Buttons */
.btn { font-weight: 550; border-radius: var(--radius-sm); padding: .5rem 1rem; font-size: .875rem; }
.btn-lg { padding: .75rem 1.25rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: .3rem .65rem; font-size: .8125rem; }
.btn-primary {
  --bs-btn-bg: var(--brand-700); --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-800); --bs-btn-hover-border-color: var(--brand-800);
  --bs-btn-active-bg: var(--brand-900); --bs-btn-active-border-color: var(--brand-900);
  --bs-btn-disabled-bg: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600);
  box-shadow: 0 1px 2px rgba(11, 23, 54, .18);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-700); --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--brand-800); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-100); --bs-btn-active-color: var(--brand-900); --bs-btn-active-border-color: var(--brand-600);
}
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--border-strong); }
.btn-icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }

/* --------------------------------------------------------------- Forms */
.form-label { font-weight: 550; font-size: .8125rem; color: var(--text-2); margin-bottom: .375rem; }
.form-control, .form-select {
  border-color: var(--border-strong); border-radius: var(--radius-sm);
  padding: .55rem .8rem; font-size: .9rem; background-color: var(--surface);
}
.form-control-lg { padding: .75rem 1rem; font-size: 1rem; border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .2rem rgba(44, 85, 179, .15); }
.form-text { color: var(--muted); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }

/* --------------------------------------------------------------- Cards */
.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: transparent;
  box-shadow: var(--shadow-xs);
}
.card-header { padding: 1rem 1.25rem; border-bottom-color: var(--border); display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.card-title { font-size: .9375rem; font-weight: 650; margin: 0; }
.card-subtitle { font-size: .8125rem; color: var(--muted); margin: .125rem 0 0; }
.card-body { padding: 1.25rem; }

/* ------------------------------------------------------- Status badges */
.badge-status {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.badge-danger  { color: var(--danger);  background: var(--danger-soft); }
.badge-info    { color: var(--info);    background: var(--info-soft); }
.badge-neutral { color: var(--neutral); background: var(--neutral-soft); }

/* ======================================================================
   Application shell
   ====================================================================== */
.app-shell { min-height: 100vh; }

/* Sidebar */
.app-sidebar {
  --bs-offcanvas-width: var(--sidebar-w);
  background: var(--brand-900);
  background-image: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-950) 100%);
  color: #c9d3ea;
  border-right: 0 !important;
}
@media (min-width: 992px) {
  .app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1030;
    display: flex; flex-direction: column; transition: width .2s ease;
  }
  .app-main { margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
  .sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .app-sidebar .nav-label,
  .sidebar-collapsed .app-sidebar .nav-section,
  .sidebar-collapsed .app-sidebar .brand-text,
  .sidebar-collapsed .app-sidebar .sidebar-footer-text { display: none; }
  .sidebar-collapsed .app-sidebar .nav-link { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed .app-sidebar .brand { justify-content: center; padding-inline: 0; }
}
.app-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; overflow-y: auto; }
.brand {
  display: flex; align-items: center; gap: .75rem; height: var(--topbar-h); padding: 0 1.25rem;
  color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0;
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #e5c46a); color: var(--brand-950);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: .7rem; color: #8d9bbd; letter-spacing: .04em; text-transform: uppercase; }

.sidebar-nav { padding: 1rem .75rem; flex: 1; }
.nav-section { font-size: .6875rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #6f7ea3; padding: 1rem .75rem .5rem; }
.nav-section:first-child { padding-top: .25rem; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; margin-bottom: 2px;
  color: #c3cde6; border-radius: 10px; font-weight: 500; font-size: .875rem; position: relative;
}
.sidebar-nav .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; color: #8d9bbd; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link:hover i { color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar-nav .nav-link.active i { color: var(--accent); }
.sidebar-nav .nav-link.active::before { content: ''; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .75rem; color: #6f7ea3; }

/* Topbar */
.app-topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
}
.topbar-search { position: relative; flex: 1; max-width: 460px; }
.topbar-search .form-control { padding-left: 2.4rem; padding-right: 3.5rem; background: var(--surface-2); border-color: var(--border); height: 40px; }
.topbar-search .form-control:focus { background: var(--surface); }
.topbar-search > .bi-search { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: var(--surface); color: var(--muted); border: 1px solid var(--border); font-size: .7rem; box-shadow: none; padding: .1rem .35rem; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: .375rem; max-height: 360px; overflow-y: auto;
}
.search-results a { display: flex; align-items: center; gap: .75rem; padding: .55rem .65rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.search-results a i { color: var(--muted); }
.search-results a .hint { margin-left: auto; font-size: .75rem; color: var(--muted); }
.search-results a.active, .search-results a:hover { background: var(--brand-50); }
.search-results .empty { padding: .75rem; color: var(--muted); font-size: .875rem; }

.topbar-actions { display: flex; align-items: center; gap: .375rem; margin-left: auto; }
.topbar-btn { position: relative; color: var(--text-2); border: 1px solid transparent; background: transparent; }
.topbar-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.topbar-btn .dot-count {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center; font-weight: 650; font-size: .8rem;
  background: var(--brand-100); color: var(--brand-800);
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.profile-btn { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; border: 1px solid transparent; background: transparent; }
.profile-btn:hover { background: var(--surface-2); border-color: var(--border); }
.profile-btn .meta { text-align: left; line-height: 1.2; }
.profile-btn .meta strong { display: block; font-size: .8125rem; font-weight: 600; color: var(--text); }
.profile-btn .meta span { font-size: .7rem; color: var(--muted); }

.dropdown-menu { --bs-dropdown-border-color: var(--border); --bs-dropdown-border-radius: var(--radius); --bs-dropdown-link-active-bg: var(--brand-50); --bs-dropdown-link-active-color: var(--text); box-shadow: var(--shadow-md); padding: .375rem; font-size: .875rem; }
.dropdown-item { border-radius: var(--radius-sm); padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { color: var(--muted); }

.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-menu .notif-head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: .75rem; padding: .75rem 1rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-item .notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; flex-shrink: 0; background: transparent; }
.notif-item.unread .notif-dot { background: var(--brand-500); }
.notif-item .t { font-weight: 600; font-size: .8125rem; }
.notif-item .m { font-size: .8125rem; color: var(--text-2); }
.notif-item .ago { font-size: .7rem; color: var(--muted); }
.notif-menu .notif-foot { padding: .6rem; text-align: center; }

/* Content */
.app-content { padding: 1.5rem; max-width: 1600px; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; margin: 0; font-weight: 700; }
.page-header .lead-text { color: var(--muted); margin: .25rem 0 0; font-size: .9rem; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--muted); --bs-breadcrumb-item-active-color: var(--muted); font-size: .8125rem; margin-bottom: .35rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-600); }

/* Stat cards */
.stat-card { height: 100%; padding: 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.stat-card .stat-label { font-size: .8125rem; font-weight: 550; color: var(--muted); }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: .8rem; color: var(--muted); }
.tone-brand   { background: var(--brand-50);    color: var(--brand-600); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-info    { background: var(--info-soft);    color: var(--info); }
.tone-accent  { background: var(--accent-soft);  color: #8a6512; }

/* Welcome banner */
.welcome-banner {
  position: relative; overflow: hidden; border: 0; color: #fff;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(199, 154, 46, .22), transparent 60%), linear-gradient(120deg, var(--brand-800), var(--brand-900));
}
.welcome-banner h2 { color: #fff; font-size: 1.35rem; margin: 0 0 .25rem; }
.welcome-banner p { color: #b9c5e3; margin: 0; }
.welcome-banner .chip { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); color: #e3e9f7; border-radius: 999px; padding: .25rem .7rem; font-size: .75rem; }
.welcome-banner .skyline { position: absolute; right: 0; bottom: 0; height: 100%; opacity: .16; pointer-events: none; }

/* Tables */
.table { --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); margin-bottom: 0; font-size: .875rem; }
.table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; color: var(--muted); background: var(--surface-2); border-bottom-width: 1px; padding: .7rem 1rem; white-space: nowrap; }
.table > tbody td { padding: .8rem 1rem; vertical-align: middle; }
.table-card .card-body { padding: 0; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: .75rem; color: var(--muted); }

/* Lists */
.list-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .icon-chip { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }

/* Progress meter rows */
.meter-row { display: flex; align-items: center; gap: .75rem; font-size: .8125rem; margin-bottom: .65rem; }
.meter-row .label { width: 96px; color: var(--text-2); }
.meter-row .bar { flex: 1; height: 8px; border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.meter-row .bar span { display: block; height: 100%; border-radius: 4px; }
.meter-row .val { width: 36px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Empty states */
.empty-state { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty-state .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: 1.5rem; color: var(--muted); margin-bottom: .85rem; }
.empty-state h6 { color: var(--text); font-weight: 600; margin-bottom: .25rem; }
.empty-state p { font-size: .8125rem; margin: 0 auto; max-width: 320px; }

/* Skeleton loaders */
.skeleton { position: relative; overflow: hidden; background: #eceff5; border-radius: var(--radius-sm); }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }
.chart-box { position: relative; height: 290px; }
.chart-box .skeleton { position: absolute; inset: 0; }
.chart-box .chart-empty { position: absolute; inset: 0; display: none; place-items: center; text-align: center; color: var(--muted); font-size: .8125rem; background: rgba(255, 255, 255, .7); }
.chart-box.is-empty .chart-empty { display: grid; }

/* Segmented control */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented button { border: 0; background: transparent; padding: .3rem .7rem; font-size: .75rem; font-weight: 600; color: var(--muted); border-radius: 7px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* Alerts */
.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: .875rem; display: flex; gap: .65rem; align-items: flex-start; }
.alert-success { background: var(--success-soft); color: #0d5f44; border-color: #c4e8da; }
.alert-danger  { background: var(--danger-soft);  color: #8e2219; border-color: #f3cbc6; }
.alert-warning { background: var(--warning-soft); color: #7a4c00; border-color: #f5ddb0; }
.alert-info    { background: var(--info-soft);    color: #145189; border-color: #c6def4; }

/* Offline banner */
.offline-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 2000;
  background: var(--brand-900); color: #fff; padding: .6rem 1rem; border-radius: 999px; font-size: .8125rem;
  box-shadow: var(--shadow-lg); display: none; align-items: center; gap: .5rem;
}
.is-offline .offline-banner { display: inline-flex; }

/* Mobile bottom navigation */
.mobile-nav { display: none; }
@media (max-width: 991.98px) {
  .app-topbar { padding: 0 1rem; }
  .app-content { padding: 1rem 1rem calc(var(--mobile-nav-h) + 1.5rem); }
  .page-header h1 { font-size: 1.25rem; }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  }
  .mobile-nav a, .mobile-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600; border: 0; background: transparent; position: relative;
    min-height: 48px;
  }
  .mobile-nav i { font-size: 1.3rem; }
  .mobile-nav .active { color: var(--brand-700); }
  .mobile-nav .active i { color: var(--brand-700); }
  .mobile-nav .badge-dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: .6rem; display: grid; place-items: center; padding: 0 4px; }
  .offline-banner { bottom: calc(var(--mobile-nav-h) + 1rem); }
  .stat-card .stat-value { font-size: 1.35rem; }
}
@media (max-width: 575.98px) {
  .profile-btn .meta { display: none; }
  .topbar-search kbd { display: none; }
  .topbar-search .form-control { padding-right: .8rem; }
}

/* SweetAlert2 theming */
.swal2-popup { border-radius: var(--radius-lg) !important; font-family: var(--font) !important; }
.swal2-title { font-size: 1.15rem !important; color: var(--text) !important; }
.swal2-html-container { font-size: .9rem !important; color: var(--text-2) !important; }
.swal2-actions .btn { margin: 0 .25rem; }
.swal2-toast { box-shadow: var(--shadow-md) !important; border: 1px solid var(--border) !important; }
.swal2-toast .swal2-title { font-size: .875rem !important; font-weight: 550 !important; }

/* ======================================================================
   Authentication screens
   ====================================================================== */
.auth-body { background: var(--surface); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 85% 10%, rgba(199, 154, 46, .25), transparent 60%), linear-gradient(150deg, var(--brand-800) 0%, var(--brand-950) 100%);
}
.auth-hero .brand { border: 0; padding: 0; height: auto; }
.auth-hero h1 { color: #fff; font-size: clamp(1.8rem, 2.8vw, 2.5rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; max-width: 520px; }
.auth-hero p.lead { color: #b9c5e3; font-size: 1rem; max-width: 480px; }
.auth-hero .features { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .85rem; max-width: 460px; }
.auth-hero .features li { display: flex; gap: .85rem; align-items: flex-start; color: #dbe3f5; font-size: .9rem; }
.auth-hero .features i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: var(--accent); flex-shrink: 0; }
.auth-hero .features strong { display: block; color: #fff; font-weight: 600; }
.auth-hero .skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; opacity: .22; pointer-events: none; }
.auth-hero .hero-foot { position: relative; font-size: .75rem; color: #8d9bbd; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-card .sub { color: var(--muted); margin-bottom: 2rem; }
.auth-card .mobile-brand { display: none; margin-bottom: 2rem; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 3rem; }
.password-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 40px; height: 40px; border-radius: 8px; }
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-rules { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .75rem; font-size: .75rem; color: var(--muted); }
.password-rules li::before { content: '\F28A'; font-family: 'bootstrap-icons'; margin-right: .35rem; color: var(--border-strong); }
.password-rules li.ok { color: var(--success); }
.password-rules li.ok::before { content: '\F26B'; color: var(--success); }
.auth-foot { margin-top: 2rem; font-size: .75rem; color: var(--muted); text-align: center; }

@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card .mobile-brand { display: flex; }
  .auth-panel { align-items: flex-start; padding-top: 3rem; }
}

/* Error pages */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; text-align: center; background: var(--canvas); }
.error-page .code { font-size: 4.5rem; font-weight: 800; letter-spacing: -.04em; color: var(--brand-700); line-height: 1; }

/* Print */
@media print {
  .app-sidebar, .app-topbar, .mobile-nav, .offline-banner, .no-print { display: none !important; }
  .app-main { margin: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* Utility sizes (inline styles avoided for CSP) */
.sk-line { height: 14px; }
.sk-line-sm { height: 12px; }
.sk-stat { height: 28px; width: 60%; }
.profile-email { max-width: 220px; }
.mw-480 { max-width: 480px; }
.mw-640 { max-width: 640px; }
.min-w-0 { min-width: 0; }

/* Logo image inside the brand mark */
.brand-mark-logo { background: #fff; padding: 4px; }
.brand-mark-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  padding: .9rem .5rem; min-height: 84px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-size: .78rem; font-weight: 600; text-align: center; background: var(--surface);
}
.quick-action i { font-size: 1.35rem; color: var(--brand-600); }
.quick-action:hover { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
.list-icon-lg { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }

/* Server-side tables */
.dt-container .dt-search, .dt-container .dt-length { display: none; }
.dt-container .dt-info { font-size: .8125rem; color: var(--muted); padding: .85rem 1rem; }
.dt-container .dt-paging { padding: .6rem 1rem; }
.dt-container .dt-paging .pagination { margin: 0; --bs-pagination-font-size: .8125rem; }
.dt-container .dt-processing { background: rgba(255, 255, 255, .85); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); font-size: .8125rem; }
.dt-container table.dataTable { margin: 0 !important; border-collapse: collapse !important; }
.dt-container table.dataTable > thead > tr > th { border-bottom: 1px solid var(--border); }
table.dataTable td.dt-empty { padding: 0 !important; }
.table-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.table-toolbar .search-box { position: relative; flex: 1 1 220px; max-width: 340px; }
.table-toolbar .search-box i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.table-toolbar .search-box input { padding-left: 2.2rem; }
.table-toolbar .form-select, .table-toolbar .form-control { width: auto; min-width: 140px; }
@media (max-width: 575.98px) { .table-toolbar .form-select, .table-toolbar .form-control, .table-toolbar .search-box { max-width: none; width: 100%; flex: 1 1 100%; } }
tr.row-link { cursor: pointer; }

/* Permission matrix */
.perm-module { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.perm-module-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.perm-module-head h4 { font-size: .875rem; margin: 0; text-transform: capitalize; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .25rem 1rem; padding: .75rem 1rem; }
.perm-grid .form-check { padding-top: .25rem; padding-bottom: .25rem; }
.perm-grid .form-check-label code { font-size: .7rem; color: var(--muted); display: block; }
.perm-locked { opacity: .55; }
.override-row { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: center; padding: .5rem 1rem; border-bottom: 1px solid var(--border); font-size: .8125rem; }
.override-row:last-child { border-bottom: 0; }
.override-row select { width: 120px; }
.override-row .state { font-size: .7rem; }

/* Settings */
.settings-nav .nav-link { display: flex; align-items: center; gap: .6rem; color: var(--text-2); border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .875rem; font-weight: 500; }
.settings-nav .nav-link.active { background: var(--brand-50); color: var(--brand-800); }
.settings-nav .nav-link i { color: var(--muted); }
.settings-nav .nav-link.active i { color: var(--brand-600); }
.logo-preview { width: 96px; height: 96px; border: 1px dashed var(--border-strong); border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.json-view { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; font-size: .75rem; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* Employee profile */
.emp-photo { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-2); }
.emp-photo img { width: 100%; height: 100%; object-fit: cover; }
.emp-photo .avatar-lg { width: 72px; height: 72px; border-radius: 16px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--surface); --bs-nav-link-color: var(--text-2); --bs-nav-link-hover-color: var(--brand-700); font-size: .875rem; font-weight: 550; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { white-space: nowrap; }
.nav-tabs .nav-link.active { color: var(--brand-800); }

/* Agent hierarchy tree */
.agent-tree { list-style: none; margin: 0; padding-left: 1.25rem; border-left: 1px dashed var(--border-strong); }
.agent-tree-root > .agent-tree { border-left: 0; padding-left: 0; }
.agent-tree li { position: relative; padding: .3rem 0 .3rem .5rem; font-size: .875rem; }
.agent-tree li.collapsed > .agent-tree { display: none; }
.agent-tree .tree-toggle { border: 0; background: transparent; color: var(--muted); padding: 0 .25rem 0 0; }
.agent-tree .tree-leaf { display: inline-block; width: 1.2rem; }
.agent-tree .tree-label { text-decoration: none; color: var(--text); font-weight: 550; }
.agent-tree li.tree-match > .tree-label { background: var(--accent-soft); border-radius: 4px; padding: 0 .25rem; }
.agent-tree li.tree-dim { opacity: .35; }

/* Inventory status colours */
.inv-available { --inv: var(--success); --inv-bg: var(--success-soft); }
.inv-held      { --inv: var(--warning); --inv-bg: var(--warning-soft); }
.inv-booked    { --inv: var(--info);    --inv-bg: var(--info-soft); }
.inv-sold      { --inv: var(--brand-700); --inv-bg: var(--brand-100); }
.inv-blocked   { --inv: var(--danger);  --inv-bg: var(--danger-soft); }
.inv-withdrawn { --inv: var(--neutral); --inv-bg: var(--neutral-soft); }
.inv-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--inv); display: inline-block; }
.inv-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--neutral-soft); }
.inv-bar span { background: var(--inv); }

/* Availability grid */
.plot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.plot {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: .55rem .6rem; min-height: 72px;
  border-radius: 10px; text-decoration: none; color: var(--text); background: var(--inv-bg); border: 1px solid transparent;
  border-left: 4px solid var(--inv); transition: transform .1s ease, opacity .15s ease;
}
.plot:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--text); border-color: var(--inv); }
.plot:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.plot .plot-no { font-weight: 700; font-size: .9rem; }
.plot .plot-meta { font-size: .68rem; color: var(--text-2); line-height: 1.2; }
.plot .plot-corner { position: absolute; top: .4rem; right: .45rem; font-size: .75rem; color: var(--inv); }
.plot.plot-dim { opacity: .18; }

/* ---------------- Attendance ---------------- */
.punch-panel { display: flex; flex-direction: column; align-items: center; gap: .75rem; text-align: center; }
.punch-clock { font-size: 2.25rem; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.punch-btn { width: 100%; max-width: 22rem; min-height: 4.5rem; font-size: 1.25rem; font-weight: 600; border-radius: 1rem; }
.punch-status { font-size: .875rem; color: var(--muted); }
.att-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; }
.att-cal-head { font-size: .7rem; text-transform: uppercase; color: var(--muted); text-align: center; padding: .25rem 0; }
.att-cal-day { min-height: 4.25rem; border-radius: .5rem; padding: .3rem .35rem; display: flex; flex-direction: column; gap: .1rem; font-size: .7rem; border: 1px solid transparent; }
.att-cal-day.is-blank { background: transparent; }
.att-cal-day.is-today { border-color: var(--brand-600); }
.att-cal-num { font-weight: 700; font-size: .8rem; }
.att-cal-label { line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.att-cal-time { color: inherit; opacity: .8; font-variant-numeric: tabular-nums; }
.att-cal-day.tone-none { background: transparent; border-color: var(--border, #e4e8f0); color: var(--muted); }
.att-cal-day.tone-neutral { background: var(--neutral-soft, #f1f3f7); color: var(--muted); }
.att-cal-day.tone-success { background: var(--success-soft); color: var(--success); }
.att-cal-day.tone-warning { background: var(--warning-soft); color: var(--warning); }
.att-cal-day.tone-danger { background: var(--danger-soft); color: var(--danger); }
.att-cal-day.tone-info { background: var(--info-soft); color: var(--info); }
.office-code { font-size: clamp(3rem, 14vw, 7rem); font-weight: 800; letter-spacing: .2em; font-variant-numeric: tabular-nums; line-height: 1; }
@media (max-width: 575.98px) {
	.att-cal-day { min-height: 3.25rem; padding: .2rem; }
	.att-cal-label, .att-cal-time { display: none; }
}


/* Agent level badges */
.level-badge { width: 40px; height: 40px; object-fit: contain; border-radius: .5rem; background: var(--bs-tertiary-bg, #f4f5f7); }
.level-badge-lg { width: 56px; height: 56px; }

/* ---------- Visual Colony Plot Designer ---------- */
.designer-workbench-bar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.designer-workbench-bar::-webkit-scrollbar {
  display: none;
}

@media (max-width: 991.98px) {
  .designer-page {
    padding-bottom: 70px;
  }
  .designer-canvas-card {
    height: calc(100vh - 200px) !important;
    min-height: 480px !important;
  }
  .designer-workbench-bar {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem !important;
  }
  .designer-workbench-bar > * {
    flex-shrink: 0;
  }
  #designerInspector.offcanvas-lg,
  #designerUnplaced.offcanvas-lg {
    height: 72vh !important;
    max-height: 85vh !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    border-radius: 16px 16px 0 0;
  }
  #designerInspector.offcanvas-lg .card-body,
  #designerUnplaced.offcanvas-lg .card-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #designerInspector.offcanvas-lg .card-header,
  #designerUnplaced.offcanvas-lg .card-header {
    border-radius: 16px 16px 0 0;
  }
  .designer-mobile-nav {
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .designer-mobile-nav .btn {
    border-radius: 999px;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }
}
