/* =========================================================
   Real Estate ERP — Design System  (Bootstrap 5 companion)
   v3.0 — Matches reference screenshot visual language
   ========================================================= */

/* ──────────────────────────────────────────────────────────
   DESIGN TOKENS
   ────────────────────────────────────────────────────────── */
:root {
    --erp-sidebar-width:           264px;
    --erp-sidebar-collapsed-width: 64px;

    --erp-navy:        #0d1b2e;
    --erp-navy-mid:    #152438;
    --erp-navy-soft:   #1d3250;
    --erp-accent:      #3b82f6;
    --erp-accent-dark: #2563eb;
    --erp-accent-glow: rgba(59,130,246,0.18);

    --erp-bg:          #f1f5fb;
    --erp-surface:     #f1f5fb;
    --erp-border:      #dae0ec;
    --erp-border-light:#edf0f7;

    /* dark sidebar theme (matches reference) */
    --erp-sidebar-bg:        linear-gradient(175deg, #0d1b2e 0%, #091320 100%);
    --erp-sidebar-brand-bg:  linear-gradient(135deg, #152438 0%, #0d1b2e 100%);
    --erp-sidebar-border:    rgba(59,130,246,0.1);
    --erp-sidebar-text:      rgba(175,192,215,0.88);
    --erp-sidebar-text-strong: #ffffff;
    --erp-sidebar-muted:     rgba(255,255,255,0.38);
    --erp-sidebar-section-label: rgba(255,255,255,0.25);
    --erp-sidebar-icon:      rgba(255,255,255,0.4);
    --erp-sidebar-hover-bg:  rgba(255,255,255,0.06);
    --erp-sidebar-hover-text:#e2e8f0;
    --erp-sidebar-hover-icon:#93c5fd;

    --erp-text:        #1a2740;
    --erp-text-soft:   #374151;
    --erp-muted:       #64748b;

    --erp-success:     #16a34a;
    --erp-success-bg:  #dcfce7;
    --erp-warning:     #d97706;
    --erp-warning-bg:  #fef3c7;
    --erp-danger:      #dc2626;
    --erp-danger-bg:   #fee2e2;
    --erp-info:        #0284c7;
    --erp-info-bg:     #dbeafe;

    --erp-sidebar-t:   0.22s ease;
    --erp-radius:      10px;
    --erp-radius-lg:   14px;
    --erp-shadow-sm:   0 1px 3px rgba(15,28,46,0.07), 0 1px 2px rgba(15,28,46,0.04);
    --erp-shadow:      0 2px 8px rgba(15,28,46,0.09), 0 1px 3px rgba(15,28,46,0.05);
    --erp-shadow-lg:   0 4px 20px rgba(15,28,46,0.12), 0 2px 6px rgba(15,28,46,0.06);
}

/* ──────────────────────────────────────────────────────────
   BASE
   ────────────────────────────────────────────────────────── */
html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body.erp-body {
    margin: 0;
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ──────────────────────────────────────────────────────────
   SHELL
   ────────────────────────────────────────────────────────── */
.erp-shell { display: flex; min-height: 100vh; }

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

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

.erp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--erp-border);
    background: #fff;
    font-size: 0.78rem;
    color: var(--erp-muted);
}

/* ──────────────────────────────────────────────────────────
   SIDEBAR — shell
   ────────────────────────────────────────────────────────── */
.erp-sidebar {
    width: var(--erp-sidebar-width);
    flex: 0 0 var(--erp-sidebar-width);
    background: var(--erp-sidebar-bg);
    color: var(--erp-sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--erp-sidebar-t), flex-basis var(--erp-sidebar-t);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
    border-right: 1px solid var(--erp-sidebar-border);
    box-shadow: 2px 0 16px rgba(0,0,0,0.28);
    z-index: 25;
}

.erp-sidebar::-webkit-scrollbar { width: 3px; }
.erp-sidebar::-webkit-scrollbar-track { background: transparent; }
.erp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

body.erp-sidebar-collapsed .erp-sidebar {
    width: var(--erp-sidebar-collapsed-width);
    flex-basis: var(--erp-sidebar-collapsed-width);
}

/* ──────────────────────────────────────────────────────────
   SIDEBAR — brand
   ────────────────────────────────────────────────────────── */
.erp-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.1rem 0.9rem 1.05rem 1rem;
    background: var(--erp-sidebar-brand-bg);
    border-bottom: 1px solid var(--erp-sidebar-border);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.erp-brand-mark {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #fff;
    font-size: 1.55rem;
    z-index: 1;
}

.erp-brand-chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--erp-sidebar-muted);
    font-size: 0.8rem;
    z-index: 1;
}

.erp-brand-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    opacity: 1;
    transition: opacity var(--erp-sidebar-t);
    z-index: 1;
    overflow: hidden;
    min-width: 0;
}

.erp-brand-text strong { font-size: 0.92rem; color: var(--erp-sidebar-text-strong); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-brand-text small  { font-size: 0.67rem; color: var(--erp-sidebar-muted); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }

body.erp-sidebar-collapsed .erp-brand-chevron { display: none; }

body.erp-sidebar-collapsed .erp-brand-text { opacity: 0; pointer-events: none; }

/* ──────────────────────────────────────────────────────────
   SIDEBAR — nav content
   ────────────────────────────────────────────────────────── */
.erp-nav { flex: 1 1 auto; padding: 0.5rem 0 0.5rem; overflow-y: auto; }

/* section labels */
.erp-nav-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--erp-sidebar-section-label);
    padding: 0.85rem 1rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity var(--erp-sidebar-t), height var(--erp-sidebar-t), padding var(--erp-sidebar-t);
}

body.erp-sidebar-collapsed .erp-nav-section-label { opacity: 0; height: 0; padding: 0; }

/* top-level flat nav links */
.erp-nav-link--top {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.85rem;
    color: var(--erp-sidebar-text);
    text-decoration: none;
    font-size: 0.855rem;
    font-weight: 400;
    border-radius: 8px;
    margin: 1px 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
}

.erp-nav-link--top::before { display: none !important; }

.erp-nav-link--top:hover {
    background: var(--erp-sidebar-hover-bg);
    color: var(--erp-sidebar-hover-text);
}

/* ACTIVE: solid blue highlight matching screenshot */
.erp-nav-link--top.active {
    background: var(--erp-accent);
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
}

.erp-nav-link-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    width: 20px;
    text-align: center;
    color: var(--erp-sidebar-icon);
    transition: color 0.15s;
}

.erp-nav-link--top:hover .erp-nav-link-icon { color: var(--erp-sidebar-hover-icon); }
.erp-nav-link--top.active .erp-nav-link-icon { color: #fff; }

.erp-nav-link-label {
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity var(--erp-sidebar-t);
    flex: 1;
}

/* standalone Dashboard link */
.erp-nav-standalone {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.85rem;
    color: var(--erp-sidebar-text);
    text-decoration: none;
    font-size: 0.855rem;
    font-weight: 400;
    border-radius: 8px;
    margin: 1px 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
    width: calc(100% - 0.8rem);
}

.erp-nav-standalone .erp-nav-group-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--erp-sidebar-icon);
    transition: color 0.15s;
}

.erp-nav-standalone:hover { background: var(--erp-sidebar-hover-bg); color: var(--erp-sidebar-hover-text); }
.erp-nav-standalone:hover .erp-nav-group-icon { color: var(--erp-sidebar-hover-icon); }

.erp-nav-standalone.active {
    background: var(--erp-accent);
    color: #fff;
    font-weight: 600;
}

.erp-nav-standalone.active .erp-nav-group-icon { color: #fff; }

.erp-nav-standalone-label {
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity var(--erp-sidebar-t);
    flex: 1;
}

/* collapsed states */
body.erp-sidebar-collapsed .erp-nav-link--top { padding: 0.55rem; justify-content: center; margin: 1px 0.4rem; }
body.erp-sidebar-collapsed .erp-nav-link-label { opacity: 0; width: 0; overflow: hidden; }
body.erp-sidebar-collapsed .erp-nav-standalone { padding: 0.55rem; justify-content: center; width: calc(100% - 0.8rem); }
body.erp-sidebar-collapsed .erp-nav-standalone-label { opacity: 0; width: 0; overflow: hidden; }
body.erp-sidebar-collapsed .erp-nav-link-icon { margin: 0; }
body.erp-sidebar-collapsed .erp-nav-standalone .erp-nav-group-icon { margin: 0; }

/* old accordion nav styles (kept for any remaining usage) */
.erp-nav-group-btn { display: none; }
.erp-nav-collapse { border: none; background: transparent; margin: 0; }

/* ──────────────────────────────────────────────────────────
   SIDEBAR — collapse button (BOTTOM)
   ────────────────────────────────────────────────────────── */
.erp-sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.1rem;
    border: none;
    background: transparent;
    color: var(--erp-sidebar-muted);
    width: 100%;
    cursor: pointer;
    font-size: 0.845rem;
    transition: color 0.15s, background 0.15s;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

.erp-sidebar-collapse-btn:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.04); }

.erp-collapse-label {
    opacity: 1;
    transition: opacity var(--erp-sidebar-t);
}

body.erp-sidebar-collapsed .erp-sidebar-collapse-btn { padding: 0.75rem; justify-content: center; }
body.erp-sidebar-collapsed .erp-collapse-label { opacity: 0; width: 0; overflow: hidden; }

/* mobile overlay */
.erp-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 24;
    backdrop-filter: blur(2px);
}

/* ──────────────────────────────────────────────────────────
   TOPBAR
   ────────────────────────────────────────────────────────── */
.erp-topbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 60px;
    box-shadow: 0 1px 4px rgba(15,28,46,0.06);
    flex-shrink: 0;
}

/* hamburger */
.erp-sidebar-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--erp-border);
    border-radius: 8px;
    background: transparent;
    color: var(--erp-muted);
    cursor: pointer;
    font-size: 1.15rem;
    transition: background 0.15s, color 0.15s;
}
.erp-sidebar-toggle:hover { background: var(--erp-surface); color: var(--erp-text); }

/* search — dominant center element */
.erp-topbar-search {
    flex: 1 1 auto;
    position: relative;
    max-width: 540px;
    margin: 0 0.5rem;
}

.erp-topbar-search input {
    width: 100%;
    padding: 0.38rem 0.9rem 0.38rem 2.25rem;
    border: 1px solid var(--erp-border);
    border-radius: 24px;
    font-size: 0.845rem;
    background: var(--erp-surface);
    color: var(--erp-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.erp-topbar-search input:focus {
    border-color: var(--erp-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.erp-topbar-search input::placeholder { color: #9ca3af; }

.erp-topbar-search > i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.85rem;
    pointer-events: none;
}

/* right spacer (pushes actions to right) */
.erp-topbar-spacer { flex: 1 1 auto; }

/* actions group */
.erp-topbar-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

/* icon buttons */
.erp-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--erp-border);
    border-radius: 9px;
    background: #fff;
    color: var(--erp-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}

.erp-icon-btn:hover { background: var(--erp-surface); color: var(--erp-accent); border-color: rgba(59,130,246,0.3); }

/* alias for older class name */
.erp-notif-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--erp-border); border-radius: 9px; background: #fff; color: var(--erp-muted); font-size: 1rem; cursor: pointer; transition: background 0.15s, color 0.15s; text-decoration: none; flex-shrink: 0; }
.erp-notif-btn:hover { background: var(--erp-surface); color: var(--erp-accent); }

/* badges */
.erp-badge {
    position: absolute;
    top: -4px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
    pointer-events: none;
    line-height: 1;
}

.erp-badge--yellow { background: #f59e0b; }
.erp-badge--green  { background: #16a34a; }

/* user menu */
.erp-user-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--erp-border) !important;
    background: #fff !important;
    border-radius: 10px !important;
    padding: 0.28rem 0.65rem 0.28rem 0.4rem !important;
    transition: background 0.15s, border-color 0.15s !important;
}

.erp-user-btn:hover, .erp-user-btn:focus { background: var(--erp-surface) !important; border-color: rgba(59,130,246,0.3) !important; }

.erp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d3250 0%, #0d1b2e 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid rgba(59,130,246,0.25);
}

.erp-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.erp-user-name { font-size: 0.82rem; font-weight: 600; color: var(--erp-text); }
.erp-user-role { font-size: 0.68rem; color: var(--erp-muted); }

.dropdown-menu { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); box-shadow: var(--erp-shadow-lg); }
.dropdown-item { font-size: 0.85rem; padding: 0.45rem 0.9rem; border-radius: 6px; margin: 1px 4px; }
.dropdown-item:hover { background: var(--erp-surface); color: var(--erp-accent); }

/* dashboard topbar extras */
.db-date-range {
    display: inline-flex;
    align-items: center;
    font-size: 0.83rem;
    color: var(--erp-text-soft);
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: 8px;
    padding: 0.42rem 0.75rem;
    white-space: nowrap;
}

.db-refresh-btn { font-size: 0.78rem; padding: 0.26rem 0.7rem; border-radius: 8px; }

/* ──────────────────────────────────────────────────────────
   BREADCRUMB
   ────────────────────────────────────────────────────────── */
.erp-breadcrumb-bar {
    padding: 0.55rem 1.5rem;
    background: transparent;
    font-size: 0.8rem;
}

.breadcrumb {
    margin: 0;
    font-size: 0.8rem;
    --bs-breadcrumb-divider: '›';
}

.breadcrumb-item + .breadcrumb-item::before { color: #9ca3af; }
.breadcrumb-item a { color: var(--erp-accent); text-decoration: none; font-weight: 500; }
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: var(--erp-muted); }

/* ──────────────────────────────────────────────────────────
   PAGE HEADER — icon circle + title + subtitle pattern
   (matches reference screenshot)
   ────────────────────────────────────────────────────────── */
.erp-ph {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.erp-ph-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.erp-ph-icon--blue   { background: #dbeafe; color: #2563eb; }
.erp-ph-icon--purple { background: #ede9fe; color: #7c3aed; }
.erp-ph-icon--green  { background: #dcfce7; color: #16a34a; }
.erp-ph-icon--orange { background: #ffedd5; color: #ea580c; }
.erp-ph-icon--teal   { background: #ccfbf1; color: #0d9488; }
.erp-ph-icon--indigo { background: #e0e7ff; color: #4338ca; }
.erp-ph-icon--red    { background: #fee2e2; color: #dc2626; }

.erp-ph-body { flex: 1; min-width: 0; }
.erp-ph-body h1, .erp-ph-body h2 { font-size: 1.55rem; font-weight: 700; color: var(--erp-navy); margin: 0 0 0.18rem; line-height: 1.2; }
.erp-ph-body p { color: var(--erp-muted); font-size: 0.858rem; margin: 0; }

/* generic page header (existing views use d-flex + h4) */
.erp-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.erp-page-header h2, .erp-page-header h4 { margin: 0; font-size: 1.08rem; font-weight: 700; color: var(--erp-navy); }

/* styled existing d-flex + h4 patterns from views */
.d-flex.justify-content-between.align-items-center.mb-3 h4.mb-0,
.d-flex.justify-content-between.align-items-center h4.mb-0 {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--erp-navy);
}

/* ──────────────────────────────────────────────────────────
   FORM SECTION TAB HEADER  (blue underline accent)
   ────────────────────────────────────────────────────────── */
.erp-section-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--erp-navy);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--erp-accent);
    margin-bottom: 1.25rem;
}

.erp-section-tab i { color: var(--erp-accent); font-size: 1rem; }

/* ──────────────────────────────────────────────────────────
   INPUT WITH PREFIX ICON
   ────────────────────────────────────────────────────────── */
.erp-ifield {
    position: relative;
}

.erp-ifield > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

.erp-ifield .form-control,
.erp-ifield .form-select {
    padding-left: 2.3rem;
}

/* ──────────────────────────────────────────────────────────
   INFO / TIPS CARDS  (right sidebar pattern)
   ────────────────────────────────────────────────────────── */
.erp-info-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--erp-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.erp-info-card .erp-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.erp-info-card h6 { color: #1e40af; font-weight: 700; font-size: 0.88rem; margin-bottom: 0.3rem; }
.erp-info-card p  { color: #1d4ed8; font-size: 0.8rem; margin: 0; line-height: 1.5; }

.erp-tips-card {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: var(--erp-radius);
    padding: 1rem;
}

.erp-tips-card .erp-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.erp-tips-card h6 { color: #92400e; font-weight: 700; font-size: 0.88rem; margin-bottom: 0.55rem; }

.erp-tips-card ul { list-style: none; padding: 0; margin: 0; }

.erp-tips-card ul li {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #78350f;
    padding: 0.18rem 0;
    line-height: 1.4;
}

.erp-tips-card ul li i { color: #16a34a; font-size: 0.82rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ──────────────────────────────────────────────────────────
   CARDS
   ────────────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-sm);
    background: #fff;
}

.card.shadow-sm { box-shadow: var(--erp-shadow-sm) !important; }

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--erp-navy);
    border-radius: var(--erp-radius) var(--erp-radius) 0 0 !important;
    padding: 0.85rem 1.1rem;
}

.erp-card { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); box-shadow: var(--erp-shadow-sm); background: #fff; }

/* stat cards */
.erp-stat-card {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    background: #fff;
    box-shadow: var(--erp-shadow-sm);
    transition: box-shadow 0.18s, transform 0.18s;
    overflow: hidden;
}

.erp-stat-card:hover { box-shadow: var(--erp-shadow-lg); transform: translateY(-2px); }
.erp-stat-card .card-body { display: flex; flex-direction: column; gap: 0.12rem; padding: 1.15rem 1.2rem; }

.erp-stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--erp-muted); font-weight: 600; }
.erp-stat-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--erp-navy); }
.erp-stat-hint  { font-size: 0.74rem; color: var(--erp-muted); }

.erp-stat-card--success { border-left: 3px solid #22c55e; }
.erp-stat-card--warning { border-left: 3px solid #f59e0b; }
.erp-stat-card--danger  { border-left: 3px solid #ef4444; }
.erp-stat-card--info    { border-left: 3px solid #06b6d4; }
.erp-stat-card--primary { border-left: 3px solid var(--erp-accent); }

/* ──────────────────────────────────────────────────────────
   TABLES
   ────────────────────────────────────────────────────────── */
.table { font-size: 0.875rem; }

/* override table-dark to use ERP navy */
.table-dark, .table-dark thead, .table > thead.table-dark {
    --bs-table-bg: var(--erp-navy);
    --bs-table-color: rgba(255,255,255,0.88);
}

.table th {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--erp-muted);
    border-bottom: 2px solid var(--erp-border);
    background: #f8fafc;
    white-space: nowrap;
    vertical-align: middle;
}

/* table-dark thead keeps navy */
thead.table-dark th,
.table-dark > thead > tr > th {
    color: rgba(255,255,255,0.72) !important;
    background: var(--erp-navy) !important;
    border-bottom-color: rgba(255,255,255,0.08) !important;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.table-hover > tbody > tr:hover > td { background-color: #f0f5ff; }
.table td { vertical-align: middle; border-color: var(--erp-border); }

.erp-table-actions { display: flex; align-items: center; gap: 0.3rem; }
.erp-table-actions .btn, td .btn { padding: 0.22rem 0.45rem; font-size: 0.8rem; }

/* ──────────────────────────────────────────────────────────
   BADGES
   ────────────────────────────────────────────────────────── */
.badge { font-size: 0.7rem; font-weight: 600; padding: 0.3em 0.65em; border-radius: 5px; }

/* ──────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────── */
.btn { border-radius: 7px; font-size: 0.875rem; font-weight: 500; transition: all 0.15s; }
.btn-sm { border-radius: 6px; font-size: 0.8rem; }
.btn-lg { border-radius: 9px; }

.btn-primary { background: var(--erp-accent); border-color: var(--erp-accent); box-shadow: 0 1px 3px rgba(59,130,246,0.3); }
.btn-primary:hover { background: var(--erp-accent-dark); border-color: var(--erp-accent-dark); box-shadow: 0 2px 8px rgba(59,130,246,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline-secondary { color: var(--erp-muted); border-color: var(--erp-border); }
.btn-outline-secondary:hover { background: var(--erp-surface); color: var(--erp-text); border-color: var(--erp-border); }

/* ──────────────────────────────────────────────────────────
   FORMS
   ────────────────────────────────────────────────────────── */
.form-label { font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 0.28rem; }

.form-control, .form-select {
    border: 1px solid var(--erp-border);
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 0.42rem 0.75rem;
    color: var(--erp-text);
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--erp-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
    outline: none;
}

.form-control.input-validation-error { border-color: #ef4444; }
.field-validation-error { font-size: 0.77rem; color: #ef4444; }

.form-section {
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 1.2rem 1.35rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--erp-shadow-sm);
}

.form-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--erp-muted);
    margin: 0 0 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-required::after { content: " *"; color: #ef4444; }

/* ──────────────────────────────────────────────────────────
   DETAIL LIST
   ────────────────────────────────────────────────────────── */
.erp-detail-list { display: grid; grid-template-columns: 155px 1fr; gap: 0.45rem 1rem; margin: 0; }
.erp-detail-list dt { font-weight: 600; font-size: 0.8rem; color: var(--erp-muted); }
.erp-detail-list dd { margin: 0; font-size: 0.875rem; }

/* card sub-heading + row-based definition list used on Details pages
   (e.g. <h6 class="erp-card-label"> + <dl class="row erp-dl">) */
.erp-card-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--erp-muted);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-dl dt { font-weight: 600; font-size: 0.82rem; color: var(--erp-muted); margin-bottom: 0.5rem; }
.erp-dl dd { font-size: 0.875rem; color: var(--erp-text); margin-bottom: 0.5rem; }

/* ──────────────────────────────────────────────────────────
   ALERTS
   ────────────────────────────────────────────────────────── */
.alert { border-radius: 9px; font-size: 0.875rem; border: none; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef9c3; color: #854d0e; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ──────────────────────────────────────────────────────────
   MODALS
   ────────────────────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--erp-radius-lg); box-shadow: 0 10px 40px rgba(0,0,0,0.18); }
.modal-header  { border-bottom: 1px solid var(--erp-border); padding: 1rem 1.25rem; }
.modal-footer  { border-top: 1px solid var(--erp-border); padding: 0.85rem 1.25rem; }
.modal-title   { font-size: 1rem; font-weight: 700; color: var(--erp-navy); }

/* ──────────────────────────────────────────────────────────
   EMPTY STATE
   ────────────────────────────────────────────────────────── */
.erp-empty-state { max-width: 420px; margin: 3.5rem auto; text-align: center; color: var(--erp-muted); }
.erp-empty-state .erp-empty-icon { font-size: 2.8rem; margin-bottom: 1rem; opacity: 0.5; }
.erp-empty-state h2 { font-size: 1.1rem; margin-bottom: 0.45rem; color: var(--erp-navy); }
.erp-empty-state p  { color: var(--erp-muted); font-size: 0.875rem; }

/* ──────────────────────────────────────────────────────────
   FILTER BAR
   ────────────────────────────────────────────────────────── */
.erp-filter-bar {
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: flex-end;
    box-shadow: var(--erp-shadow-sm);
}

/* ──────────────────────────────────────────────────────────
   PAGINATION
   ────────────────────────────────────────────────────────── */
.pagination { --bs-pagination-font-size: 0.8rem; }
.page-link { border-color: var(--erp-border); color: var(--erp-accent); border-radius: 6px !important; margin: 0 1px; }
.page-item.active .page-link { background: var(--erp-accent); border-color: var(--erp-accent); }
.page-link:hover { background: var(--erp-surface); color: var(--erp-accent-dark); }

/* ──────────────────────────────────────────────────────────
   AUTH PAGES
   ────────────────────────────────────────────────────────── */
body.erp-auth-body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1b2e 0%, #1d3250 100%);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--erp-text);
}

.erp-auth-shell { display: flex; min-height: 100vh; align-items: stretch; justify-content: center; gap: 0; padding: 2rem 1rem; }

.erp-auth-panel { background: #fff; border-radius: 14px 0 0 14px; padding: 2.25rem; width: 100%; max-width: 420px; align-self: center; box-shadow: 0 8px 40px rgba(0,0,0,0.2); }
.erp-auth-aside { color: #dce6f5; padding: 2.5rem; max-width: 420px; align-self: center; }
.erp-auth-aside h2   { font-size: 1.3rem; margin-bottom: 0.75rem; color: #fff; }
.erp-auth-aside ul   { padding-left: 1.1rem; font-size: 0.875rem; }
.erp-auth-aside li   { margin-bottom: 0.35rem; }

.erp-auth-title      { font-size: 1.3rem; margin-bottom: 0.25rem; }
.erp-auth-subtitle   { font-size: 0.875rem; color: var(--erp-muted); margin-bottom: 1.5rem; }
.erp-auth-brand { display: flex; align-items: center; gap: 0.75rem; padding: 0 0 1.25rem; }
.erp-auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.erp-auth-brand strong { font-size: 1rem; color: var(--erp-navy); }
.erp-auth-brand small  { font-size: 0.75rem; color: var(--erp-muted); }
.erp-auth-panel .erp-brand-mark { background: linear-gradient(135deg, #1d3250 0%, #0d1b2e 100%); box-shadow: none; }

.erp-validation-summary.validation-summary-valid,
.erp-validation-summary:empty { display: none; }
.erp-validation-summary ul { margin: 0; padding-left: 1.1rem; }

/* ──────────────────────────────────────────────────────────
   DASHBOARD
   ────────────────────────────────────────────────────────── */
.db-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.db-header-title { font-size: 1.5rem; font-weight: 700; color: var(--erp-navy); margin: 0 0 0.2rem; line-height: 1.2; }
.db-header-subtitle { font-size: 0.858rem; color: var(--erp-muted); margin: 0; }
.db-header-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

.db-kpi-card { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); background: #fff; box-shadow: var(--erp-shadow-sm); transition: box-shadow 0.18s, transform 0.18s; overflow: hidden; }
.db-kpi-card:hover { box-shadow: var(--erp-shadow-lg); transform: translateY(-2px); }
.db-kpi-card .card-body { padding: 1rem 1.1rem; }

.db-kpi-label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--erp-muted); margin-bottom: 0.2rem; }
.db-kpi-value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--erp-navy); line-height: 1.1; margin-bottom: 0.28rem; }
.db-kpi-value--sm { font-size: 1.3rem; }

.db-kpi-trend { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.71rem; font-weight: 600; }
.db-kpi-trend.up   { color: #16a34a; }
.db-kpi-trend.down { color: #dc2626; }
.db-kpi-trend.flat { color: #64748b; }

.db-kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 11px; font-size: 1.2rem; flex-shrink: 0; }

.db-chart-card { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); background: #fff; box-shadow: var(--erp-shadow-sm); }
.db-chart-card .card-header { background: #fff; border-bottom: 1px solid var(--erp-border); padding: 0.85rem 1.1rem; font-size: 0.92rem; }

.db-filter-pill { display: inline-flex; align-items: center; font-size: 0.76rem; font-weight: 500; color: var(--erp-muted); background: var(--erp-surface); border: 1px solid var(--erp-border); border-radius: 20px; padding: 0.18rem 0.65rem; cursor: pointer; user-select: none; transition: border-color 0.15s, color 0.15s; }
.db-filter-pill:hover { border-color: var(--erp-accent); color: var(--erp-accent); }

.db-chart-canvas-wrap { position: relative; height: 220px; }
.db-donut-canvas-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.db-property-cell { max-width: 140px; }

.db-chart-legend { display: flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--erp-muted); }
.db-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.db-legend-dot.db-dot-blue   { background: #2196f3; }
.db-legend-dot.db-dot-green  { background: #22c55e; }
.db-legend-dot.db-dot-amber  { background: #f59e0b; }
.db-legend-dot.db-dot-purple { background: #8b5cf6; }

.db-donut-legend { display: flex; flex-direction: column; gap: 0.8rem; }
.db-donut-legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--erp-text); }
.db-donut-legend-item strong { margin-left: auto; white-space: nowrap; font-weight: 600; color: var(--erp-navy); }

.db-table-card { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); background: #fff; box-shadow: var(--erp-shadow-sm); }
.db-table-card .card-header { background: #fff; border-bottom: 1px solid var(--erp-border); padding: 0.85rem 1.1rem; font-size: 0.92rem; }

.db-view-all-link { font-size: 0.76rem; font-weight: 500; color: var(--erp-accent); text-decoration: none; }
.db-view-all-link:hover { text-decoration: underline; }

.db-recent-table { font-size: 0.8rem; margin: 0; }
.db-recent-table thead th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.055em; font-weight: 700; color: var(--erp-muted); background: #f8fafc; border-bottom: 1px solid var(--erp-border); padding: 0.6rem 0.85rem; white-space: nowrap; }
.db-recent-table tbody td { padding: 0.5rem 0.85rem; vertical-align: middle; border-color: var(--erp-border); }

.db-ref-link { color: var(--erp-accent); text-decoration: none; font-weight: 600; font-size: 0.78rem; }
.db-ref-link:hover { text-decoration: underline; }

.db-status-badge { display: inline-block; font-size: 0.68rem; font-weight: 600; border-radius: 5px; padding: 0.22em 0.65em; white-space: nowrap; }
.db-status-approved  { background: #dcfce7; color: #15803d; }
.db-status-pending   { background: #fef9c3; color: #a16207; }
.db-status-rejected  { background: #fee2e2; color: #b91c1c; }
.db-status-cancelled { background: #fee2e2; color: #b91c1c; }
.db-status-paid      { background: #dcfce7; color: #15803d; }
.db-status-partial   { background: #fff7ed; color: #c2410c; }

.db-quick-card { border: 1px solid var(--erp-border); border-radius: var(--erp-radius); background: #fff; box-shadow: var(--erp-shadow-sm); }
.db-quick-card .card-header { background: #fff; border-bottom: 1px solid var(--erp-border); padding: 0.85rem 1.1rem; font-size: 0.92rem; }
.db-quick-actions { display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 0.25rem 0; }
.db-quick-btn { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--erp-text); font-size: 0.73rem; font-weight: 500; min-width: 76px; text-align: center; transition: transform 0.15s, color 0.15s; }
.db-quick-btn:hover { transform: translateY(-2px); color: var(--erp-accent); }
.db-quick-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 13px; font-size: 1.25rem; transition: box-shadow 0.15s; }
.db-quick-btn:hover .db-quick-icon { box-shadow: 0 4px 12px rgba(0,0,0,0.14); }

/* icon color variants — used instead of inline style="" so nothing trips the style-src CSP */
.db-icon-blue   { background: #e8f4fd; color: #2196f3; }
.db-icon-green  { background: #e8f8f0; color: #22c55e; }
.db-icon-amber  { background: #fff8e1; color: #f59e0b; }
.db-icon-purple { background: #f0eeff; color: #8b5cf6; }
.db-icon-sky    { background: #e8f4fd; color: #0ea5e9; }
.db-icon-cyan   { background: #e0f2fe; color: #0ea5e9; }
.db-icon-red    { background: #fee2e2; color: #ef4444; }
.db-icon-teal   { background: #ccfbf1; color: #0d9488; }

/* ──────────────────────────────────────────────────────────
   CHECKLISTS / UTILITY
   ────────────────────────────────────────────────────────── */
.erp-checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.erp-checklist li { padding: 0.25rem 0 0.25rem 1.6rem; position: relative; font-size: 0.875rem; }
.erp-checklist li::before { position: absolute; left: 0; font-weight: 700; }
.erp-checklist li.done::before    { content: "✓"; color: #22c55e; }
.erp-checklist li.pending::before { content: "•"; color: #adb5bd; }
.erp-checklist li.pending { color: var(--erp-muted); }

.fw-600 { font-weight: 600; }

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .erp-sidebar {
        position: fixed;
        z-index: 30;
        left: calc(-1 * var(--erp-sidebar-width));
        transition: left var(--erp-sidebar-t);
    }

    body.erp-sidebar-open .erp-sidebar { left: 0; }
    body.erp-sidebar-open .erp-sidebar-overlay { display: block; }
    body.erp-sidebar-collapsed .erp-sidebar { width: var(--erp-sidebar-width); flex-basis: var(--erp-sidebar-width); }

    .erp-auth-aside { display: none; }
    .erp-auth-panel { border-radius: 14px; }
}

@media (max-width: 767.98px) {
    .erp-topbar-search { max-width: 100%; }
}

@media (max-width: 575.98px) {
    .erp-content { padding: 1rem; }
    .erp-topbar  { padding: 0.5rem 0.9rem; }
}

/* ──────────────────────────────────────────────────────────
   PRINT
   ────────────────────────────────────────────────────────── */
@media print {
    .erp-sidebar, .erp-topbar, .erp-sidebar-overlay, .erp-footer, .no-print { display: none !important; }
    .erp-main { margin: 0 !important; }
    .erp-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    body { background: #fff !important; }
    .table { font-size: 0.8rem; }
}
