{"id":180,"date":"2026-09-02T12:27:03","date_gmt":"2026-09-02T12:27:03","guid":{"rendered":"https:\/\/balicompliancecentre.com\/?page_id=180"},"modified":"2026-09-02T12:28:27","modified_gmt":"2026-09-02T12:28:27","slug":"bcc-audit","status":"publish","type":"page","link":"https:\/\/balicompliancecentre.com\/?page_id=180","title":{"rendered":"BCC Audit"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"180\" class=\"elementor elementor-180\">\n\t\t\t\t<div class=\"elementor-element elementor-element-022ba69 e-flex e-con-boxed e-con e-parent\" data-id=\"022ba69\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4e65666 elementor-widget elementor-widget-html\" data-id=\"4e65666\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Bali Compliance Centre (BCC) - Master Compliance Auditor - Secure 45-Point Audit v1.0<\/title>\n    <style>\n        :root {\n            --primary: #1A365D;       \/* Authority Midnight Blue *\/\n            --eco: #2E7D32;           \/* Sustainability Forest Green *\/\n            --culture: #D84315;       \/* Customary Custom Sunset Orange *\/\n            --primary-light: #EBF8FF;\n            --bg: #F8F9FA;\n            --border: #E2E8F0;\n            --text: #2D3748;\n            --danger: #D9534F;\n            --warning: #F0AD4E;\n            --success: #5CB85C;\n        }\n\n        .bcc-wrapper {\n            font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n            background-color: var(--bg);\n            color: var(--text);\n            padding: 20px;\n            line-height: 1.6;\n            padding-bottom: 120px;\n        }\n\n        .container { max-width: 1200px; margin: 0 auto; }\n\n        header {\n            background-color: var(--primary); color: white;\n            padding: 24px; border-radius: 12px;\n            box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 24px;\n            border-left: 6px solid var(--eco);\n            display: flex; justify-content: space-between; align-items: center;\n        }\n\n        header h1 { margin: 0 0 8px 0; font-size: 26px; }\n        header p { margin: 0; color: #A0AEC0; font-style: italic; }\n\n        .meta-form {\n            background: white; padding: 25px; border-radius: 8px;\n            box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 30px;\n            display: grid; grid-template-columns: 1fr 1fr; gap: 20px;\n        }\n\n        .form-section-title { grid-column: span 2; margin: 10px 0 0 0; color: var(--primary); font-size: 16px; border-bottom: 1px dashed var(--border); padding-bottom: 4px; font-weight: bold; }\n        .form-group { display: flex; flex-direction: column; }\n        .form-group.full-width { grid-column: span 2; }\n        label { font-weight: bold; margin-bottom: 8px; color: var(--text); font-size: 14px; }\n        input[type=\"text\"], input[type=\"email\"], input[type=\"tel\"] { padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 15px; background: white; outline: none; color: var(--text); }\n        input:focus { border-color: var(--primary); }\n\n        .category-block { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 25px; }\n        .legal-block { border-left: 6px solid var(--danger); }\n        .eco-block { border-left: 6px solid var(--eco); }\n        .cultural-block { border-left: 6px solid var(--culture); }\n\n        h3 { margin-top: 0; color: var(--primary); border-bottom: 2px solid var(--border); padding-bottom: 8px; margin-bottom: 15px; }\n        .checkbox-grid { display: flex; flex-direction: column; gap: 15px; }\n        .checkbox-item { display: flex; flex-direction: column; gap: 8px; padding: 15px; border-radius: 6px; background-color: #fafafa; border: 1px solid var(--border); }\n        .checkbox-row { display: flex; align-items: flex-start; gap: 12px; }\n        .checkbox-row input { margin-top: 4px; transform: scale(1.3); cursor: pointer; }\n        \n        .evidence-input { margin-left: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }\n        .evidence-input input { padding: 6px 10px; font-size: 13px; border: 1px solid #ddd; border-radius: 4px; outline: none; }\n\n        .btn-container { margin: 30px 0; }\n        .btn { background-color: var(--primary); color: white; border: none; padding: 12px 28px; font-size: 16px; font-weight: bold; border-radius: 6px; cursor: pointer; transition: background 0.2s; }\n        .btn:hover { background-color: #12264a; }\n\n        .alert-success { background-color: #C6F6D5; color: #22543D; padding: 14px; border-radius: 6px; margin-bottom: 25px; border-left: 4px solid #38A169; font-weight: 500; display: none; }\n\n        .sticky-counter {\n            position: fixed; bottom: 0; left: 0; right: 0; background: white; padding: 20px 40px; box-shadow: 0 -4px 10px rgba(0,0,0,0.1);\n            display: flex; justify-content: space-between; align-items: center; z-index: 1000; border-top: 3px solid var(--eco);\n        }\n\n        .score-display { font-size: 18px; font-weight: bold; }\n        .badge-status { padding: 8px 20px; border-radius: 20px; color: white; font-weight: bold; font-size: 15px; }\n\n        .table-container { background: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); overflow-x: auto; margin-top: 20px; margin-bottom: 40px; }\n        table { width: 100%; border-collapse: collapse; text-align: left; }\n        th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; }\n        th { background: #EDF2F7; font-weight: 600; color: var(--primary); }\n\n\n        .audit-summary {\n            display: grid;\n            grid-template-columns: 1fr 1fr 2fr;\n            gap: 15px;\n            background: white;\n            padding: 18px 22px;\n            border-radius: 8px;\n            box-shadow: 0 4px 6px rgba(0,0,0,0.05);\n            margin-bottom: 25px;\n            border-left: 6px solid var(--primary);\n        }\n        .item-number { min-width: 28px; font-weight: bold; color: var(--primary); }\n        .item-main { flex: 1; }\n        .item-meta { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; font-size:12px; color:#718096; }\n        .item-meta span { background:#EDF2F7; padding:3px 7px; border-radius:4px; }\n        .answer-row { display:flex; flex-wrap:wrap; gap:16px; margin-left:40px; }\n        .answer-row label { font-weight:600; font-size:13px; }\n        .answer-row input { transform:none; margin-right:5px; }\n        .item-source { margin:10px 0 0 40px; padding:9px 11px; background:#F7FAFC; border-left:3px solid var(--border); font-size:12px; }\n        .result-label { font-weight: 800; }\n        .result-label.success { color: var(--success); }\n        .result-label.warning { color: var(--warning); }\n        .result-label.danger { color: var(--danger); }\n        .badge-status.success { background-color: var(--success) !important; }\n        .badge-status.warning { background-color: var(--warning) !important; }\n        .badge-status.danger { background-color: var(--danger) !important; }\n        @media (max-width: 992px) {\n            .audit-summary { grid-template-columns: 1fr; }\n            .answer-row, .item-source { margin-left: 0; }\n        }\n\n        @media (max-width: 992px) {\n            .meta-form { grid-template-columns: 1fr; }\n            .form-section-title, .form-group.full-width { grid-column: span 1; }\n            .evidence-input { grid-template-columns: 1fr; }\n            .sticky-counter { flex-direction: column; gap: 12px; text-align: center; padding: 15px; }\n        }\n    \n        .explanation-wrap{margin:10px 0 0 40px}\n        .explanation-btn{background:#EDF2F7;color:var(--primary);border:1px solid var(--border);border-radius:5px;padding:7px 10px;font-size:12px;font-weight:700;cursor:pointer}\n        .explanation-panel{display:none;margin-top:8px;padding:12px 14px;background:#F7FAFC;border-left:3px solid var(--primary);border-radius:4px;font-size:13px;line-height:1.55}\n        .explanation-panel.open{display:block}\n        .explanation-title{font-weight:800;color:var(--primary);margin-bottom:4px}\n        @media(max-width:992px){.explanation-wrap{margin-left:0}}\n\n\n        header h1,\n        header h1:link,\n        header h1:visited,\n        header h1:hover,\n        header h1:active {\n            color: #FFFFFF !important;\n            opacity: 1 !important;\n            text-shadow: none !important;\n        }\n        header p {\n            color: #FFFFFF !important;\n            opacity: 1 !important;\n        }\n\n<\/style>\n\n<style id=\"bccReportPrintCSS\">\n@media print {\n    body * { visibility: hidden !important; }\n    #bccReportOverlay, #bccReportOverlay * { visibility: visible !important; }\n    #bccReportOverlay {\n        position: absolute !important;\n        inset: 0 !important;\n        overflow: visible !important;\n        padding: 0 !important;\n        background: white !important;\n    }\n    #bccReportOverlay .no-print { display: none !important; }\n    #bccPrintableReport { width: 100% !important; }\n}\n<\/style>\n\n\n<style id=\"bcc-final-header-white\">\n\/* BCC FINAL HEADER WHITE OVERRIDE *\/\nheader h1, header h2, header p,\nheader .title, header .subtitle {\n  color: #FFFFFF !important;\n  opacity: 1 !important;\n}\n<\/style>\n\n<\/head>\n<body>\n<div class=\"bcc-wrapper\">\n<div class=\"container\">\n    <header>\n        <div>\n            <h1>\ud83c\udf3f Bali Compliance Centre (BCC)<\/h1>\n            <p>Master Compliance Audit Portal & History Registry Database<\/p>\n        <\/div>\n        <div>\n            <button type=\"button\" class=\"btn\" style=\"background-color: var(--eco);\" onclick=\"window.print()\">\ud83d\udda8\ufe0f Print PDF Inspection Report<\/button>\n        <\/div>\n    <\/header>\n\n    <!-- Meta Stakeholder Form Block -->\n    <div class=\"meta-form\">\n        <div class=\"form-section-title\">\ud83c\udfe1 PROPERTY CORE INFORMATION<\/div>\n        <div class=\"form-group\">\n            <label>Villa \/ Property Name:<\/label>\n            <input type=\"text\" id=\"vName\" placeholder=\"e.g. Mandala Uluwatu\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label>Plot \/ Regional Zone:<\/label>\n            <input type=\"text\" id=\"vZone\" placeholder=\"e.g. Uluwatu, Canggu, Pererenan\">\n        <\/div>\n        <div class=\"form-group\">\n            <label>Villa Phone Number:<\/label>\n            <input type=\"tel\" id=\"vPhone\" placeholder=\"e.g. +62 812-3456-7890\">\n        <\/div>\n        <div class=\"form-group\">\n            <label>Villa Email Address:<\/label>\n            <input type=\"email\" id=\"vEmail\" placeholder=\"e.g. frontdesk@luxurybalivilla.com\">\n        <\/div>\n        <div class=\"form-group full-width\">\n            <label>Complete Property Address Details:<\/label>\n            <input type=\"text\" id=\"vAddress\" placeholder=\"e.g. Jalan Bingin Beach No. 8, Pecatu, Kuta Selatan, Badung, Bali 80361\">\n        <\/div>\n\n        <div class=\"form-section-title\">\ud83d\udc64 BENEFICIAL OWNER (UBO) DETAILS<\/div>\n        <div class=\"form-group\">\n            <label>Owner \/ Shareholder Full Name:<\/label>\n            <input type=\"text\" id=\"vOwnerName\" placeholder=\"e.g. Thomas Van Der Berg\">\n        <\/div>\n        <div class=\"form-group\">\n            <label>Owner Contact Email \/ Phone:<\/label>\n            <input type=\"text\" id=\"vOwnerContact\" placeholder=\"e.g. thomas@holdingcompany.com\">\n        <\/div>\n\n        <div class=\"form-section-title\">\ud83e\udd1d OPERATIONAL MANAGEMENT DETAILS<\/div>\n        <div class=\"form-group\">\n            <label>Management Company \/ Agency Name:<\/label>\n            <input type=\"text\" id=\"vMgmtName\" placeholder=\"e.g. Elite Havens \/ Independent Management\">\n        <\/div>\n        <div class=\"form-group\">\n            <label>Management Lead \/ Representative Contact:<\/label>\n            <input type=\"text\" id=\"vMgmtContact\" placeholder=\"e.g. Made Wijaya (+62 813-...)\">\n        <\/div>\n\n        <div class=\"form-section-title\">\ud83d\udccb AUDIT METRICS<\/div>\n        <div class=\"form-group full-width\">\n            <label>Lead Auditor Name:<\/label>\n            <input type=\"text\" id=\"aName\" placeholder=\"e.g. Sarah Mitchell \/ Ketut\">\n        <\/div>\n    <\/div>\n\n    <div style=\"background:#FFF8E1;border-left:4px solid #F0AD4E;padding:10px 14px;margin-bottom:20px;border-radius:5px;font-size:13px;\">\n        <strong>Storage notice:<\/strong> Audit history is stored locally in this browser using LocalStorage. It is not a central server backup.\n    <\/div>\n    <div id=\"successAlert\" class=\"alert-success\"><\/div>\n\n    <form id=\"auditForm\" onsubmit=\"event.preventDefault(); processAudit();\">\n        <div class=\"audit-summary\">\n            <div><strong>Total points:<\/strong> <span id=\"totalPoints\">0 \/ 0<\/span><\/div>\n            <div><strong>Regulatory score:<\/strong> <span id=\"legalScore\">0%<\/span><\/div>\n            <div><strong>Sustainability score:<\/strong> <span id=\"sustainabilityScore\">0%<\/span><\/div>\n            <div><strong>Final result:<\/strong> <span id=\"complianceResult\">NOT COMPLIANT<\/span><\/div>\n            <div><strong>Important:<\/strong> BCC best-practice points do not override regulatory failures.<\/div>\n        <\/div>\n\n        <div class=\"category-block legal-block\">\n            <h3>\u2696\ufe0f A. Corporate & Licensing<\/h3>\n            <div class=\"checkbox-grid\" id=\"legalGrid\"><\/div>\n        <\/div>\n\n        <div class=\"category-block legal-block\">\n            <h3>\ud83d\udcd0 B. Zoning & Building<\/h3>\n            <div class=\"checkbox-grid\" id=\"zoningGrid\"><\/div>\n        <\/div>\n\n        <div class=\"category-block legal-block\">\n            <h3>\ud83c\udf0a C. Environmental Legal Compliance<\/h3>\n            <div class=\"checkbox-grid\" id=\"environmentGrid\"><\/div>\n        <\/div>\n\n        <div class=\"category-block legal-block\">\n            <h3>\ud83d\udc77 D. Employment & Social Compliance<\/h3>\n            <div class=\"checkbox-grid\" id=\"employmentGrid\"><\/div>\n        <\/div>\n\n        <div class=\"category-block cultural-block\">\n            <h3>\ud83c\udf38 E. Cultural & Community<\/h3>\n            <div class=\"checkbox-grid\" id=\"culturalGrid\"><\/div>\n        <\/div>\n\n        <div class=\"category-block eco-block\">\n            <h3>\ud83c\udf3f F. BCC Sustainability & Operational Best Practice<\/h3>\n            <p style=\"color: var(--eco); font-weight: bold; margin-top: -10px;\">\n                These items are BCC sustainability standards and should not be represented as statutory requirements unless a separate legal reference is attached.\n            <\/p>\n            <div class=\"checkbox-grid\" id=\"ecoGrid\"><\/div>\n        <\/div>\n\n        <div class=\"btn-container\">\n            <button type=\"submit\" class=\"btn\">Calculate Compliance Result & Save Audit Log<\/button>\n<button type=\"button\" class=\"btn\" style=\"margin-left:10px;background-color:var(--eco);\" onclick=\"printCurrentReport()\">\ud83d\udda8\ufe0f Generate Current Report<\/button>\n        <\/div>\n    <\/form>\n    <h2>\ud83d\udcca Database: Executed Master Scans<\/h2>\n    <button type=\"button\" class=\"btn\" style=\"background-color: var(--danger); padding: 6px 14px; font-size: 12px; margin-bottom: 10px;\" onclick=\"clearDatabase()\">\ud83d\uddd1\ufe0f Clear Database History<\/button>\n    <div class=\"table-container\">\n        <table id=\"historyTable\">\n            <thead>\n                <tr>\n                    <th>Property Dossier & Address<\/th>\n                    <th>Stakeholders (Owner\/Mgmt)<\/th>\n                    <th>Contact Details<\/th>\n                    <th>Auditor \/ Zone<\/th>\n                    <th>Scores<\/th>\n                    <th>Critical<\/th>\n                    <th>Status<\/th>\n                <\/tr>\n            <\/thead>\n            <tbody>\n                <!-- Populates automatically from LocalStorage -->\n            <\/tbody>\n        <\/table>\n    <\/div>\n<\/div> <!-- Sluiting van .container -->\n\n<div class=\"sticky-counter\">\n    <div class=\"score-display\">Answered Items: <span id=\"checkedCount\">0<\/span> \/ 45<\/div>\n    <div id=\"badgeStatus\" class=\"badge-status\" style=\"background-color: var(--danger);\">HIGH RISK (Legal Incomplete)<\/div>\n<\/div>\n<\/div> <!-- Sluiting van .bcc-wrapper -->\n<script>\n    \/*\n     * BCC MASTER COMPLIANCE MATRIX\n     * Rewritten so that:\n     * - Legal\/regulatory requirements are separated from BCC best-practice checks.\n     * - \"Not Applicable\" is available and does not automatically create a failure.\n     * - Critical legal failures cannot be hidden by a high sustainability score.\n     * - Each item has a category, weight and risk level.\n     * - KBLI is verified against the actual activity rather than a fixed list.\n     *\/\n\n    const auditItems = [\n        \/\/ A. CORPORATE & LICENSING\n        {id:1, category:\"Corporate & Licensing\", type:\"legal\", risk:\"critical\", weight:5,\n         text:\"Corporate \/ ownership structure is appropriate for the actual property ownership and business activity.\",\n         evidence:\"Company deed \/ ownership documents \/ applicable structure\", source:\"Applicable corporate and ownership requirements\"},\n        {id:2, category:\"Corporate & Licensing\", type:\"legal\", risk:\"critical\", weight:5,\n         text:\"Registered KBLI code(s) correspond to the actual activities carried out at the property.\",\n         evidence:\"NIB + OSS KBLI record + actual activity review\", source:\"Current OSS \/ applicable KBLI classification\"},\n        {id:3, category:\"Corporate & Licensing\", type:\"legal\", risk:\"critical\", weight:5,\n         text:\"NIB is active and the registered business activities correspond to the actual operation.\",\n         evidence:\"NIB \/ OSS status\", source:\"OSS\"},\n        {id:4, category:\"Corporate & Licensing\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Applicable tax registrations and obligations are properly maintained.\",\n         evidence:\"NPWP \/ tax registration \/ relevant filings\", source:\"Applicable tax regulations\"},\n        {id:5, category:\"Corporate & Licensing\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Required business-sector permits and registrations applicable to the operation are present and current.\",\n         evidence:\"Permit register\", source:\"Applicable sector regulations\"},\n\n        \/\/ B. ZONING & BUILDING\n        {id:6, category:\"Zoning & Building\", type:\"legal\", risk:\"critical\", weight:6,\n         text:\"The property's official spatial-planning \/ RDTR zoning permits the actual use of the property.\",\n         evidence:\"Official RDTR zoning code, map and permitted-use record\", source:\"Applicable RDTR \/ spatial plan\"},\n        {id:7, category:\"Zoning & Building\", type:\"legal\", risk:\"critical\", weight:6,\n         text:\"KKPR \/ applicable spatial-utilisation approval has been verified where required.\",\n         evidence:\"KKPR \/ applicable spatial approval\", source:\"Applicable spatial-planning requirements\"},\n        {id:8, category:\"Zoning & Building\", type:\"legal\", risk:\"critical\", weight:6,\n         text:\"PBG is present and the approved building function is consistent with the actual use.\",\n         evidence:\"PBG and approved building function\", source:\"Applicable building regulations\"},\n        {id:9, category:\"Zoning & Building\", type:\"legal\", risk:\"critical\", weight:5,\n         text:\"SLF is present and valid where required for the building.\",\n         evidence:\"SLF\", source:\"Applicable building regulations\"},\n        {id:10, category:\"Zoning & Building\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Building alterations, extensions and changes of use are reflected in the applicable approvals.\",\n         evidence:\"Approved drawings \/ PBG amendments \/ SLF records\", source:\"Applicable building regulations\"},\n        {id:11, category:\"Zoning & Building\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Applicable local architectural, height, setback and site-development requirements have been verified.\",\n         evidence:\"RDTR \/ RTBL \/ local planning documents\", source:\"Applicable local planning requirements\"},\n\n        \/\/ C. ENVIRONMENTAL & WATER\n        {id:12, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"critical\", weight:5,\n         text:\"The environmental approval \/ environmental management instrument applicable to the activity is identified and valid.\",\n         evidence:\"Environmental approval \/ UKL-UPL \/ SPPL or other applicable instrument\", source:\"Applicable environmental regulations\"},\n        {id:13, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Wastewater \/ sewage management complies with applicable requirements.\",\n         evidence:\"Septic \/ wastewater system records, inspection or maintenance documents\", source:\"Applicable environmental and wastewater requirements\"},\n        {id:14, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Waste storage, separation, collection and disposal arrangements comply with applicable requirements.\",\n         evidence:\"Waste-management procedure \/ collection records\", source:\"Applicable waste-management requirements\"},\n        {id:15, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Applicable water-abstraction approvals are present where groundwater or surface-water extraction requires them.\",\n         evidence:\"Water permit \/ approval or documented applicability assessment\", source:\"Applicable water-resource requirements\"},\n        {id:16, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"high\", weight:3,\n         text:\"Hazardous or special waste, where generated, is handled through the applicable compliant process.\",\n         evidence:\"Waste records \/ vendor documentation\", source:\"Applicable environmental requirements\"},\n        {id:17, category:\"Environmental Legal Compliance\", type:\"legal\", risk:\"medium\", weight:3,\n         text:\"Environmental monitoring and documentation required for the operation are maintained.\",\n         evidence:\"Monitoring logs \/ reports\", source:\"Applicable environmental instrument\"},\n\n        \/\/ D. EMPLOYMENT & SOCIAL COMPLIANCE\n        {id:18, category:\"Employment & Social Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Employees are properly registered and employment documentation is maintained.\",\n         evidence:\"Employment records \/ contracts\", source:\"Applicable employment requirements\"},\n        {id:19, category:\"Employment & Social Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Applicable BPJS Kesehatan and BPJS Ketenagakerjaan obligations are fulfilled.\",\n         evidence:\"BPJS registration \/ payment records\", source:\"Applicable social-security requirements\"},\n        {id:20, category:\"Employment & Social Compliance\", type:\"legal\", risk:\"high\", weight:4,\n         text:\"Applicable wage and employment requirements are met.\",\n         evidence:\"Payroll \/ wage records \/ employment policies\", source:\"Applicable employment regulations\"},\n        {id:21, category:\"Employment & Social Compliance\", type:\"legal\", risk:\"medium\", weight:3,\n         text:\"Occupational health, safety and required workplace procedures are implemented.\",\n         evidence:\"SOPs \/ training \/ inspection records\", source:\"Applicable occupational requirements\"},\n\n        \/\/ E. CULTURAL & COMMUNITY\n        {id:22, category:\"Cultural & Community\", type:\"legal\", risk:\"medium\", weight:3,\n         text:\"Applicable Desa Adat \/ Awig-Awig requirements affecting the property have been identified and documented.\",\n         evidence:\"Applicable local customary rules \/ correspondence\", source:\"Applicable Desa Adat \/ local requirements\"},\n        {id:23, category:\"Cultural & Community\", type:\"legal\", risk:\"medium\", weight:3,\n         text:\"Required local-community or customary notifications\/permissions have been completed where applicable.\",\n         evidence:\"Notification \/ correspondence \/ approval\", source:\"Applicable local requirements\"},\n        {id:24, category:\"Cultural & Community\", type:\"legal\", risk:\"medium\", weight:2,\n         text:\"Applicable cultural, ceremonial-access and site-specific local requirements have been reviewed.\",\n         evidence:\"Site review \/ local documentation\", source:\"Applicable local planning\/customary requirements\"},\n        {id:25, category:\"Cultural & Community\", type:\"legal\", risk:\"medium\", weight:2,\n         text:\"Local architectural requirements applicable to the property have been assessed and documented.\",\n         evidence:\"Design review \/ local planning documentation\", source:\"Applicable local planning requirements\"},\n\n        \/\/ F. BCC SUSTAINABILITY & OPERATIONS \u2014 BEST PRACTICE\n        {id:26, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Water-efficient showerheads and faucet aerators are installed where technically appropriate.\",\n         evidence:\"Site inspection \/ equipment list\", source:\"BCC sustainability standard\"},\n        {id:27, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Energy-efficient lighting is used throughout the property where practical.\",\n         evidence:\"Site inspection \/ lighting inventory\", source:\"BCC sustainability standard\"},\n        {id:28, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Energy-efficient or inverter HVAC equipment is used where practical.\",\n         evidence:\"Equipment inventory \/ maintenance records\", source:\"BCC sustainability standard\"},\n        {id:29, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Guest-room energy controls such as key-card systems or occupancy sensors are used where practical.\",\n         evidence:\"Site inspection\", source:\"BCC sustainability standard\"},\n        {id:30, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Solar hot water, heat-pump or another efficient hot-water solution is used where appropriate.\",\n         evidence:\"Equipment inspection\", source:\"BCC sustainability standard\"},\n        {id:31, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Rainwater harvesting or another appropriate water-reuse\/recharge solution is implemented where feasible.\",\n         evidence:\"System inspection\", source:\"BCC sustainability standard\"},\n        {id:32, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Greywater treatment or reuse is implemented where technically and legally appropriate.\",\n         evidence:\"System inspection \/ maintenance records\", source:\"BCC sustainability standard\"},\n        {id:33, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Kitchen grease traps are installed and maintained where applicable.\",\n         evidence:\"Site inspection \/ maintenance records\", source:\"BCC sustainability standard\"},\n        {id:34, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Waste is separated into appropriate streams and collection is documented.\",\n         evidence:\"Site inspection \/ waste records\", source:\"BCC sustainability standard\"},\n        {id:35, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Single-use plastic reduction measures are actively implemented.\",\n         evidence:\"Procurement \/ site inspection\", source:\"BCC sustainability standard\"},\n        {id:36, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Composting or another suitable organic-waste solution is implemented where feasible.\",\n         evidence:\"Site inspection \/ waste records\", source:\"BCC sustainability standard\"},\n        {id:37, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Energy consumption is measured and reviewed regularly.\",\n         evidence:\"Meter records \/ monthly consumption log\", source:\"BCC sustainability standard\"},\n        {id:38, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Water consumption is measured and reviewed regularly.\",\n         evidence:\"Meter records \/ monthly consumption log\", source:\"BCC sustainability standard\"},\n        {id:39, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Preventive maintenance is documented for HVAC, refrigeration and other major equipment.\",\n         evidence:\"Maintenance schedule \/ service records\", source:\"BCC sustainability standard\"},\n        {id:40, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Sustainable procurement practices are documented for relevant products and suppliers.\",\n         evidence:\"Supplier policy \/ procurement records\", source:\"BCC sustainability standard\"},\n        {id:41, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Guests receive practical environmental and cultural guidance appropriate to the property.\",\n         evidence:\"Guest information \/ onboarding material\", source:\"BCC sustainability standard\"},\n        {id:42, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Staff receive environmental and cultural awareness training.\",\n         evidence:\"Training records\", source:\"BCC sustainability standard\"},\n        {id:43, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Sustainable landscaping practices reduce unnecessary water and chemical use.\",\n         evidence:\"Landscape inspection \/ maintenance records\", source:\"BCC sustainability standard\"},\n        {id:44, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"Sustainable or lower-impact building materials are considered for new works and replacements.\",\n         evidence:\"Material specifications \/ procurement records\", source:\"BCC sustainability standard\"},\n        {id:45, category:\"BCC Sustainability\", type:\"best\", risk:\"low\", weight:1,\n         text:\"A documented annual sustainability improvement plan is maintained for the property.\",\n         evidence:\"Improvement plan \/ previous audit comparison\", source:\"BCC sustainability standard\"}\n    ];\n\n    const answerLabels = {\n        compliant: \"COMPLIANT\",\n        noncompliant: \"NON-COMPLIANT\",\n        pending: \"PENDING VERIFICATION\",\n        na: \"NOT APPLICABLE\"\n    };\n    const auditExplanations = {\n        1:\"Verify that the legal ownership and corporate structure are appropriate for the actual ownership and operation of the property.\",\n        2:\"Verify that the registered KBLI code(s) match the activities actually carried out at the property. Compare NIB\/OSS records with the real operation.\",\n        3:\"Verify that the NIB is active and that its registered business activities correspond to the actual operation.\",\n        4:\"Verify applicable tax registrations and obligations using the relevant registration and filing\/payment records.\",\n        5:\"Identify the permits and registrations applicable to the actual business activity and verify that required documents are present and current.\",\n        6:\"Verify the official RDTR\/spatial-planning designation and compare the permitted use with the actual use of the property.\",\n        7:\"Determine whether KKPR or another spatial-utilisation approval is required and verify the applicable approval where required.\",\n        8:\"Verify that the PBG is present where required and that the approved building function matches the actual use.\",\n        9:\"Verify whether an SLF is required and, if so, confirm that it is present and valid.\",\n        10:\"Compare actual extensions, alterations and changes of use with approved drawings and building approvals.\",\n        11:\"Verify applicable local requirements such as building height, setbacks, architectural requirements and site-development rules.\",\n        12:\"Identify the environmental approval or management instrument applicable to the actual activity and verify that it is present and valid.\",\n        13:\"Inspect wastewater\/sewage arrangements and relevant maintenance or inspection records against applicable requirements.\",\n        14:\"Check waste storage, separation, collection and disposal arrangements and supporting records.\",\n        15:\"Determine whether groundwater or surface-water extraction occurs and whether an approval or permit is required.\",\n        16:\"If hazardous or special waste is generated, verify that it is handled through the applicable compliant process. If none is generated, N\/A may be appropriate.\",\n        17:\"Verify whether required environmental monitoring or reporting applies and check that required records are maintained.\",\n        18:\"Verify employee documentation and employment records\/contracts for personnel working at the property.\",\n        19:\"Verify applicable BPJS Kesehatan and BPJS Ketenagakerjaan registration and payment records.\",\n        20:\"Verify applicable wage, employment and payroll requirements using relevant records.\",\n        21:\"Verify relevant occupational health and safety procedures, SOPs, training and inspection records.\",\n        22:\"Identify Desa Adat\/Awig-Awig or other customary requirements affecting the property and document them.\",\n        23:\"Verify whether local-community or customary notifications or permissions are required and check the relevant evidence.\",\n        24:\"Review site-specific cultural and customary requirements, including relevant ceremonial access or local requirements.\",\n        25:\"Verify whether local architectural requirements apply and document the assessment against relevant local planning\/design requirements.\",\n        26:\"Inspect showerheads and faucets and determine whether water-efficient fittings are installed where technically appropriate.\",\n        27:\"Review lighting and verify that energy-efficient lighting is used where practical.\",\n        28:\"Review HVAC equipment and verify that efficient or inverter systems are used where practical.\",\n        29:\"Check whether guest-room energy controls such as key-card systems or occupancy sensors are used where practical.\",\n        30:\"Check whether an efficient hot-water solution such as solar hot water or a heat pump is used where appropriate.\",\n        31:\"Check whether rainwater harvesting or another suitable water-reuse\/recharge solution is implemented where feasible.\",\n        32:\"Check whether greywater treatment or reuse is implemented where technically and legally appropriate.\",\n        33:\"Where applicable, inspect kitchen grease traps and verify that they are installed and maintained.\",\n        34:\"Inspect waste separation and verify that appropriate waste streams are separated and collection is documented.\",\n        35:\"Review operational practices and procurement for practical measures reducing single-use plastics.\",\n        36:\"Where feasible, check whether composting or another suitable organic-waste solution is implemented.\",\n        37:\"Check whether energy consumption is measured and reviewed regularly using meter records or a consumption log.\",\n        38:\"Check whether water consumption is measured and reviewed regularly using meter records or a consumption log.\",\n        39:\"Verify that preventive maintenance is documented for HVAC, refrigeration and other major equipment.\",\n        40:\"Review procurement practices and whether sustainable or lower-impact purchasing criteria are documented.\",\n        41:\"Check whether guests receive practical environmental and cultural guidance appropriate to the property.\",\n        42:\"Verify that staff receive environmental and cultural awareness training and that training records are maintained.\",\n        43:\"Inspect landscaping and assess whether water and chemical use are reduced through sustainable practices.\",\n        44:\"For new works and replacements, check whether sustainable or lower-impact building materials are considered.\",\n        45:\"Verify that a documented annual sustainability improvement plan is maintained and can be compared with previous audits.\"\n    };\n\n    function buildAuditGrid() {\n        const groups = {\n            \"Corporate & Licensing\":\"legalGrid\",\n            \"Zoning & Building\":\"zoningGrid\",\n            \"Environmental Legal Compliance\":\"environmentGrid\",\n            \"Employment & Social Compliance\":\"employmentGrid\",\n            \"Cultural & Community\":\"culturalGrid\",\n            \"BCC Sustainability\":\"ecoGrid\"\n        };\n\n        Object.values(groups).forEach(id => {\n            const el = document.getElementById(id);\n            if (el) el.innerHTML = \"\";\n        });\n\n        auditItems.forEach(item => {\n            const target = groups[item.category];\n            const grid = document.getElementById(target);\n            if (!grid) return;\n\n            grid.innerHTML += `\n                <div class=\"checkbox-item audit-item\" data-type=\"${item.type}\" data-risk=\"${item.risk}\" data-weight=\"${item.weight}\">\n                    <div class=\"checkbox-row\">\n                        <div class=\"item-number\">${item.id}.<\/div>\n                        <div class=\"item-main\">\n                            <strong>${item.text}<\/strong>\n                            <div class=\"item-meta\">\n                                <span>Type: ${item.type === \"legal\" ? \"Regulatory\" : \"BCC Best Practice\"}<\/span>\n                                <span>Risk: ${item.risk.toUpperCase()}<\/span>\n                                <span>Weight: ${item.weight}<\/span>\n                            <\/div>\n                        <\/div>\n                    <\/div>\n\n                    <div class=\"answer-row\">\n                        <label><input type=\"radio\" name=\"answer_${item.id}\" value=\"compliant\" onchange=\"updateLiveCounters()\"> Compliant<\/label>\n                        <label><input type=\"radio\" name=\"answer_${item.id}\" value=\"noncompliant\" onchange=\"updateLiveCounters()\"> Non-compliant<\/label>\n                        <label><input type=\"radio\" name=\"answer_${item.id}\" value=\"pending\" onchange=\"updateLiveCounters()\"> Pending<\/label>\n                        <label><input type=\"radio\" name=\"answer_${item.id}\" value=\"na\" onchange=\"updateLiveCounters()\"> N\/A<\/label>\n                    <\/div>\n\n                    <div class=\"item-source\">\n                        <strong>Evidence expected:<\/strong> ${item.evidence}<br>\n                        <strong>Reference:<\/strong> ${item.source}\n                    <\/div>\n                    <div class=\"explanation-wrap\">\n                        <button type=\"button\" class=\"explanation-btn\"\n                            aria-expanded=\"false\"\n                            aria-controls=\"explanation_${item.id}\"\n                            onclick=\"toggleExplanation(${item.id})\">\u24d8 Explanation<\/button>\n                        <div id=\"explanation_${item.id}\" class=\"explanation-panel\" role=\"region\">\n                            <div class=\"explanation-title\">What the auditor should check<\/div>\n                            <div>${auditExplanations[item.id] || \"No additional explanation has been defined.\"}<\/div>\n                        <\/div>\n                    <\/div>\n\n                    <div class=\"evidence-input\">\n                        <input type=\"text\" id=\"ev_${item.id}\" placeholder=\"Document \/ evidence reference\">\n                        <input type=\"text\" id=\"note_${item.id}\" placeholder=\"Auditor notes \/ observations\">\n                        <input type=\"text\" id=\"action_${item.id}\" placeholder=\"Corrective action (if required)\">\n                        <input type=\"text\" id=\"deadline_${item.id}\" placeholder=\"Target completion date\">\n                    <\/div>\n                <\/div>`;\n        });\n    }\n\n    function toggleExplanation(id) {\n        const panel = document.getElementById(`explanation_${id}`);\n        const button = document.querySelector(`button[aria-controls=\"explanation_${id}\"]`);\n        if (!panel || !button) return;\n        const isOpen = panel.classList.toggle(\"open\");\n        button.setAttribute(\"aria-expanded\", String(isOpen));\n        button.innerText = isOpen ? \"\u24d8 Hide Explanation\" : \"\u24d8 Explanation\";\n    }\n\n    function getAnswer(id) {\n        const selected = document.querySelector(`input[name=\"answer_${id}\"]:checked`);\n        return selected ? selected.value : null;\n    }\n\n    function calculateResults() {\n        let totalApplicablePoints = 0;\n        let earnedPoints = 0;\n        let legalApplicableWeight = 0;\n        let legalPassedWeight = 0;\n        let bestApplicable = 0;\n        let bestPassed = 0;\n        let criticalFailures = 0;\n        let highFailures = 0;\n        let pending = 0;\n        let unanswered = 0;\n\n        auditItems.forEach(item => {\n            const answer = getAnswer(item.id);\n\n            if (!answer) {\n                unanswered++;\n                return;\n            }\n\n            if (answer === \"pending\") pending++;\n            if (answer === \"na\") return;\n\n            totalApplicablePoints += item.weight;\n\n            if (answer === \"compliant\") {\n                earnedPoints += item.weight;\n            }\n\n            if (item.type === \"legal\") {\n                legalApplicableWeight += item.weight;\n                if (answer === \"compliant\") legalPassedWeight += item.weight;\n\n                if (answer === \"noncompliant\") {\n                    if (item.risk === \"critical\") criticalFailures++;\n                    if (item.risk === \"high\") highFailures++;\n                }\n            } else {\n                bestApplicable++;\n                if (answer === \"compliant\") bestPassed++;\n            }\n        });\n\n        const totalScore = totalApplicablePoints\n            ? Math.round((earnedPoints \/ totalApplicablePoints) * 100)\n            : 0;\n\n        const legalScore = legalApplicableWeight\n            ? Math.round((legalPassedWeight \/ legalApplicableWeight) * 100)\n            : 0;\n\n        const sustainabilityScore = bestApplicable\n            ? Math.round((bestPassed \/ bestApplicable) * 100)\n            : 0;\n\n        \/*\n         * FINAL COMPLIANCE RULE\n         * COMPLIANT only when:\n         * 1. No critical legal failures\n         * 2. No high-risk legal failures\n         * 3. No unanswered or pending items\n         * 4. Regulatory score is at least 80%\n         * 5. Total weighted score is at least 80%\n         *\n         * Sustainability does not compensate for legal non-compliance.\n         *\/\n        const compliant =\n            criticalFailures === 0 &&\n            highFailures === 0 &&\n            pending === 0 &&\n            unanswered === 0 &&\n            legalScore >= 80 &&\n            totalScore >= 80;\n\n        let status;\n        let statusClass;\n\n        if (compliant) {\n            status = \"COMPLIANT\";\n            statusClass = \"success\";\n        } else if (criticalFailures > 0) {\n            status = \"NOT COMPLIANT \u2013 CRITICAL LEGAL FAILURE\";\n            statusClass = \"danger\";\n        } else if (highFailures > 0) {\n            status = \"NOT COMPLIANT \u2013 HIGH RISK\";\n            statusClass = \"danger\";\n        } else if (pending > 0 || unanswered > 0) {\n            status = \"NOT COMPLIANT \u2013 VERIFICATION INCOMPLETE\";\n            statusClass = \"warning\";\n        } else {\n            status = \"NOT COMPLIANT\";\n            statusClass = \"warning\";\n        }\n\n        return {\n            earnedPoints,\n            totalApplicablePoints,\n            totalScore,\n            legalScore,\n            sustainabilityScore,\n            criticalFailures,\n            highFailures,\n            pending,\n            unanswered,\n            compliant,\n            status,\n            statusClass\n        };\n    }\n\n    function updateLiveCounters() {\n        const result = calculateResults();\n        const answered = auditItems.filter(item => getAnswer(item.id) !== null).length;\n\n        const countEl = document.getElementById('checkedCount');\n        if (countEl) countEl.innerText = `${answered}`;\n\n        const pointsEl = document.getElementById('totalPoints');\n        if (pointsEl) {\n            pointsEl.innerText = `${result.earnedPoints} \/ ${result.totalApplicablePoints}`;\n        }\n\n        const legalEl = document.getElementById('legalScore');\n        if (legalEl) legalEl.innerText = `${result.legalScore}%`;\n\n        const sustainabilityEl = document.getElementById('sustainabilityScore');\n        if (sustainabilityEl) sustainabilityEl.innerText = `${result.sustainabilityScore}%`;\n\n        const resultEl = document.getElementById('complianceResult');\n        if (resultEl) {\n            resultEl.innerText = result.status;\n            resultEl.className = `result-label ${result.statusClass}`;\n        }\n\n        const badge = document.getElementById('badgeStatus');\n        if (badge) {\n            badge.innerText = result.status;\n            badge.className = `badge-status ${result.statusClass}`;\n        }\n    }\n\n    buildAuditGrid();\n\n    window.addEventListener('DOMContentLoaded', () => {\n        renderTable();\n        updateLiveCounters();\n    });\n<\/script>\n    <script>\n    function processAudit() {\n        const result = calculateResults();\n\n        const name = document.getElementById('vName').value.trim() || \"Unnamed Property\";\n        const auditor = document.getElementById('aName').value.trim() || \"Staff\";\n        const zone = document.getElementById('vZone').value.trim() || \"Not Specified\";\n        const phone = document.getElementById('vPhone').value.trim() || \"N\/A\";\n        const email = document.getElementById('vEmail').value.trim() || \"N\/A\";\n        const address = document.getElementById('vAddress').value.trim() || \"Not Provided\";\n        const ownerName = document.getElementById('vOwnerName').value.trim() || \"N\/A\";\n        const ownerContact = document.getElementById('vOwnerContact').value.trim() || \"N\/A\";\n        const mgmtName = document.getElementById('vMgmtName').value.trim() || \"N\/A\";\n        const mgmtContact = document.getElementById('vMgmtContact').value.trim() || \"N\/A\";\n\n        \/\/ Final audit records must not be saved while verification is incomplete.\n        if (result.unanswered > 0 || result.pending > 0) {\n            showAlert(\n                `Audit cannot be finalized. Unanswered: ${result.unanswered}; Pending: ${result.pending}. Complete or mark applicable items as N\/A before saving.`,\n                \"warning\"\n            );\n            return;\n        }\n\n        const answersState = {};\n        auditItems.forEach(item => {\n            answersState[`item_${item.id}`] = {\n                answer: getAnswer(item.id),\n                evidence: document.getElementById(`ev_${item.id}`)?.value.trim() || \"\",\n                note: document.getElementById(`note_${item.id}`)?.value.trim() || \"\",\n                action: document.getElementById(`action_${item.id}`)?.value.trim() || \"\",\n                deadline: document.getElementById(`deadline_${item.id}`)?.value.trim() || \"\"\n            };\n        });\n\n        const newAudit = {\n            auditVersion: \"BCC-45 v1.0\",\n            auditId: `BCC-${Date.now()}-${Math.random().toString(36).slice(2, 8).toUpperCase()}`,\n            name, auditor, zone, phone, email, address,\n            ownerName, ownerContact, mgmtName, mgmtContact,\n            earnedPoints: result.earnedPoints,\n            totalApplicablePoints: result.totalApplicablePoints,\n            totalScore: result.totalScore,\n            legalScore: result.legalScore,\n            sustainabilityScore: result.sustainabilityScore,\n            complianceResult: result.compliant ? \"COMPLIANT\" : \"NOT COMPLIANT\",\n            status: result.status,\n            criticalFailures: result.criticalFailures,\n            highFailures: result.highFailures,\n            pending: result.pending,\n            unanswered: result.unanswered,\n            timestamp: new Date().toISOString(),\n            state: answersState\n        };\n\n        const auditHistory = loadAuditHistory();\n        auditHistory.unshift(newAudit);\n\n        try {\n            localStorage.setItem('bcc_audit_db', JSON.stringify(auditHistory));\n        } catch (error) {\n            console.error(error);\n            showAlert(\"Audit could not be stored in this browser. Storage may be unavailable or full.\", \"danger\");\n            return;\n        }\n\n        renderTable();\n        showAlert(\n            `Audit saved for \"${name}\". Result: ${result.status}. Total score: ${result.totalScore}%. Regulatory: ${result.legalScore}%. Sustainability: ${result.sustainabilityScore}%.`,\n            result.compliant ? \"success\" : \"warning\"\n        );\n        window.scrollTo({top: 0, behavior: 'smooth'});\n    }\n\n    function showAlert(message, level = \"success\") {\n        const alertBox = document.getElementById('successAlert');\n        if (!alertBox) return;\n        alertBox.innerText = message;\n        alertBox.style.display = 'block';\n\n        if (level === \"danger\") {\n            alertBox.style.backgroundColor = \"#FED7D7\";\n            alertBox.style.color = \"#742A2A\";\n            alertBox.style.borderLeftColor = \"var(--danger)\";\n        } else if (level === \"warning\") {\n            alertBox.style.backgroundColor = \"#FEFCBF\";\n            alertBox.style.color = \"#744210\";\n            alertBox.style.borderLeftColor = \"var(--warning)\";\n        } else {\n            alertBox.style.backgroundColor = \"#C6F6D5\";\n            alertBox.style.color = \"#22543D\";\n            alertBox.style.borderLeftColor = \"#38A169\";\n        }\n    }\n\n    function loadAuditHistory() {\n        try {\n            const raw = localStorage.getItem('bcc_audit_db');\n            const parsed = raw ? JSON.parse(raw) : [];\n            return Array.isArray(parsed) ? parsed : [];\n        } catch (error) {\n            console.error(error);\n            return [];\n        }\n    }\n\n    function escapeHtml(value) {\n        return String(value ?? \"\")\n            .replace(\/&\/g, \"&amp;\")\n            .replace(\/<\/g, \"&lt;\")\n            .replace(\/>\/g, \"&gt;\")\n            .replace(\/\"\/g, \"&quot;\")\n            .replace(\/'\/g, \"&#039;\");\n    }\n\n    function formatDate(iso) {\n        const d = new Date(iso);\n        return Number.isNaN(d.getTime()) ? String(iso || \"\") : d.toLocaleString();\n    }\n\n    function buildReportHtml(audit, current = false) {\n        const source = current ? {\n            auditId: \"CURRENT\",\n            name: document.getElementById('vName').value.trim() || \"Unnamed Property\",\n            auditor: document.getElementById('aName').value.trim() || \"Staff\",\n            timestamp: new Date().toISOString(),\n            earnedPoints: audit.earnedPoints,\n            totalApplicablePoints: audit.totalApplicablePoints,\n            totalScore: audit.totalScore,\n            legalScore: audit.legalScore,\n            sustainabilityScore: audit.sustainabilityScore,\n            status: audit.status,\n            state: audit.state\n        } : audit;\n\n        const rows = auditItems.map(item => {\n            const state = source.state?.[`item_${item.id}`] || {};\n            return `<tr>\n                <td>${item.id}<\/td>\n                <td>${escapeHtml(item.category)}<\/td>\n                <td><strong>${escapeHtml(item.text)}<\/strong><br><small><em>Explanation:<\/em> ${escapeHtml(auditExplanations[item.id] || \"\")}<\/small><\/td>\n                <td>${escapeHtml(String(state.answer || \"UNANSWERED\").toUpperCase())}<\/td>\n                <td>${escapeHtml(state.evidence || \"\")}<\/td>\n                <td>${escapeHtml(state.note || \"\")}<\/td>\n                <td>${escapeHtml(state.action || \"\")}<\/td>\n                <td>${escapeHtml(state.deadline || \"\")}<\/td>\n            <\/tr>`;\n        }).join(\"\");\n\n        return `<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>BCC Compliance Audit Report - ${escapeHtml(source.name)}<\/title>\n<style>\nbody{font-family:Arial,sans-serif;color:#2D3748;margin:30px}\nh1,h2{color:#1A365D}\n.summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:20px 0}\n.card{border:1px solid #E2E8F0;padding:14px;border-radius:6px}\n.status{font-weight:bold;font-size:18px}\ntable{width:100%;border-collapse:collapse;font-size:10px;margin-top:20px}\nth,td{border:1px solid #CBD5E0;padding:6px;vertical-align:top}\nth{background:#EDF2F7}\nbutton{padding:10px 16px;font-weight:bold}\n@media print{body{margin:10mm}.no-print{display:none}}\n<\/style>\n<\/head>\n<body>\n<h1>Bali Compliance Centre (BCC)<\/h1>\n<p><strong>Master Compliance Audit Report<\/strong><\/p>\n<div class=\"summary\">\n<div class=\"card\"><strong>Audit ID<\/strong><br>${escapeHtml(source.auditId)}<\/div>\n<div class=\"card\"><strong>Property<\/strong><br>${escapeHtml(source.name)}<\/div>\n<div class=\"card\"><strong>Auditor<\/strong><br>${escapeHtml(source.auditor)}<\/div>\n<div class=\"card\"><strong>Audit date<\/strong><br>${escapeHtml(formatDate(source.timestamp))}<\/div>\n<div class=\"card\"><strong>Total points<\/strong><br>${escapeHtml(source.earnedPoints)} \/ ${escapeHtml(source.totalApplicablePoints)}<\/div>\n<div class=\"card\"><strong>Total score<\/strong><br>${escapeHtml(source.totalScore)}%<\/div>\n<div class=\"card\"><strong>Regulatory score<\/strong><br>${escapeHtml(source.legalScore)}%<\/div>\n<div class=\"card\"><strong>Sustainability score<\/strong><br>${escapeHtml(source.sustainabilityScore)}%<\/div>\n<div class=\"card\"><strong>Status<\/strong><br>${escapeHtml(source.status)}<\/div>\n<\/div>\n<p><strong>Important:<\/strong> This is an internal BCC audit record. It does not itself constitute a government permit, legal opinion, certification, or statutory approval.<\/p>\n<h2>Audit findings<\/h2>\n<table>\n<thead><tr><th>#<\/th><th>Category<\/th><th>Control point & explanation<\/th><th>Answer<\/th><th>Evidence<\/th><th>Notes<\/th><th>Corrective action<\/th><th>Deadline<\/th><\/tr><\/thead>\n<tbody>${rows}<\/tbody>\n<\/table>\n\n<!-- BCC-ENGLISH-FINAL: English master source preserved -->\n<\/body>\n<\/html>`;\n    }\n\n    function openReport(reportHtml) {\n        let overlay = document.getElementById(\"bccReportOverlay\");\n\n        if (!overlay) {\n            overlay = document.createElement(\"div\");\n            overlay.id = \"bccReportOverlay\";\n            overlay.style.cssText =\n                \"position:fixed;inset:0;background:#fff;z-index:99999;overflow:auto;\" +\n                \"padding:24px;box-sizing:border-box;\";\n\n            document.body.appendChild(overlay);\n        }\n\n        overlay.innerHTML = `\n            <div style=\"max-width:1200px;margin:0 auto;\">\n                <div class=\"no-print\" style=\"display:flex;gap:10px;justify-content:flex-end;margin-bottom:15px;\">\n                    <button type=\"button\" class=\"btn\" onclick=\"window.print()\">\ud83d\udda8\ufe0f Print \/ Save PDF<\/button>\n                    <button type=\"button\" class=\"btn\" style=\"background:#718096;\" onclick=\"closeReport()\">\u2715 Close Report<\/button>\n                <\/div>\n                <div id=\"bccPrintableReport\">${reportHtml}<\/div>\n            <\/div>`;\n\n        \/\/ reportHtml contains a complete HTML document. Extract its body content\/styles\n        \/\/ so it can safely render inside the application overlay.\n        const parser = new DOMParser();\n        const doc = parser.parseFromString(reportHtml, \"text\/html\");\n\n        const styleText = Array.from(doc.querySelectorAll(\"style\"))\n            .map(style => style.textContent)\n            .join(\"\\n\");\n\n        const reportBody = doc.body ? doc.body.innerHTML : reportHtml;\n        const printable = document.getElementById(\"bccPrintableReport\");\n\n        printable.innerHTML = reportBody;\n\n        if (styleText) {\n            const style = document.createElement(\"style\");\n            style.id = \"bccDynamicReportStyle\";\n            style.textContent = styleText;\n            document.head.appendChild(style);\n        }\n\n        overlay.style.display = \"block\";\n        document.body.style.overflow = \"hidden\";\n    }\n\n    function closeReport() {\n        const overlay = document.getElementById(\"bccReportOverlay\");\n        if (overlay) overlay.style.display = \"none\";\n        document.body.style.overflow = \"\";\n\n        const dynamicStyle = document.getElementById(\"bccDynamicReportStyle\");\n        if (dynamicStyle) dynamicStyle.remove();\n    }\n\n    function printCurrentReport() {\n        const result = calculateResults();\n\n        const answersState = {};\n        auditItems.forEach(item => {\n            answersState[`item_${item.id}`] = {\n                answer: getAnswer(item.id),\n                evidence: document.getElementById(`ev_${item.id}`)?.value || \"\",\n                note: document.getElementById(`note_${item.id}`)?.value || \"\",\n                action: document.getElementById(`action_${item.id}`)?.value || \"\",\n                deadline: document.getElementById(`deadline_${item.id}`)?.value || \"\"\n            };\n        });\n\n        const currentAudit = {\n            auditId: \"CURRENT\",\n            name: document.getElementById('vName').value.trim() || \"Unnamed Property\",\n            auditor: document.getElementById('aName').value.trim() || \"Staff\",\n            timestamp: new Date().toISOString(),\n            earnedPoints: result.earnedPoints,\n            totalApplicablePoints: result.totalApplicablePoints,\n            totalScore: result.totalScore,\n            legalScore: result.legalScore,\n            sustainabilityScore: result.sustainabilityScore,\n            status: result.status,\n            state: answersState\n        };\n\n        openReport(buildReportHtml(currentAudit, true));\n    }\n\n    function printSavedReport(index) {\n        const auditHistory = loadAuditHistory();\n        const audit = auditHistory[index];\n        if (!audit) return;\n        openReport(buildReportHtml(audit, false));\n    }\n\n    function renderTable() {\n        const tableBody = document.querySelector('#historyTable tbody');\n        if (!tableBody) return;\n\n        let auditHistory = loadAuditHistory();\n        tableBody.innerHTML = \"\";\n\n        if (auditHistory.length === 0) {\n            tableBody.innerHTML = `<tr><td colspan=\"7\" style=\"text-align:center; color:#888;\">No audits registered in local database yet.<\/td><\/tr>`;\n            return;\n        }\n\n        auditHistory.forEach(audit => {\n            const status = audit.status || \"PENDING VERIFICATION\";\n            const colorClass = status.includes(\"CRITICAL\") || status.includes(\"HIGH RISK\")\n                ? \"danger\"\n                : status.includes(\"PENDING\") || status.includes(\"ACTION\")\n                    ? \"warning\"\n                    : \"success\";\n\n            const safe = value => String(value ?? \"\")\n                .replace(\/&\/g, \"&amp;\")\n                .replace(\/<\/g, \"&lt;\")\n                .replace(\/>\/g, \"&gt;\")\n                .replace(\/\"\/g, \"&quot;\")\n                .replace(\/'\/g, \"&#039;\");\n\n            tableBody.innerHTML += `\n                <tr>\n                    <td>\n                        <strong>${safe(audit.name)}<\/strong><br>\n                        <small>\ud83d\udccd ${safe(audit.address)}<\/small><br>\n                        <small>\u23f1\ufe0f ${safe(audit.timestamp)}<\/small>\n                    <\/td>\n                    <td>\n                        <strong>UBO:<\/strong> ${safe(audit.ownerName || 'N\/A')}<br>\n                        <strong>Mgmt:<\/strong> ${safe(audit.mgmtName || 'N\/A')}\n                    <\/td>\n                    <td>\n                        \ud83d\udcde ${safe(audit.phone || 'N\/A')}<br>\n                        \u2709\ufe0f ${safe(audit.email || 'N\/A')}\n                    <\/td>\n                    <td>\n                        ${safe(audit.auditor || 'N\/A')}<br>\n                        <small>\ud83c\udf0d ${safe(audit.zone || 'N\/A')}<\/small>\n                    <\/td>\n                    <td>\n                        <strong>Total: ${safe(audit.earnedPoints ?? '0')}\/${safe(audit.totalApplicablePoints ?? '0')}<\/strong><br>\n                        <strong>Total score: ${safe(audit.totalScore || 'N\/A')}<\/strong><br>\n                        <strong>Regulatory: ${safe(audit.legalScore || 'N\/A')}<\/strong><br>\n                        <strong>Sustainability: ${safe(audit.sustainabilityScore || 'N\/A')}<\/strong>\n                    <\/td>\n                    <td>${audit.criticalFailures || 0}<\/td>\n                    <td>\n                        <span class=\"badge-status ${colorClass}\">\n                            ${safe(status)}\n                        <\/span><br><button type=\"button\" class=\"btn\" style=\"margin-top:8px;padding:6px 10px;font-size:11px;\" onclick=\"printSavedReport(${auditHistory.indexOf(audit)})\">\ud83d\udda8\ufe0f Report<\/button>\n                    <\/td>\n                <\/tr>`;\n        });\n    }\n\n    function clearDatabase() {\n        if (confirm(\"Are you sure you want to permanently delete all archived audit records from this browser?\")) {\n            try {\n                localStorage.removeItem('bcc_audit_db');\n                renderTable();\n                showAlert(\"All audit records stored in this browser have been deleted.\", \"success\");\n            } catch (error) {\n                console.error(error);\n                showAlert(\"The browser storage could not be cleared.\", \"danger\");\n            }\n        }\n    }\n<\/script>\n<\/body>\n<\/html>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Bali Compliance Centre (BCC) &#8211; Master Compliance Auditor &#8211; Secure 45-Point Audit v1.0 \ud83c\udf3f Bali Compliance Centre (BCC) Master Compliance Audit Portal &#038; History Registry Database \ud83d\udda8\ufe0f Print PDF Inspection Report \ud83c\udfe1 PROPERTY CORE INFORMATION Villa \/ Property Name: Plot \/ Regional Zone: Villa Phone Number: Villa Email Address: Complete&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"footnotes":""},"class_list":["post-180","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>BCC Audit -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/balicompliancecentre.com\/?page_id=180\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"BCC Audit -\" \/>\n<meta property=\"og:description\" content=\"Bali Compliance Centre (BCC) &#8211; Master Compliance Auditor &#8211; Secure 45-Point Audit v1.0 \ud83c\udf3f Bali Compliance Centre (BCC) Master Compliance Audit Portal &#038; History Registry Database \ud83d\udda8\ufe0f Print PDF Inspection Report \ud83c\udfe1 PROPERTY CORE INFORMATION Villa \/ Property Name: Plot \/ Regional Zone: Villa Phone Number: Villa Email Address: Complete&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/balicompliancecentre.com\/?page_id=180\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-02T12:28:27+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/balicompliancecentre.com\\\/?page_id=180\",\"url\":\"https:\\\/\\\/balicompliancecentre.com\\\/?page_id=180\",\"name\":\"BCC Audit -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/balicompliancecentre.com\\\/#website\"},\"datePublished\":\"2026-09-02T12:27:03+00:00\",\"dateModified\":\"2026-09-02T12:28:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/balicompliancecentre.com\\\/?page_id=180#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/balicompliancecentre.com\\\/?page_id=180\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/balicompliancecentre.com\\\/?page_id=180#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/balicompliancecentre.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"BCC Audit\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/balicompliancecentre.com\\\/#website\",\"url\":\"https:\\\/\\\/balicompliancecentre.com\\\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/balicompliancecentre.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"BCC Audit -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/balicompliancecentre.com\/?page_id=180","og_locale":"en_GB","og_type":"article","og_title":"BCC Audit -","og_description":"Bali Compliance Centre (BCC) &#8211; Master Compliance Auditor &#8211; Secure 45-Point Audit v1.0 \ud83c\udf3f Bali Compliance Centre (BCC) Master Compliance Audit Portal &#038; History Registry Database \ud83d\udda8\ufe0f Print PDF Inspection Report \ud83c\udfe1 PROPERTY CORE INFORMATION Villa \/ Property Name: Plot \/ Regional Zone: Villa Phone Number: Villa Email Address: Complete&hellip;","og_url":"https:\/\/balicompliancecentre.com\/?page_id=180","article_modified_time":"2026-09-02T12:28:27+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/balicompliancecentre.com\/?page_id=180","url":"https:\/\/balicompliancecentre.com\/?page_id=180","name":"BCC Audit -","isPartOf":{"@id":"https:\/\/balicompliancecentre.com\/#website"},"datePublished":"2026-09-02T12:27:03+00:00","dateModified":"2026-09-02T12:28:27+00:00","breadcrumb":{"@id":"https:\/\/balicompliancecentre.com\/?page_id=180#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/balicompliancecentre.com\/?page_id=180"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/balicompliancecentre.com\/?page_id=180#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/balicompliancecentre.com\/"},{"@type":"ListItem","position":2,"name":"BCC Audit"}]},{"@type":"WebSite","@id":"https:\/\/balicompliancecentre.com\/#website","url":"https:\/\/balicompliancecentre.com\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/balicompliancecentre.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"}]}},"_links":{"self":[{"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/pages\/180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180"}],"version-history":[{"count":4,"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/pages\/180\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=\/wp\/v2\/pages\/180\/revisions\/184"}],"wp:attachment":[{"href":"https:\/\/balicompliancecentre.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}