/* AAA HOUSE Material Control v2.2 — Project Lifecycle & Audit Edition */
.status-completed{background:#dcfce7!important;color:#166534!important;border-color:#86efac!important}
.project-context-banner.lifecycle-paused,.project-context-banner.lifecycle-closed{background:linear-gradient(135deg,#fff7ed,#fffbeb);border-color:#f59e0b}
.project-context-banner.lifecycle-completed{background:linear-gradient(135deg,#ecfdf5,#f0fdf4);border-color:#22c55e}
.project-context-banner.lifecycle-cancelled{background:linear-gradient(135deg,#fff1f2,#fef2f2);border-color:#f43f5e}
.project-banner-status{display:flex;flex-direction:column;align-items:flex-end;gap:6px;max-width:440px;text-align:right}
.project-banner-status small{color:var(--muted);line-height:1.35}
.lifecycle-stats-grid,.audit-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:16px 0}
.lifecycle-stats-grid article,.audit-summary-grid article{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:16px;box-shadow:var(--shadow-sm)}
.lifecycle-stats-grid span,.audit-summary-grid span{display:block;color:var(--muted);font-size:.86rem}
.lifecycle-stats-grid strong,.audit-summary-grid strong{display:block;font-size:1.65rem;margin-top:5px;color:var(--text)}
.lifecycle-actions{flex-wrap:wrap;min-width:380px}
.lifecycle-dialog{border-radius:16px;padding:18px;border:1px solid var(--border);background:#f8fafc}
.lifecycle-dialog h3{margin:0 0 8px}.lifecycle-dialog p{margin:0;color:var(--muted);line-height:1.55}
.lifecycle-dialog.lifecycle-warning{background:#fffbeb;border-color:#fcd34d}.lifecycle-dialog.lifecycle-success{background:#ecfdf5;border-color:#86efac}.lifecycle-dialog.lifecycle-danger{background:#fff1f2;border-color:#fda4af}
.lifecycle-current-state{display:flex;align-items:center;gap:12px;margin-top:14px}.lifecycle-current-state>span{font-size:.85rem;color:var(--muted)}
.project-report-modal-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-bottom:14px;position:sticky;top:-18px;z-index:3;background:var(--panel);padding:12px 0;border-bottom:1px solid var(--border)}
.project-report-document{background:#fff;color:#172033;border:1px solid #d8dee9;border-radius:18px;padding:24px;max-width:1280px;margin:0 auto;font-family:"Noto Sans Thai",Tahoma,sans-serif}
.project-report-document.compact{max-width:none;padding:18px}.project-report-header{display:grid;grid-template-columns:100px 1fr auto;align-items:center;gap:18px;border-bottom:3px solid #0f766e;padding-bottom:16px;margin-bottom:18px}
.project-report-header img{width:84px;height:84px;object-fit:contain}.project-report-header h1{font-size:1.45rem;margin:0;color:#0f3d3a}.project-report-header p{margin:4px 0 0;color:#64748b}.project-report-code{text-align:right}.project-report-code span{display:block;font-size:.78rem;color:#64748b}.project-report-code strong{font-size:1.15rem;color:#0f766e}
.project-report-project{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:16px}.project-report-project>div{padding:11px 12px;background:#f8fafc;border-radius:10px;border:1px solid #e2e8f0}.project-report-project span{display:block;color:#64748b;font-size:.75rem}.project-report-project strong{display:block;margin-top:4px;font-size:.9rem}
.project-report-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin:16px 0}.project-report-kpis article{border:1px solid #dbe5e8;border-radius:12px;padding:12px;background:#f0fdfa}.project-report-kpis span{display:block;color:#64748b;font-size:.72rem}.project-report-kpis strong{display:block;font-size:1rem;margin-top:4px;color:#0f766e}.project-report-kpis small{font-size:.7rem;color:#64748b}
.project-report-section{margin-top:20px}.project-report-section h2{font-size:1rem;color:#0f3d3a;border-left:4px solid #14b8a6;padding-left:9px;margin:0 0 10px}.project-report-document table{width:100%;border-collapse:collapse;font-size:.78rem}.project-report-document th,.project-report-document td{border:1px solid #d9e1e8;padding:7px 8px;vertical-align:top}.project-report-document th{background:#e6fffb;color:#134e4a}.project-report-note{margin-top:18px;padding:14px;border:1px solid #facc15;background:#fffbeb;border-radius:10px}.project-report-note p{margin:6px 0 0}.project-report-signatures{display:grid;grid-template-columns:repeat(3,1fr);gap:38px;margin:48px 20px 20px;text-align:center}.project-report-signatures .signature-line{display:block;border-top:1px solid #334155;margin-bottom:8px}.project-report-signatures small{display:block;margin-top:8px;color:#64748b}.project-report-document footer{display:flex;justify-content:space-between;border-top:1px solid #cbd5e1;padding-top:10px;margin-top:24px;font-size:.7rem;color:#64748b}
.audit-filter-panel{margin:16px 0}.audit-filter-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.audit-filter-summary{margin-top:12px;text-align:right;color:var(--muted)}.audit-month-group{background:var(--panel);border:1px solid var(--border);border-radius:18px;margin:16px 0;overflow:hidden}.audit-month-head{display:flex;justify-content:space-between;align-items:center;padding:16px 18px;background:linear-gradient(135deg,#f0fdfa,#eff6ff);border-bottom:1px solid var(--border)}.audit-month-head h2{margin:0;font-size:1.08rem}.audit-month-head p{margin:3px 0 0;color:var(--muted)}.audit-compare-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:16px 0}.audit-compare-grid section{min-width:0}.audit-compare-grid h3{font-size:.95rem;margin:0 0 8px}.audit-compare-grid pre{margin:0;max-height:420px;overflow:auto;white-space:pre-wrap;word-break:break-word;background:#0f172a;color:#e2e8f0;border-radius:12px;padding:14px;font-size:.76rem;line-height:1.45}
@media(max-width:1100px){.project-report-kpis{grid-template-columns:repeat(3,1fr)}.project-report-project{grid-template-columns:repeat(2,1fr)}.lifecycle-stats-grid,.audit-summary-grid{grid-template-columns:repeat(2,1fr)}.audit-filter-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:700px){.lifecycle-stats-grid,.audit-summary-grid,.project-report-kpis,.project-report-project,.audit-filter-grid,.audit-compare-grid{grid-template-columns:1fr}.project-banner-status{align-items:flex-start;text-align:left}.project-report-header{grid-template-columns:70px 1fr}.project-report-code{grid-column:1/-1;text-align:left}.project-report-signatures{grid-template-columns:1fr;gap:46px}.lifecycle-actions{min-width:300px}}
@media print{
 body.project-report-print-mode #appView,body.project-report-print-mode #loginView,body.project-report-print-mode #modalBackdrop,body.project-report-print-mode #toastContainer{display:none!important}
 body.project-report-print-mode #printRoot{display:block!important;position:static!important;width:100%!important;max-width:none!important;margin:0!important;padding:0!important}
 body.project-report-print-mode .project-report-document{border:0;border-radius:0;padding:0;max-width:none;font-size:10pt}
 body.project-report-print-mode .project-report-document .table-wrap{overflow:visible!important}
 body.project-report-print-mode .project-report-document table{page-break-inside:auto}
 body.project-report-print-mode .project-report-document tr{page-break-inside:avoid;page-break-after:auto}
 body.project-report-print-mode .project-report-section{page-break-inside:auto}
 body.project-report-print-mode .project-report-header{page-break-after:avoid}
 body.project-report-print-mode .project-report-kpis{grid-template-columns:repeat(3,1fr)}
 body.project-report-print-mode .project-report-project{grid-template-columns:repeat(4,1fr)}
 .role-audit .nav-count{display:none!important}
}
.modal:has(.project-report-document){width:min(96vw,1420px);max-width:1420px}
.modal:has(.audit-compare-grid){width:min(94vw,1120px);max-width:1120px}

/* v2.2.1 — Complete PDF Report Hotfix */
.project-report-material-table{min-width:1220px}
.project-report-material-table .project-report-repeat-title{display:none}

@media print{
 @page{size:A4 landscape;margin:6mm}
 html,body{width:auto!important;min-width:0!important;margin:0!important;padding:0!important;background:#fff!important}
 body.project-report-print-mode{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
 body.project-report-print-mode #printRoot{width:100%!important;min-width:0!important;overflow:visible!important}
 body.project-report-print-mode .project-report-document{width:100%!important;min-width:0!important;overflow:visible!important;font-size:8pt!important}
 body.project-report-print-mode .project-report-header{grid-template-columns:20mm 1fr 28mm;gap:4mm;padding-bottom:3mm;margin-bottom:3mm}
 body.project-report-print-mode .project-report-header img{width:18mm;height:18mm}
 body.project-report-print-mode .project-report-header h1{font-size:13pt;line-height:1.15}
 body.project-report-print-mode .project-report-header p{font-size:7.5pt}
 body.project-report-print-mode .project-report-project{gap:2mm;margin-bottom:3mm}
 body.project-report-print-mode .project-report-project>div{padding:2mm;border-radius:2mm}
 body.project-report-print-mode .project-report-project span{font-size:6.5pt}
 body.project-report-print-mode .project-report-project strong{font-size:7.5pt;margin-top:.7mm}
 body.project-report-print-mode .project-report-kpis{gap:2mm;margin:3mm 0}
 body.project-report-print-mode .project-report-kpis article{padding:2mm;border-radius:2mm}
 body.project-report-print-mode .project-report-kpis span{font-size:6.2pt}
 body.project-report-print-mode .project-report-kpis strong{font-size:8pt;margin-top:.5mm}
 body.project-report-print-mode .project-report-section{margin-top:4mm}
 body.project-report-print-mode .project-report-section h2{font-size:9pt;margin:0 0 2mm;padding-left:2mm;border-left-width:1mm}
 body.project-report-print-mode .project-report-section>.table-wrap{width:100%!important;max-width:100%!important;overflow:visible!important}
 body.project-report-print-mode .project-report-document table{width:100%!important;max-width:100%!important;min-width:0!important;table-layout:fixed!important;border-collapse:collapse!important;font-size:7pt!important}
 body.project-report-print-mode .project-report-document thead{display:table-header-group!important}
 body.project-report-print-mode .project-report-document tfoot{display:table-row-group!important}
 body.project-report-print-mode .project-report-document tr{break-inside:avoid!important;page-break-inside:avoid!important}
 body.project-report-print-mode .project-report-document th,
 body.project-report-print-mode .project-report-document td{padding:1.2mm 1.1mm!important;line-height:1.25!important;overflow-wrap:anywhere!important;word-break:break-word!important}
 body.project-report-print-mode .project-report-document th{font-size:6.7pt!important}
 body.project-report-print-mode .project-report-document td.number,
 body.project-report-print-mode .project-report-material-table .report-col-money,
 body.project-report-print-mode .project-report-material-table .report-col-qty{white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important}
 body.project-report-print-mode .project-report-material-section{break-before:page;page-break-before:always}
 body.project-report-print-mode .project-report-material-section>h2{display:none!important}
 body.project-report-print-mode .project-report-material-table{min-width:0!important;width:100%!important;table-layout:fixed!important;font-size:6.55pt!important}
 body.project-report-print-mode .project-report-material-table col.col-seq{width:4%}
 body.project-report-print-mode .project-report-material-table col.col-code{width:8%}
 body.project-report-print-mode .project-report-material-table col.col-category{width:13%}
 body.project-report-print-mode .project-report-material-table col.col-item{width:27%}
 body.project-report-print-mode .project-report-material-table col.col-qty{width:7%}
 body.project-report-print-mode .project-report-material-table col.col-unit{width:7%}
 body.project-report-print-mode .project-report-material-table col.col-money{width:10%}
 body.project-report-print-mode .project-report-material-table .project-report-repeat-title{display:table-row!important}
 body.project-report-print-mode .project-report-material-table .project-report-repeat-title th{background:#fff!important;border:0!important;border-left:1mm solid #14b8a6!important;color:#0f3d3a!important;text-align:left!important;font-size:9pt!important;padding:0 0 2mm 2mm!important}
 body.project-report-print-mode .project-report-material-table .report-col-seq,
 body.project-report-print-mode .project-report-material-table .report-col-code,
 body.project-report-print-mode .project-report-material-table .report-col-qty,
 body.project-report-print-mode .project-report-material-table .report-col-unit{white-space:nowrap!important}
 body.project-report-print-mode .project-report-signatures{break-inside:avoid;page-break-inside:avoid;margin:12mm 8mm 4mm;gap:18mm}
 body.project-report-print-mode .project-report-note{break-inside:avoid;page-break-inside:avoid}
 body.project-report-print-mode .project-report-document footer{break-inside:avoid;page-break-inside:avoid}
}

