/* ===== Money Man LLC — theme ===== */
:root {
    --mm-navy: #0f2742;
    --mm-navy-2: #173a5e;
    --mm-gold: #d4a017;
    --mm-gold-dark: #b38712;
    --mm-bg: #f3f5f8;
    --mm-border: #e3e8ef;
    --mm-text-muted: #6b7a90;
    --sidebar-w: 268px;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-primary: #1f5fa8;
    --bs-primary-rgb: 31, 95, 168;
    --bs-link-color: #1f5fa8;
    --bs-link-color-rgb: 31, 95, 168;
}

html { font-size: 15px; }
body { background: var(--mm-bg); color: #1e293b; min-height: 100vh; }

/* ---- Sidebar */
.sidebar {
    background: linear-gradient(180deg, var(--mm-navy) 0%, #0b1d33 100%);
    color: #cfd9e6;
    width: var(--sidebar-w);
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1030; }
    .main { margin-left: var(--sidebar-w); }
}
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); background: var(--mm-navy); height: 100dvh; }
    /* The slide-out menu has a fixed height: let the links scroll (iPhone Safari included), with the logo / close button staying put. */
    .sidebar.offcanvas-lg .sidebar-brand { flex-shrink: 0; }
    .sidebar.offcanvas-lg .sidebar-nav {
        flex: 1 1 auto; min-height: 0; overflow-y: auto;
        -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .2px; }
.brand-sub { color: var(--mm-gold); font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; }
.sidebar-nav { padding: .6rem .6rem 2rem; display: flex; flex-direction: column; }
.sidebar-nav a {
    color: #cfd9e6; text-decoration: none; padding: .5rem .75rem; border-radius: 8px; font-size: .92rem;
    display: flex; align-items: center; gap: .65rem; line-height: 1.25;
}
.sidebar-nav a i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: var(--mm-navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--mm-gold); }
.nav-heading { color: #7f93ad; text-transform: uppercase; font-size: .7rem; letter-spacing: 1.2px; margin: 1.1rem .75rem .35rem; font-weight: 600; }

/* ---- Top bar */
.topbar {
    position: sticky; top: 0; z-index: 1020; background: #fff; border-bottom: 1px solid var(--mm-border);
    display: flex; align-items: center; gap: .75rem; padding: .6rem 1.5rem;
}
.topbar-search { position: relative; align-items: center; flex: 0 1 460px; }
.topbar-search i { position: absolute; left: .8rem; color: var(--mm-text-muted); }
.topbar-search input { padding-left: 2.2rem; border-radius: 999px; background: var(--mm-bg); border-color: transparent; }
.topbar-search input:focus { background: #fff; }

.btn-gold { background: var(--mm-gold); color: #1b1300; font-weight: 600; border: none; }
.btn-gold:hover, .btn-gold:focus { background: var(--mm-gold-dark); color: #fff; }

.content { padding: 1.5rem; max-width: 1500px; }
.content-bare { min-height: 100vh; }
.footer { padding: 1rem 1.5rem 2rem; color: var(--mm-text-muted); font-size: .8rem; }

/* ---- Page header */
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.55rem; font-weight: 700; margin: 0; color: var(--mm-navy); }
.page-header .subtitle { color: var(--mm-text-muted); font-size: .9rem; width: 100%; margin-top: -.4rem; }
.page-header .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Cards */
.card { border: 1px solid var(--mm-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,39,66,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--mm-border); font-weight: 600; color: var(--mm-navy); padding: .8rem 1rem; border-radius: 12px 12px 0 0 !important; display: flex; align-items: center; gap: .5rem; }
.card-header .ms-auto { font-weight: 400; }

.stat-card { padding: 1rem 1.1rem; height: 100%; display: flex; flex-direction: column; gap: .2rem; position: relative; overflow: hidden; }
.stat-card .stat-label { color: var(--mm-text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 700; color: var(--mm-navy); line-height: 1.15; }
.stat-card .stat-sub { font-size: .82rem; color: var(--mm-text-muted); }
.stat-card .stat-icon { position: absolute; right: 1rem; top: 1rem; font-size: 1.5rem; width: 2.6rem; height: 2.6rem; border-radius: 10px; display: grid; place-items: center; }
.stat-danger .stat-value { color: #c0262d; }
.stat-danger .stat-icon { background: #fde8e8; color: #c0262d; }
.stat-success .stat-icon { background: #e3f6ea; color: #1b8a4a; }
.stat-gold .stat-icon { background: #fbf1d6; color: var(--mm-gold-dark); }
.stat-blue .stat-icon { background: #e4eefa; color: #1f5fa8; }
a.stat-link { text-decoration: none; color: inherit; }
a.stat-link .card:hover { border-color: #b9c8db; box-shadow: 0 4px 14px rgba(15,39,66,.08); }

/* Sector tiles */
.sector-tile { padding: 1rem; height: 100%; border-top: 4px solid var(--sector-color, var(--mm-navy)); }
.sector-tile .sector-title { font-weight: 600; color: var(--mm-navy); display: flex; align-items: center; gap: .5rem; }
.sector-tile .sector-title i { color: var(--sector-color); font-size: 1.2rem; }
.sector-tile dl { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; margin: .6rem 0 0; font-size: .88rem; }
.sector-tile dt { font-weight: 400; color: var(--mm-text-muted); }
.sector-tile dd { margin: 0; text-align: right; font-weight: 600; }
.sector-1 { --sector-color: #1f5fa8; }
.sector-2 { --sector-color: #0e9384; }
.sector-3 { --sector-color: #7a4cc2; }
.sector-4 { --sector-color: #d9480f; }
.sector-5 { --sector-color: #c28a00; }
.sector-6 { --sector-color: #5c6b7a; }
.sector-7 { --sector-color: #4d7c0f; }
.sector-8 { --sector-color: #0e7490; }
.sector-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--sector-color) 12%, white); color: var(--sector-color); white-space: nowrap; }

/* Aging bars */
.aging { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #eef1f5; }
.aging > div { height: 100%; }
.age-1 { background: #f4c542; } .age-2 { background: #f08c2e; } .age-3 { background: #e0552f; } .age-4 { background: #b3141c; }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }

.bar-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: .75rem; align-items: center; font-size: .88rem; margin-bottom: .55rem; }
.bar-track { background: #eef1f5; height: 10px; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sector-color, var(--mm-navy)); border-radius: 999px; }

/* ---- Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--mm-text-muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table td, .table th { vertical-align: middle; padding: .55rem .75rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f5f8fc; }
.table tfoot td, .table tfoot th { font-weight: 700; background: #f8fafc; }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-late { color: #c0262d; font-weight: 600; }
.row-void td { text-decoration: line-through; color: #98a2b3; }

/* ---- Forms */
.validation-summary-valid { display: none !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.form-label { font-weight: 600; font-size: .85rem; color: #334155; margin-bottom: .25rem; }
.form-section { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--mm-navy); border-bottom: 2px solid var(--mm-gold); padding-bottom: .3rem; margin: 1.5rem 0 1rem; }
.form-section:first-child { margin-top: 0; }
.input-group-text { background: #f8fafc; }
.big-amount { font-size: 1.6rem; font-weight: 700; text-align: right; }
.type-picker .btn { min-width: 105px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #1d4b7a 0, var(--mm-navy) 45%, #081627 100%); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; border-radius: 16px; padding: 2rem; }
.login-card img { width: 84px; height: 84px; object-fit: contain; }

/* Definition lists in detail pages */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .92rem; margin: 0; }
.kv dt { color: var(--mm-text-muted); font-weight: 500; }
.kv dd { margin: 0; }

.empty-state { text-align: center; color: var(--mm-text-muted); padding: 2.5rem 1rem; }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* ===== Print ===== */
.print-letterhead { display: none; }
.print-only { display: none; }
.signature-block { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-top: 3rem; }
.signature-line { border-top: 1px solid #000; padding-top: .3rem; font-size: .85rem; }

@media print {
    @page { margin: .5in; }
    html { font-size: 11px; }
    body { background: #fff !important; }
    .no-print, .sidebar, .topbar, .footer, .btn, form.filters { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; max-width: none; }
    .print-only { display: block; }
    .print-letterhead { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
    .print-letterhead img { width: 48px; height: 48px; object-fit: contain; }
    .lh-name { font-size: 18px; font-weight: 700; }
    .lh-addr { font-size: 11px; }
    .card { border: none !important; box-shadow: none !important; break-inside: avoid; }
    .card-header { padding-left: 0; border-bottom: 1px solid #000; }
    .table > thead th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table td, .table th { padding: 3px 5px; }
    a { color: #000 !important; text-decoration: none !important; }
    .sector-badge { background: none !important; padding: 0; color: #000 !important; }
    .page-header .actions { display: none; }
}

/* Office-use verification box on the credit application */
.office-box { border: 2px dashed var(--mm-navy, #1b2a4a); border-radius: .5rem; padding: 1rem; background: rgba(212, 175, 55, .08); }
.office-box .office-title { font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: .85rem; color: var(--mm-navy, #1b2a4a); margin-bottom: .75rem; }
