/* ============================================================
   Monthly Income & Expense Checklist - Stylesheet
   
   Mobile-first, Bootstrap 5.3
   ============================================================ */

:root {
    --app-bg: #f4f6f9;
    --card-radius: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --brand: #0d6efd;
    --income: #198754;
    --expense: #dc3545;
    --pending: #fd7e14;
}

* { box-sizing: border-box; }

body.app-body {
    background: var(--app-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #212529;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: #0d2b45;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1030;
}
.app-navbar .nav-link { color: #cfd8e3; font-size: .9rem; }
.app-navbar .nav-link.active { color: #fff; font-weight: 600; }
.app-navbar .nav-link:hover { color: #fff; }

/* Module switcher: let Bootstrap position the dropdown so it overlays page
   content instead of pushing/clipping it. The menu must stay above the month
   toolbar and normal page controls. */
.app-navbar .btn-group .dropdown-menu {
    z-index: 1060;
    max-width: calc(100vw - 1.5rem);
}
.app-navbar .btn-group .dropdown-menu-end { left: auto; right: 0; }
/* So the collapsed mobile menu never clips the open dropdown */
.app-navbar .navbar-collapse { overflow: visible; }

/* ============================================================
   Mobile: module-switcher dropdown + layout
   ============================================================ */
@media (max-width: 991.98px) {
    /* Within the expanded mobile navbar the module dropdown positions
       left-aligned and fits fully inside the viewport. */
    .app-navbar .btn-group .dropdown-menu {
        position: static;
        float: none;
        max-width: none;
        width: 100%;
        transform: none !important;
        border: 1px solid #e9ecef;
        margin-top: .25rem;
    }
    .app-navbar .btn-group {
        width: 100%;
        margin-right: 0;
        margin-left: 0;
    }
    .app-navbar .btn-group > .btn { text-align: left; width: 100%; }
    /* Stack dropdown items so both modules remain fully visible */
    .app-navbar .btn-group .dropdown-menu .dropdown-item { white-space: normal; }
    /* keep user + logout on their own full-width rows so nothing overlaps */
    .app-navbar .navbar-collapse .d-flex { flex-wrap: wrap; }
    .app-navbar .navbar-collapse .btn-outline-light.btn-sm { width: 100%; margin-top: .25rem; }
}

/* Module switcher button keeps its width while expanded in mobile navbar */
@media (min-width: 992px) {
    .app-navbar .btn-group { width: auto; }
}

/* Ensure collapses/nav content cannot exceed the viewport width */
.navbar-collapse, .navbar .container, .navbar .container-fluid { min-width: 0; }

/* ---------- Container ---------- */
.app-container {
    width: 100%;
    max-width: none;
    padding-bottom: 80px; /* room for mobile bottom nav */
}
/* Respect home-indicator safe area on notched phones */
@supports (padding: max(0px)) {
    .app-container { padding-bottom: max(80px, calc(72px + env(safe-area-inset-bottom))); }
    .mobile-bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}
@media (min-width: 992px) { .app-container { padding-bottom: 40px; } }

/* Desktop workspace: use the available screen width consistently on every
   Accounting and Project Management page. Keep a comfortable edge gutter on
   large monitors while the Bootstrap mobile layout continues to stack. */
@media (min-width: 992px) {
    .app-container,
    .app-navbar > .container-fluid {
        padding-left: clamp(1rem, 2vw, 2.5rem) !important;
        padding-right: clamp(1rem, 2vw, 2.5rem) !important;
    }
}

@media (max-width: 575.98px) {
    .app-container {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
}

/* Avoid horizontal scrollbars on any device (overflow-x: clip keeps the
   sticky navbar working, unlike overflow-x: hidden). */
html, body { max-width: 100%; }
body { overflow-x: clip; }

/* ---------- Month selector bar ---------- */
/* Kept in normal document flow on all breakpoints so it can never float
   over (or block) the summary cards or checklists while scrolling. */
.month-selector-bar {
    background: #fff;
    padding: .6rem .75rem;
    border: 1px solid #e9ecef;
    position: static;
    z-index: auto;
}
/* On very small screens the month buttons must share the row without
   pushing it off-canvas. */
.month-navigation-row .mn-prev,
.month-navigation-row .mn-next { min-width: 0; }
.month-navigation-row .mn-prev .btn,
.month-navigation-row .mn-next .btn {
    padding: .375rem .5rem;
    white-space: nowrap;
}
.month-navigation-row .mn-select { min-width: 0; }
.month-navigation-row .mn-select .form-select { min-width: 0; text-overflow: ellipsis; }
/* Row 1: prev | month | next */
.month-navigation-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.month-navigation-row .mn-prev,
.month-navigation-row .mn-next { flex: 0 0 auto; }
.month-navigation-row .mn-prev .btn,
.month-navigation-row .mn-next .btn { padding: .375rem .6rem; }
.month-navigation-row .mn-select { flex: 1 1 auto; }
/* Row 2: action buttons */
.month-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .5rem;
    align-items: center;
}
.month-action-row .btn { flex: 1 1 auto; white-space: nowrap; }
/* Row 3: opening balance */
.opening-balance-row {
    margin-top: .5rem;
    font-size: .8rem;
    color: #495057;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: .3rem;
}
@media (min-width: 768px) {
    .month-action-row .btn { flex: 0 1 auto; }
}

/* ---------- Summary cards ---------- */
.summary-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: .75rem .9rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #adb5bd;
    height: 100%;
    min-height: 84px;
}
.summary-card .sc-label {
    font-size: .72rem;
    color: #6c757d;
    margin-bottom: .3rem;
    letter-spacing: .2px;
}
.summary-card .sc-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #212529;
    word-break: break-word;
}
.income-card { border-left-color: var(--income); }
.expense-card { border-left-color: var(--expense); }
.pending-card { border-left-color: var(--pending); }
.balance-card { border-left-color: var(--brand); }

/* color the values */
.summary-card.income-card .sc-value { color: var(--income); }
.summary-card.expense-card .sc-value { color: var(--expense); }
.summary-card.pending-card .sc-value { color: var(--pending); }
.summary-card.balance-card .sc-value { color: var(--brand); }

/* Summary cards: keep 2 columns on phones, collapse to 1 below 380px */
@media (max-width: 379.98px) {
    .summary-grid .col-6 { flex: 0 0 100%; max-width: 100%; }
    .summary-card { min-height: 64px; }
}
/* Slightly tighter pills on very small screens */
@media (max-width: 575.98px) {
    .summary-card { padding: .6rem .7rem; }
}

/* ---------- Section titles ---------- */
.section-title { font-weight: 700; color: #343a40; }

/* ---------- List cards (mobile stacked) ---------- */
.list-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #e9ecef;
    box-shadow: var(--shadow-sm);
    padding: .6rem .75rem;
    margin-bottom: .55rem;
    transition: background .2s;
}
.list-main { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.list-main .form-switch { padding-top: 6px; margin-top: 0; }
.list-body { flex: 1 1 auto; min-width: 0; }
@media (min-width: 480px) {
    .list-main { flex-wrap: nowrap; }
}
/* Allow actions to wrap onto their own line on very narrow screens so the
   detail text still has room */
@media (max-width: 479.98px) {
    .list-actions { flex: 0 0 100%; justify-content: flex-start; }
    .list-actions .status-badge { width: auto; }
}
.list-title {
    font-weight: 600;
    font-size: .95rem;
    color: #212529;
    line-height: 1.3;
}
.list-meta { margin-top: .2rem; font-size: .85rem; }
.amount-original { font-weight: 600; color: #495057; }
.amount-converted { font-weight: 700; color: #0d6efd; }
.rate-badge {
    display: inline-block;
    background: #eef2ff;
    color: #3b4e8c;
    border-radius: 8px;
    font-size: .7rem;
    padding: .1rem .45rem;
    margin-left: .3rem;
}
.list-sub { margin-top: .25rem; font-size: .78rem; color: #6c757d; }
.list-sub span { display: inline-block; margin-right: .6rem; }
.list-notes {
    margin-top: .3rem;
    font-size: .78rem;
    color: #868e96;
    font-style: italic;
    background: #f8f9fa;
    padding: .3rem .5rem;
    border-radius: 6px;
}
.list-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .25rem;
    flex-shrink: 0;
}
.list-actions .btn {
    padding: .15rem .35rem;
    line-height: 1.2;
}
.list-actions .btn i { font-size: .85rem; }
.list-actions .status-badge { width: 100%; text-align: center; margin-bottom: .1rem; }
.status-badge {
    font-size: .68rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 20px;
    white-space: nowrap;
}
.status-received,
.status-paid,
.status-full { background: #d1e7dd; color: #14532d; }
.status-pending { background: #fff3cd; color: #664d03; }
.status-due { background: #fff3cd; color: #664d03; }
.status-overdue { background: #f8d7da; color: #842029; }
.status-partial { background: #cfe2ff; color: #0a4dbd; }
.status-overpaid { background: #e4d9f7; color: #5b21b6; }

/* completed / pending backgrounds */
.list-card.completed { background: #f0fbf3; border-color: #c6e9d3; }
.list-card.completed .list-title { text-decoration: line-through; color: #6c757d; }
.list-card.pending-bg { background: #fffdf5; }
.list-card.overdue-bg { background: #fef2f2; border-color: #f5c2c7; }
.list-card.due-soon-bg { background: #fffcf0; border-color: #ffecb5; }
.list-card.overpaid-bg { background: #faf6ff; border-color: #d9c7f2; }

/* Partial payment progress line (expected/received/remaining) */
.list-totals {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    margin-top: .3rem;
    font-size: .74rem;
    background: #f6f8fb;
    border-radius: 8px;
    padding: .28rem .5rem;
}
.pp-label { color: #495057; letter-spacing: .1px; }
.pp-label.pp-received { color: var(--income); font-weight: 600; }
.pp-label.pp-remaining { color: var(--pending); font-weight: 600; }
.pp-label .overpaid-note { color: #5b21b6; font-weight: 700; }

.empty-state {
    text-align: center;
    color: #adb5bd;
    padding: 2rem 0;
    font-size: .95rem;
}
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* ---------- Desktop tables ---------- */
.dtable thead th { font-size: .78rem; text-transform: uppercase; color: #6c757d; }
.dtable tbody td { font-size: .85rem; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn { border-radius: 8px; }
.btn-lg-touch { padding: .6rem 1rem; }

/* ---------- Floating add button ---------- */
.floating-add-btn {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 1050;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(13,110,253,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.floating-add-btn:hover { background: #0b5ed7; color: #fff; }

/* ---------- Mobile bottom navigation ---------- */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: .45rem 0 calc(.45rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.mobile-bottom-nav a {
    color: #6c757d;
    text-decoration: none;
    text-align: center;
    font-size: .62rem;
    padding: .2rem .4rem;
    flex: 1;
}
.mobile-bottom-nav a i { font-size: 1.15rem; display: block; }
.mobile-bottom-nav a.active { color: var(--brand); }
.mobile-add-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: 4px solid #fff;
    margin-top: -22px;
    box-shadow: 0 4px 12px rgba(13,110,253,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* ---------- Modal / preview ---------- */
.preview-box {
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    color: #0d6efd;
}
.modal-content { border-radius: var(--card-radius); }
.modal-header { border-bottom: 1px solid #eef1f4; }

/* ---------- Loading overlay ---------- */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
#loadingOverlay.show { display: flex; }

/* ---------- Login page ---------- */
body.login-body { background: linear-gradient(135deg,#0d2b45,#123a5e); min-height: 100vh; }
.login-card { border-radius: 18px; }
.login-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto .6rem;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
}

/* ---------- Settings page ---------- */
.currency-table .badge { font-size: .68rem; }

/* ---------- Report page ---------- */
.report-table { font-size: .84rem; }
@media (max-width: 575.98px) {
    .report-table { font-size: .74rem; }
}

/* ---------- Toast ---------- */
.toast-container { z-index: 3000; }
.app-toast { border-radius: 10px; }

/* ---------- Report header ---------- */
.print-report-header {
    text-align: center;
    border: 1px solid #cbd9ee;
    border-top: 4px solid #0d6efd;
    border-radius: 10px;
    background: #f7faff;
    margin-bottom: 1.25rem;
    padding: 0.8rem 1rem;
}
.print-report-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
}
.print-report-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0.15rem 0 0;
    color: #000;
}
.print-report-header .report-period {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.25rem;
}
.print-report-header .report-generated-date {
    font-size: 0.8rem;
    color: #444;
    margin-top: 0.15rem;
}

/* ---------- Report table totals & counts ---------- */
.report-table thead th { border-bottom: 2px solid #333; color: #000; font-size: 0.8rem; }
.table-total-row th {
    background: #eef2f7 !important;
    border-top: 2px solid #333 !important;
    font-weight: 700;
    text-align: right;
}
.table-total-row th:first-child { text-align: left; }
.income-total-row th, .expense-total-row th { font-size: 0.85rem; }
.expense-total-table { border-collapse: collapse; }

.report-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    font-size: 0.85rem;
}
.report-currency-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    color: #333;
}
/* Wrap long details/source text */
.wrap-cell { word-break: break-word; overflow-wrap: anywhere; white-space: normal; }
.nowrap { white-space: nowrap; }

/* Print page-break helpers */
.page-print-break { height: 0; }

/* ---------- Print CSS ---------- */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    .app-navbar,
    .mobile-bottom-nav,
    .floating-add-btn,
    .print-hide,
    .d-lg-none,
    .btn { display: none !important; }

    body.app-body { background: #fff !important; font-size: 9pt; color: #000; }

    .app-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
        margin-bottom: 0.5rem !important;
        page-break-inside: auto;
    }
    .card-header { background: #fff !important; padding: 0.25rem 0.5rem !important; }
    .card-body { padding: 0.4rem 0.5rem !important; }

    .print-report-header { page-break-after: avoid; margin-bottom: 0.75rem; }
    .summary-section { page-break-inside: avoid; }

    table {
        width: 100% !important;
        table-layout: auto;
        border-collapse: collapse;
        font-size: 8pt;
    }
    .report-table th, .report-table td { padding: 2px 4px !important; }
    thead { display: table-header-group; }
    tfoot { display: table-row-group !important; }
    tfoot tr { break-inside: avoid !important; page-break-inside: avoid !important; }
    tr { page-break-inside: avoid; break-inside: avoid; }
    .table-total-row, .income-total-row, .expense-total-row { page-break-inside: avoid; }

    .list-actions, .status-print .badge, .report-actions { display: none !important; }
    a { color: #000 !important; text-decoration: none !important; }

    /* Avoid blank pages */
    .page-print-break { page-break-before: auto; }
    .print-clear { page-break-inside: auto; }

    /* Keep summary + income header on first page */
    .summary-section, .print-report-header { page-break-inside: avoid; }

    /* Footer stays in document flow and cannot cover report rows. */
    .print-only { display: block !important; }
    .print-footer {
        position: static;
        margin-top: 8px;
        text-align: center;
        font-size: 8pt;
        color: #333;
        border-top: 1px solid #ccc;
        padding-top: 3px;
    }
    .print-report-header {
        border: 1px solid #9fb6d8 !important;
        border-top: 4px solid #0d6efd !important;
        border-radius: 7px;
        background: #f7faff !important;
        padding: 7px 10px !important;
    }
    .expense-total-table { break-inside: avoid !important; page-break-inside: avoid !important; }
    .card-body > h6 { break-after: avoid; page-break-after: avoid; }
}

.print-only { display: none; }
@media screen { .print-only { display: none; } }

/* ==========================================================
   Project Management module styles
   ========================================================== */
.kpi-card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: .5rem; }
.kpi-card .card-body { padding: .9rem 1rem; }
.kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; color: #6c757d; }
.kpi-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }

.pm-progress { height: 6px; }
.pm-table th { font-size: .75rem; text-transform: uppercase; color: #6c757d; }
.pm-detail-label { font-size: .74rem; text-transform: uppercase; color: #6c757d; }
.pm-money { white-space: nowrap; }
.pm-muted { color: #6c757d; }
.pm-amount-orig { color: #6c757d; font-size: .78rem; }

.status-badge-pm { font-size: .72rem; font-weight: 600; }

/* Public project page */
.pub-hero { background: linear-gradient(135deg,#2b5876,#4e4376); color: #fff; }
.pub-stat { background: rgba(255,255,255,.12); border-radius: .5rem; padding: .75rem; }

/* Allow long taxonomy labels (service types, cost categories) to wrap
   inside their cards so nothing overflows horizontally. */
.pm-settings .card-body .badge,
.card-body .badge.bg-light { white-space: normal; word-break: break-word; }

/* ============================================================
   Project-centric workspace
   ============================================================ */
.pm-workspace { display: flex; gap: 1rem; align-items: flex-start; }

/* Left sidebar (desktop) */
.pm-sidenav {
    flex: 0 0 220px;
    max-width: 220px;
    position: sticky;
    top: 76px;
    z-index: 900;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.pm-sidenav .pm-section-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    color: #343a40;
    text-decoration: none;
    font-size: 0.86rem;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.pm-sidenav .pm-section-link:hover { background: #f2f6fb; }
.pm-sidenav .pm-section-link.active { background: #eaf1fb; border-left-color: #0d6efd; color: #0d6efd; font-weight: 600; }
.pm-sidenav .pm-section-link i { width: 18px; text-align: center; color: #6c757d; }
.pm-sidenav .pm-section-link.active i { color: #0d6efd; }

/* Content column */
.pm-content {
    flex: 1 1 auto;
    min-width: 0;
}
.pm-pane { display: none; }
.pm-pane.active { display: block; }

/* Project header cards */
.pm-header-stat {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid #e9ecef; border-radius: 0.55rem;
    padding: 0.5rem 0.7rem; box-shadow: 0 1px 3px rgba(0,0,0,.04);
    height: 100%;
}
.pm-header-stat .phs-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .02em; color: #6c757d; }
.pm-header-stat .phs-value { font-size: 0.95rem; font-weight: 700; color: #212529; word-break: break-word; line-height: 1.2; }

/* Mobile: sidebar collapse into horizontal tabs */
@media (max-width: 991.98px) {
    .pm-workspace { flex-direction: column; }
    .pm-sidenav {
        flex: none;
        max-width: 100%;
        width: 100%;
        position: static;
        top: auto;
        display: flex;
        gap: .25rem;
        overflow-x: auto;
        white-space: nowrap;
        padding: .4rem;
        border-radius: 0.5rem;
    }
    .pm-sidenav .pm-section-link {
        flex: 0 0 auto;
        border-left: 0;
        border-bottom: 2px solid transparent;
        border-radius: 0.35rem;
        font-size: .8rem;
        padding: .4rem .6rem;
    }
    .pm-sidenav .pm-section-link:hover { background: #f2f6fb; }
    .pm-sidenav .pm-section-link.active { border-bottom-color: #0d6efd; border-left: 0; }
}

/* Responsive tables inside panes degrade to stacked cards */
@media (max-width: 575.98px) {
    .pm-pane .table-responsive { overflow-x: visible; }
    .pm-pane table.pm-table { display: block; }
    .pm-pane table.pm-table thead { display: none; }
    .pm-pane table.pm-table tbody, .pm-pane table.pm-table tr, .pm-pane table.pm-table td {
        display: block; width: 100%;
    }
    .pm-pane table.pm-table tr {
        border: 1px solid #e9ecef; border-radius: 0.5rem; margin-bottom: .5rem; padding: .4rem .5rem;
    }
    .pm-pane table.pm-table td {
        border: 0; text-align: left !important; display: flex; justify-content: space-between; gap: .5rem;
        padding: .2rem .25rem; font-size: .8rem;
    }
    .pm-pane table.pm-table td::before {
        content: attr(data-label); font-weight: 600; color: #6c757d; text-transform: uppercase; font-size: .67rem;
    }
    .pm-pane table.pm-table td[data-label=""]::before { display: none; }
    /* float del buttons */
}

/* Ordered service cards on mobile instead of wide table */
.pm-svc-grid { display: grid; gap: .6rem; }
@media (min-width: 768px) { .pm-svc-grid { grid-template-columns: repeat(2, 1fr); } }
.pm-svc-card {
    background: #fff; border: 1px solid #e9ecef; border-radius: 0.65rem;
    padding: .7rem .8rem; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.pm-svc-card .svc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.pm-svc-card .svc-title { font-weight: 700; font-size: .92rem; color: #212529; }
.pm-svc-card .svc-cat { font-size: .72rem; color: #6c757d; }
.pm-svc-card .svc-meta { font-size: .82rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .4rem; }
.pm-svc-card .svc-meta span b { color: #495057; }
.pm-svc-card .svc-price { font-weight: 700; color: #0d6efd; }

/* Timeline list */
.pm-timeline { list-style: none; margin: 0; padding: 0; }
.pm-timeline li { position: relative; padding-left: 1.4rem; padding-bottom: .75rem; border-left: 2px solid #e9ecef; margin-left: .4rem; }
.pm-timeline li::before {
    content: ""; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #0d6efd;
}
.pm-timeline li .tl-title { font-weight: 600; font-size: .86rem; }
.pm-timeline li .tl-meta { font-size: .72rem; color: #6c757d; }
.pm-timeline li .tl-desc { font-size: .8rem; color: #495057; }

/* Progress bars */
.pm-progress-sm { height: 6px; }

/* Navbar should not break: keep global app-navbar intact */
/* Login landing / system selector */
.module-home { min-height: 100vh; background: #f4f7fb; }
.module-choice { border: 1px solid #dfe7f1; transition: transform .18s ease, box-shadow .18s ease; }
.module-choice:hover { transform: translateY(-4px); box-shadow: 0 1rem 2.2rem rgba(13,43,72,.14) !important; }
.module-choice-icon { font-size: 3.2rem; }

/* ============================================================
   Modern Project Management theme
   Scoped to the project module so Accounting remains unchanged.
   ============================================================ */
.module-project {
    --pm-primary: #2563eb;
    --pm-primary-dark: #1d4ed8;
    --pm-primary-soft: #eff6ff;
    --pm-ink: #0f172a;
    --pm-muted: #64748b;
    --pm-line: #e2e8f0;
    --pm-surface: #ffffff;
    --pm-surface-soft: #f8fafc;
    --pm-radius: 1rem;
    --pm-shadow: 0 10px 30px rgba(15, 23, 42, .055);
    background:
        radial-gradient(circle at 100% 0, rgba(37, 99, 235, .06), transparent 28rem),
        #f5f7fb;
    color: var(--pm-ink);
}

.module-project .app-navbar {
    background: linear-gradient(100deg, #0b2540 0%, #102f50 55%, #123a60 100%);
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 28px rgba(2, 12, 27, .16);
}
.module-project .app-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 750;
    letter-spacing: -.02em;
}
.module-project .app-navbar .navbar-brand i { color: #7dd3fc; }
.module-project .app-navbar .nav-link {
    display: flex;
    align-items: center;
    gap: .38rem;
    padding: .55rem .68rem;
    margin: 0 .06rem;
    color: #cbd5e1;
    border-radius: .65rem;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.module-project .app-navbar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateY(-1px);
}
.module-project .app-navbar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.module-project .app-container { padding-top: 1.35rem !important; }
.module-project .app-container > .d-flex:first-child,
.module-project .app-container > .mb-3:first-child {
    padding: .15rem 0;
}
.module-project h4,
.module-project h5 { color: var(--pm-ink); letter-spacing: -.025em; }
.module-project h4 { font-weight: 750; }

.module-project .card {
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: var(--pm-radius);
    background: rgba(255,255,255,.98);
    box-shadow: var(--pm-shadow);
    overflow: hidden;
}
.module-project .card-header {
    min-height: 3.15rem;
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--pm-line);
    background: linear-gradient(180deg, #fff, #fbfdff) !important;
    color: var(--pm-ink);
}
.module-project .card-header strong { font-weight: 700; }
.module-project .card-body { padding: 1rem; }
.module-project .card-body.p-0 { overflow-x: auto; }

.module-project .kpi-card {
    position: relative;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
    overflow: hidden;
}
.module-project .kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #2563eb, #38bdf8);
}
.module-project .kpi-card .card-body { padding: 1.05rem 1.05rem 1rem 1.2rem; }
.module-project .kpi-label,
.module-project .pm-detail-label,
.module-project .pm-header-stat .phs-label {
    color: var(--pm-muted);
    font-weight: 650;
    letter-spacing: .055em;
}
.module-project .kpi-value { margin-top: .25rem; font-size: 1.35rem; letter-spacing: -.025em; }

.module-project .table { --bs-table-bg: transparent; color: #243247; }
.module-project .table > :not(caption) > * > * {
    padding: .78rem .85rem;
    border-bottom-color: var(--pm-line);
    vertical-align: middle;
}
.module-project .table thead th,
.module-project .pm-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .055em;
    white-space: nowrap;
}
.module-project .table-hover > tbody > tr { transition: background .15s ease, box-shadow .15s ease; }
.module-project .table-hover > tbody > tr:hover { --bs-table-hover-bg: #f3f7ff; }
.module-project .table-responsive { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

.module-project .btn {
    border-radius: .65rem;
    font-weight: 600;
    box-shadow: none;
}
.module-project .btn-primary {
    background: linear-gradient(135deg, var(--pm-primary), var(--pm-primary-dark));
    border-color: var(--pm-primary-dark);
    box-shadow: 0 5px 14px rgba(37, 99, 235, .18);
}
.module-project .btn-primary:hover { filter: brightness(.96); transform: translateY(-1px); }
.module-project .btn-outline-primary { color: var(--pm-primary-dark); border-color: #93b4f8; }
.module-project .btn-outline-primary:hover { background: var(--pm-primary); border-color: var(--pm-primary); }
.module-project .btn-link { text-decoration: none; font-weight: 650; }

.module-project .form-control,
.module-project .form-select,
.module-project .input-group-text {
    min-height: 2.55rem;
    border-color: #d9e2ee;
    border-radius: .65rem;
    background-color: #fff;
}
.module-project .input-group > .input-group-text { border-radius: .65rem 0 0 .65rem; background: #f8fafc; }
.module-project .input-group > .form-control { border-radius: 0 .65rem .65rem 0; }
.module-project .form-control:focus,
.module-project .form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .11);
}
.module-project .form-label { margin-bottom: .38rem; color: #334155; font-size: .84rem; font-weight: 650; }
.module-project .modal-content {
    border: 0;
    border-radius: 1.1rem;
    box-shadow: 0 28px 70px rgba(15, 23, 42, .23);
    overflow: hidden;
}
.module-project .modal-header,
.module-project .modal-footer { border-color: var(--pm-line); padding: 1rem 1.15rem; }
.module-project .modal-body { padding: 1.15rem; }

.module-project .badge {
    border-radius: 999px;
    padding: .38em .68em;
    font-weight: 650;
}
.module-project .alert { border: 0; border-radius: .85rem; box-shadow: 0 4px 14px rgba(15,23,42,.05); }

.module-project #settingsTabs {
    gap: .2rem;
    padding-bottom: 1px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.module-project #settingsTabs .nav-link {
    color: #52647b;
    font-weight: 650;
    border-radius: .7rem .7rem 0 0;
}
.module-project #settingsTabs .nav-link:hover { color: var(--pm-primary-dark); background: #f8fafc; }
.module-project #settingsTabs .nav-link.active { color: var(--pm-primary-dark); background: #fff; }

.module-project .pm-header-stat {
    min-height: 4.65rem;
    justify-content: center;
    padding: .78rem .9rem;
    border: 1px solid var(--pm-line);
    border-radius: .9rem;
    box-shadow: 0 7px 20px rgba(15,23,42,.045);
    transition: transform .18s ease, box-shadow .18s ease;
}
.module-project .pm-header-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.075); }
.module-project .pm-header-stat .phs-value { margin-top: .2rem; font-size: 1rem; color: var(--pm-ink); }
.module-project .progress { overflow: hidden; border-radius: 999px; background: #e8eef7; }
.module-project .progress-bar { background: linear-gradient(90deg, #2563eb, #38bdf8); }

.module-project .pm-workspace { gap: 1.25rem; }
.module-project .pm-sidenav {
    flex-basis: 238px;
    max-width: 238px;
    top: 82px;
    padding: .45rem;
    border: 1px solid var(--pm-line);
    border-radius: 1rem;
    box-shadow: var(--pm-shadow);
}
.module-project .pm-sidenav .pm-section-link {
    margin: .08rem 0;
    padding: .68rem .72rem;
    border: 0;
    border-radius: .68rem;
    color: #475569;
}
.module-project .pm-sidenav .pm-section-link:hover { background: #f1f5f9; color: var(--pm-primary-dark); }
.module-project .pm-sidenav .pm-section-link.active {
    border: 0;
    color: var(--pm-primary-dark);
    background: linear-gradient(135deg, #eff6ff, #e8f1ff);
    box-shadow: inset 0 0 0 1px #dbeafe;
}
.module-project .pm-svc-card { border-color: var(--pm-line); border-radius: .9rem; box-shadow: 0 7px 20px rgba(15,23,42,.045); }
.module-project .pm-dual-primary { display: block; font-weight: 750; line-height: 1.15; white-space: nowrap; }
.module-project .pm-dual-converted { display: block; margin-top: .22rem; color: #64748b; font-size: .72em; font-weight: 650; line-height: 1.15; white-space: nowrap; }
.module-project .pm-dual-rate { color: #94a3b8; font-weight: 550; }

@media (min-width: 1400px) {
    .module-project .app-container,
    .module-project .app-navbar > .container-fluid {
        padding-left: 2.25rem !important;
        padding-right: 2.25rem !important;
    }
}

@media (max-width: 991.98px) {
    .module-project .app-navbar .navbar-collapse {
        margin-top: .75rem;
        padding: .7rem;
        border-radius: .9rem;
        background: rgba(4, 20, 36, .45);
        border: 1px solid rgba(255,255,255,.08);
    }
    .module-project .app-navbar .nav-link { margin: .1rem 0; padding: .68rem .75rem; }
    .module-project .pm-workspace { gap: .85rem; }
    .module-project .pm-sidenav {
        max-width: 100%;
        padding: .45rem;
        border-radius: .85rem;
        box-shadow: 0 6px 18px rgba(15,23,42,.05);
    }
    .module-project .pm-sidenav .pm-section-link.active { border: 0; }
}

@media (max-width: 767.98px) {
    .module-project .app-container { padding-top: .9rem !important; }
    .module-project .app-container > .d-flex:first-child {
        align-items: flex-start !important;
        gap: .65rem;
    }
    .module-project .app-container > .d-flex:first-child h4 { font-size: 1.25rem; }
    .module-project .app-container > .d-flex:first-child > .btn,
    .module-project .app-container > .d-flex:first-child > .btn-group { flex: 0 0 auto; }
    .module-project .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
    .module-project .kpi-card .card-body { padding: .85rem .85rem .8rem 1rem; }
    .module-project .kpi-value { font-size: 1.08rem; }
    .module-project .card-header { min-height: 2.85rem; padding: .7rem .8rem; }
    .module-project .card-body { padding: .85rem; }
    .module-project .table-responsive,
    .module-project .card-body.p-0 { -webkit-overflow-scrolling: touch; }
    .module-project .table-responsive > .pm-table,
    .module-project .card-body.p-0 > .table { min-width: 720px; }
    .module-project .pm-pane .table-responsive > .pm-table { min-width: 0; }
    .module-project .modal-dialog { margin: .65rem; }
    .module-project .modal-body .row > [class*="col-6"],
    .module-project .modal-body .row > [class*="col-8"],
    .module-project .modal-body .row > [class*="col-4"] { min-width: 0; }
}

@media (max-width: 575.98px) {
    .module-project .app-container { padding-left: .65rem !important; padding-right: .65rem !important; }
    .module-project .navbar-brand { font-size: 1rem; }
    .module-project h4 { font-size: 1.2rem; }
    .module-project .btn { white-space: nowrap; }
    .module-project .app-container .btn-group { flex-wrap: wrap; gap: .35rem; }
    .module-project .app-container .btn-group > .btn { border-radius: .6rem !important; }
    .module-project .app-container > .mb-3:first-child .text-muted.small {
        display: flex;
        flex-wrap: wrap;
        gap: .2rem .35rem;
        line-height: 1.55;
    }
    .module-project form.row.g-2 > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
    .module-project form.row.g-2 .btn { width: 100%; }
    .module-project .pm-header-stat { min-height: 4.25rem; padding: .65rem .7rem; }
    .module-project .pm-header-stat .phs-value { font-size: .9rem; }
    .module-project .pm-pane table.pm-table tr {
        background: #fff;
        border-color: var(--pm-line);
        border-radius: .8rem;
        box-shadow: 0 5px 16px rgba(15,23,42,.045);
    }
}

@media print {
    .module-project .no-print,
    .module-project .app-navbar,
    .module-project .pm-mobile-nav { display: none !important; }
    .module-project { background: #fff !important; }
    .module-project .app-container { max-width: none !important; padding: 0 !important; }
    .module-project .card { box-shadow: none !important; break-inside: avoid; }
    .module-project .table-responsive { overflow: visible !important; }
    .module-project table { width: 100% !important; font-size: 9pt; }
}
/* Complete project report */
.pm-project-report { border: 1px solid #dbe3ee; }
.report-company-header { border-bottom: 2px solid #12395d; padding-bottom: 12px; margin-bottom: 14px; }
.report-company-header h2 { margin: 0; color: #12395d; font-weight: 800; }
.report-title { font-size: 1.05rem; font-weight: 700; }
.report-project-heading { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; margin-bottom: 12px; }
.report-info-table th { width: 14%; background: #f4f7fb; color: #425466; }
.report-summary-box { height: 100%; border: 1px solid #dbe3ee; border-radius: 10px; padding: 9px; background: #f8fafc; }
.report-summary-box small { display: block; text-transform: uppercase; color: #64748b; font-weight: 700; font-size: .67rem; }
.report-summary-box strong { display: block; margin-top: 3px; }
.report-section { margin-top: 18px; }
.report-section > h6 { border-bottom: 1px solid #cbd5e1; padding-bottom: 6px; color: #12395d; font-weight: 800; }
.report-section .table { font-size: .8rem; }
.report-log { border-bottom: 1px dashed #dbe3ee; padding: 5px 0; font-size: .8rem; }
.report-footer { text-align: center; color: #64748b; border-top: 1px solid #dbe3ee; margin-top: 20px; padding-top: 8px; font-size: .75rem; }

@media print {
    @page { size: A4 landscape; margin: 9mm; }
    body { background: #fff !important; }
    body:has(#projectPrintableReport) * { visibility: hidden !important; }
    body:has(#projectPrintableReport) #projectPrintableReport,
    body:has(#projectPrintableReport) #projectPrintableReport * { visibility: visible !important; }
    #projectPrintableReport {
        position: absolute !important; left: 0 !important; top: 0 !important;
        width: 100% !important; border: 0 !important; box-shadow: none !important;
    }
    #projectPrintableReport .card-body { padding: 0 !important; }
    #projectPrintableReport .table-responsive { overflow: visible !important; }
    #projectPrintableReport table { width: 100% !important; }
    #projectPrintableReport tr, #projectPrintableReport .report-summary-box { break-inside: avoid; page-break-inside: avoid; }
    #projectPrintableReport .report-section { break-inside: auto; }
    #projectPrintableReport .pm-dual-primary, #projectPrintableReport .pm-dual-converted { color: #111 !important; }
    .no-print { display: none !important; }
}
