:root {
    --primary: #000016;
    --primary-light: #1A5580;
    --accent: #11115C;
    --accent-hover: #C29560;
    --bg-main: #F8F9FA;
    --bg-card: #FFFFFF;
    --text-primary: #1A2332;
    --text-secondary: #5F6B7A;
    --border: #E5E8EB;
    --success: #2D7A3E;
    --warning: #C17A2F;
    --danger: #B83C3C;
    --shadow-sm: 0 1px 3px rgba(10, 59, 92, 0.08);
    --shadow-md: 0 4px 12px rgba(10, 59, 92, 0.12);
    --shadow-lg: 0 8px 24px rgba(10, 59, 92, 0.16);
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: var(--primary);
    color: white;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.logo-subtitle {
    font-size: 0.875rem;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.nav-menu {
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

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

.nav-item.active {
    background: var(--accent);
    color: white;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: white;
}

.nav-icon {
    margin-right: 0.875rem;
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

/* Sidebar icon colors */
.nav-icon .bi-person-circle      { color: #5B9BD5; }  /* Profile - blue */
.nav-icon .bi-box-arrow-right      { color: #6BCB77; }  /* Logout - green */
.nav-icon .bi-speedometer2      { color: #5B9BD5; }  /* Dashboard - blue */
.nav-icon .bi-graph-up          { color: #6BCB77; }  /* Reports - green */
.nav-icon .bi-buildings          { color: #A8A8A8; }  /* Properties - silver */
.nav-icon .bi-people             { color: #F5C542; }  /* Tenants - gold */
.nav-icon .bi-file-earmark-ruled { color: #81C784; }  /* Leases - green */
.nav-icon .bi-file-earmark-text  { color: #FFB74D; }  /* Applications - orange */
.nav-icon .bi-hourglass-split    { color: #CE93D8; }  /* Waiting Lists - purple */
.nav-icon .bi-cash-stack         { color: #66BB6A; }  /* Rent Collection - green */
.nav-icon .bi-wrench-adjustable  { color: #90A4AE; }  /* Maintenance - steel */
.nav-icon .bi-tree               { color: #66BB6A; }  /* Grounds - green */
.nav-icon .bi-bug                { color: #EF5350; }  /* Pest Control - red */
.nav-icon .bi-p-square           { color: #42A5F5; }  /* Parking - blue */
.nav-icon .bi-calendar-check     { color: #5B9BD5; }  /* Make Ready - blue */
.nav-icon .bi-bullseye           { color: #EF5350; }  /* Tasks - red */
.nav-icon .bi-clock-history      { color: #FFB74D; }  /* Timekeeping - orange */
.nav-icon .bi-award-fill         { color: #F5ED05; }  /* Incentives - yellow */
.nav-icon .bi-person-badge       { color: #42A5F5; }  /* Employees - blue */
.nav-icon .bi-dash-circle-fill   { color: #EF5350; }  /* Debits - red */
.nav-icon .bi-plus-circle-fill   { color: #66BB6A; }  /* Credits - green */

/* Keep active nav icons white for contrast against accent background */
.nav-item.active .nav-icon [class^="bi-"] {
    color: #FFFFFF;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 59, 92, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-btn, .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-btn {
    background: var(--bg-main);
    border: none;
    font-size: 1.25rem;
    position: relative;
}

.notification-btn:hover {
    background: var(--border);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.user-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Dashboard Content */
.dashboard {
    padding: 2rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(10, 59, 92, 0.1); color: var(--primary); }
.stat-icon.accent { background: rgba(212, 165, 116, 0.1); color: var(--accent); }
.stat-icon.success { background: rgba(45, 122, 62, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(193, 122, 47, 0.1); color: var(--warning); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-action {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.card-action:hover {
    color: var(--accent-hover);
}

.card-body {
    padding: 1.5rem;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.table tr:last-child td {
    border-bottom: none;
}

.property-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.property-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.occupied { background: rgba(45, 122, 62, 0.1); color: var(--success); }
.badge.vacant { background: rgba(193, 122, 47, 0.1); color: var(--warning); }
.badge.maintenance { background: rgba(184, 60, 60, 0.1); color: var(--danger); }
.badge.pending { background: rgba(212, 165, 116, 0.1); color: var(--accent); }

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.maintenance { background: rgba(193, 122, 47, 0.1); color: var(--warning); }
.activity-icon.payment { background: rgba(45, 122, 62, 0.1); color: var(--success); }
.activity-icon.application { background: rgba(212, 165, 116, 0.1); color: var(--accent); }
.activity-icon.alert { background: rgba(184, 60, 60, 0.1); color: var(--danger); }

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.activity-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.action-btn:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.action-btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.action-btn-text {
    font-weight: 600;
    font-size: 0.9375rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .search-bar {
        display: none;
    }

    .dashboard {
        padding: 1.5rem 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.mobile-overlay.active {
    display: block;
}

.bottom-bar {
    position: sticky;
    bottom: 0;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: #fff;
    border-top: 1px solid #dee2e6;
    z-index: 100;
}

.bottom-bar-text {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  background: #1a1a1a;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.toolbar-group.flex-grow-1 {
  flex: 1 1 auto;
  min-width: 160px;
}

.toolbar-group.ms-auto {
  margin-left: auto;
  flex-shrink: 0;
}

.tb-divider {
  width: 1px;
  height: 22px;
  background: #333;
  flex-shrink: 0;
}

/* ── Search input ────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 8px;
  color: #666;
  pointer-events: none;
  font-size: 14px;
}

.tb-input {
  background: #eeeeee;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  color: #000000;
  padding: 6px 10px;
  font-size: 13px;
  height: 32px;
  outline: none;
  transition: border-color .15s;
}

.tb-input.with-icon {
  padding-left: 28px;
}

.tb-input:focus {
  border-color: #f5a623;
}

/* ── Selects ─────────────────────────────────────────────── */
.tb-select {
  background-color: #2a2a2a;
  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='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  color: #e8e8e8;
  padding: 5px 28px 5px 10px;
  font-size: 13px;
  height: 32px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}

.tb-select:focus {
  border-color: #f5a623;
}

.tb-select:hover {
  border-color: #555;
}

/* ── Label ───────────────────────────────────────────────── */
.tb-label {
  color: #888;
  font-size: 12px;
  white-space: nowrap;
}

/* ── Add New button ──────────────────────────────────────── */
.tb-btn {
  background: #f5a623;
  border: none;
  border-radius: 5px;
  color: #1a1a1a;
  padding: 0 14px;
  height: 32px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background .15s, transform .1s;
}

.tb-btn:hover {
  background: #f7b84b;
}

.tb-btn:active {
  transform: scale(0.97);
}

.tb-per-page {
 width: 70px;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-group {
    width: 100%;
  }

  .toolbar-group.ms-auto {
    margin-left: 0;
    justify-content: space-between;
  }

  .tb-input,
  .tb-select {
    width: 100%;
    box-sizing: border-box;
  }

  .tb-divider {
    display: none;
  }

  .tb-btn {
    flex: 1;
    justify-content: center;
  }
}


/* ================================================================
   MBS WebPOS — Embedded mode overrides
   Scoped to #content_mbs so standalone pos.html is unaffected.
   ================================================================ */

/* pos.css sets body { overflow: hidden } for standalone use —
   override it when the POS is embedded in the app */
body {
  overflow: auto !important;
}

/* ── DESKTOP: let the page scroll, remove viewport-lock ─── */
#content_mbs .pos-main {
  height: auto !important;
  overflow: visible !important;
}

#content_mbs .cart-panel,
#content_mbs .right-panel {
  height: auto !important;
  overflow: visible !important;
}

/* Cart table: honour the fixed height from pos.css */
#content_mbs .cart-table-wrap {
  flex: 0 0 220px;
  height: 220px;
}

/* Products and payment flow naturally — no clipping */
#content_mbs .products-section {
  flex: unset;
  overflow: visible;
  max-height: none;
}

#content_mbs .payment-section {
  overflow: visible;
}

/* Hide the POS header — your app already has a top-bar */
#content_mbs .pos-header {
  display: none;
}

/* ── MOBILE: replace absolute panel stacking with display:none
   toggling so panels flow naturally and scroll with the page  */
@media (max-width: 640px) {
  /* Tab bar sticks under your app's top-bar */
  #content_mbs .mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  #content_mbs .pos-main {
    display: block;
    height: auto;
    overflow: visible;
    position: static;
  }

  /* Both panels: static, full-width, natural height, scrollable */
  #content_mbs .cart-panel,
  #content_mbs .right-panel {
    position: static;
    width: 100%;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Hidden panel: collapse completely */
  #content_mbs .cart-panel.panel-hidden,
  #content_mbs .right-panel.panel-hidden {
    display: none !important;
  }

  /* Visible cart panel: flex column so payment flows below cart */
  #content_mbs .cart-panel:not(.panel-hidden) {
    display: flex;
    flex-direction: column;
  }

  /* Visible products panel: flex column */
  #content_mbs .right-panel:not(.panel-hidden) {
    display: flex;
    flex-direction: column;
  }

  /* Keep fixed height on mobile too — panel scrolls as a unit */
  #content_mbs .cart-table-wrap {
    flex: 0 0 220px;
    height: 220px;
    overflow-y: auto;
  }
}
