/* ══════════════════════════════════════════════════════════════════════════
   สร้างอัตโนมัติจาก projects_plan/Solar_Siteflow_Pro_V5.21.html
   โดย scripts/split_siteflow.mjs — ห้ามแก้ไฟล์นี้ด้วยมือ

   หมายเหตุเรื่องการ scope
     คลาสของ Tailwind ถูกจำกัดขอบเขตด้วย tailwind.config.important = '#sc-siteflow'
     ตั้งไว้ใน CRM-Pi.html ก่อนโหลด Tailwind — utility ทุกตัวจึงมีผลเฉพาะในแท็บนี้
     ไฟล์นี้เหลือเฉพาะสไตล์ที่ Siteflow เขียนเอง ซึ่งส่วนใหญ่ใช้ id (ไม่ชนใคร)
     ส่วนที่ใช้ชื่อคลาสร่วมกับ CRM-Pi ได้ (.modal) ถูก scope ไว้แล้วด้านล่าง
   ══════════════════════════════════════════════════════════════════════════ */
#sc-siteflow .modal { transition: opacity 0.25s ease; }
        body.modal-active { overflow: hidden; }
        .custom-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
        .custom-scroll::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }
        
        .status-badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.813rem; font-weight: 600; display: inline-block; }
        .color-gray { background-color: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
        .color-amber { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
        .color-blue { background-color: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
        .color-navy { background-color: #1e3a8a; color: #ffffff; border: 1px solid #1e3a8a; box-shadow: 0 2px 4px rgba(30,58,138,0.2); }
        .color-teal { background-color: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
        .color-green { background-color: #d1fae5; color: #059669; border: 1px solid #a7f3d0; }
        .color-red { background-color: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
        .color-purple { background-color: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }

        @media print {
            @page { size: A4 landscape; margin: 10mm; }
            .no-print { display: none !important; }
            body { background: white; overflow: visible !important; height: auto !important; }
            main, .custom-scroll { overflow: visible !important; height: auto !important; max-height: none !important; }
            
            body.print-mode-report aside, body.print-mode-report header { display: none !important; }
            body.print-mode-report #view-dashboard, body.print-mode-report #view-projects, body.print-mode-report #view-settings, body.print-mode-report #view-workflow { display: none !important; }
            body.print-mode-report #view-reports { display: block !important; width: 100%; position: absolute; left: 0; top: 0; }
            
            body.print-mode-modal aside, body.print-mode-modal header, body.print-mode-modal main { display: none !important; }
            body.print-mode-modal #previewModal { position: absolute; left: 0; top: 0; width: 100%; display: block; opacity: 1; pointer-events: auto; background: white; }
            body.print-mode-modal #previewModal > div { max-width: 100%; box-shadow: none; border: none; }
            body.print-mode-modal .bg-slate-800 { background: white !important; color: black !important; border-bottom: 2px solid #e5e7eb; }
            body.print-mode-modal .bg-slate-800 i, body.print-mode-modal .bg-slate-800 h3 { color: #1e293b !important; }

            body.print-mode-export aside, body.print-mode-export header, body.print-mode-export main { display: none !important; }
            body.print-mode-export #reportExportModal { position: absolute; left: 0; top: 0; width: 100%; display: block; opacity: 1; pointer-events: auto; background: white; }
            body.print-mode-export #reportExportModal > div { max-width: 100%; box-shadow: none; border: none; height: auto; }
            body.print-mode-export #exportPreviewArea { background: white; padding: 0; overflow: visible; height: auto; }
            body.print-mode-export #exportDocument { box-shadow: none !important; margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; height: auto; border: none !important; }
            body.print-mode-export .no-print-export { display: none !important; }

            /* โหมดปริ้นสำหรับ Active Board */
            body.print-mode-workflow aside, body.print-mode-workflow header, body.print-mode-workflow main { display: none !important; }
            body.print-mode-workflow #workflowExportModal { position: absolute; left: 0; top: 0; width: 100%; display: block; opacity: 1; pointer-events: auto; background: white; }
            body.print-mode-workflow #workflowExportModal > div { max-width: 100%; box-shadow: none; border: none; height: auto; }
            body.print-mode-workflow #workflowExportPreviewArea { background: white; padding: 0; overflow: visible; height: auto; }
            body.print-mode-workflow #workflowExportDocument { box-shadow: none !important; margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; height: auto; border: none !important; }
            body.print-mode-workflow .no-print-export { display: none !important; }
            
            table { page-break-inside: auto; }
            tr { page-break-inside: avoid; page-break-after: auto; }
            thead { display: table-header-group; }
            tfoot { display: table-footer-group; }
        }

        @keyframes highlightCode { 0% { background-color: #fef08a; } 100% { background-color: #eff6ff; } }
        .animate-code-change { animation: highlightCode 1s ease-out; }
        
        /* Workflow Highlights */
        @keyframes highlightRow { 0% { background-color: #fff9c4; } 100% { background-color: transparent; } }
        .updated-row { animation: highlightRow 2s ease-out; }
        .history-item { border-left: 3px solid #283593; padding-left: 15px; margin-bottom: 15px; }
        .history-item .hist-time { font-size: 0.85em; color: #666; margin-bottom: 4px; }

/* ══════════════════ ส่วนเสริมสำหรับโหมดฝังตัว (ไม่มีในต้นฉบับ) ══════════════════ */

/* ── มินิ-preflight เฉพาะในแท็บนี้ ──────────────────────────────────────────
   ปิด preflight ของ Tailwind ไว้ (ดู tailwind.config ใน CRM-Pi.html) เพราะรีเซ็ต
   ของมันเป็นกฎระดับ * ทั้งเอกสาร ซึ่งจะล้างสไตล์ของ CRM-Pi ทิ้งทั้งหน้า
   แต่ utility หลายตัวตั้งใจให้ทำงานคู่กับรีเซ็ตนั้น — ที่สำคัญที่สุดคือคลาส border-*
   ที่ตั้งแต่ความหนา ส่วน border-style: solid มาจาก preflight ถ้าไม่มี เส้นขอบทุกเส้น
   ใน Siteflow จะหายหมด จึงยกเฉพาะส่วนที่จำเป็นมาไว้ใต้ #sc-siteflow */
#sc-siteflow *,
#sc-siteflow *::before,
#sc-siteflow *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: #e5e7eb; }
#sc-siteflow h1, #sc-siteflow h2, #sc-siteflow h3,
#sc-siteflow h4, #sc-siteflow h5, #sc-siteflow h6 { font-size: inherit; font-weight: inherit; margin: 0; }
#sc-siteflow p, #sc-siteflow figure, #sc-siteflow blockquote,
#sc-siteflow dl, #sc-siteflow dd, #sc-siteflow pre { margin: 0; }
#sc-siteflow ul, #sc-siteflow ol { margin: 0; padding: 0; list-style: none; }
#sc-siteflow button, #sc-siteflow input, #sc-siteflow optgroup,
#sc-siteflow select, #sc-siteflow textarea { font: inherit; color: inherit; margin: 0; padding: 0; }
#sc-siteflow button, #sc-siteflow [type="button"],
#sc-siteflow [type="submit"] { background-color: transparent; background-image: none; cursor: pointer; }
#sc-siteflow table { border-collapse: collapse; text-indent: 0; border-color: inherit; }
#sc-siteflow img, #sc-siteflow svg, #sc-siteflow canvas { display: block; vertical-align: middle; max-width: 100%; }
#sc-siteflow hr { height: 0; color: inherit; border-top-width: 1px; }
#sc-siteflow a { text-decoration: inherit; }

/* ต้นฉบับเป็นหน้าเต็มจอ ใช้ h-screen กับ body — ในแท็บต้องสูงตามพื้นที่ที่เหลือแทน
   คำนวณจากความสูงจอ ลบแถบบนของ CRM-Pi (56px) และ padding ของ .content (32px) */
#sc-siteflow .sf-shell {
  display: flex;
  height: calc(100vh - 88px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  color: #1f2937;          /* ธีมมืดของ CRM-Pi ทำให้ตัวหนังสือขาวบนพื้นขาว ถ้าไม่ตั้ง */
}
#sc-siteflow .sf-shell a { color: inherit; }

/* โมดัลของ Siteflow เป็น fixed เต็มจอ พึ่งคลาส z-50 ของ Tailwind อยู่แล้ว
   และ pi.css ไม่ได้ตั้ง z-index ไว้ที่ไหนเลย จึงลอยอยู่บนสุดโดยไม่ต้องทำอะไรเพิ่ม
   (ตรวจในเบราว์เซอร์แล้ว — ถ้าวันหลัง CRM-Pi เริ่มใช้ z-index ต้องกลับมาดูตรงนี้) */

/* โหมดปริ้น: ต้นฉบับซ่อน aside/header ด้วยชื่อแท็ก ซึ่งบังเอิญตรงกับเปลือกของ
   CRM-Pi พอดี (aside.sidebar / header.topbar) จึงซ่อนให้เองอยู่แล้ว
   เหลือแค่กล่อง .content ที่ตัดเนื้อหาส่วนเกินทิ้ง กับกรอบของ .sf-shell */
@media print {
  body[class*="print-mode-"] .content,
  body[class*="print-mode-"] .main { overflow: visible !important; height: auto !important; }
  body[class*="print-mode-"] #sc-siteflow .sf-shell {
    display: block; height: auto; border: 0; border-radius: 0; overflow: visible;
  }
}
