/* หน้าแรกโรงงานแบบ Command Center (.cc-board) — ไฟล์นี้ถือเฉพาะกฎของ .cc-* และหน้าที่มี .cc-board เท่านั้น
   ★ กฎของเมนูข้าง/แถบบน อยู่ใน command-center.css ที่เดียว (V.86) — เดิมสองไฟล์ตั้ง .fi-sidebar-group-label
     เป็น 12px และ 16px !important ทั้งคู่ ผลขึ้นกับลำดับ <link> (กติกาข้อ 15) จึงย้ายออกจากไฟล์นี้ทั้งหมด
   ★ ขนาดตัวอักษรทุกจุดอ้างโทเคน var(--text-*) ที่ประกาศใน command-center.css ห้ามใส่ px ตรง ๆ
   Layout and data hierarchy are intentionally independent of the legacy vertical dashboard widgets. */
@media screen {
    html body.fi-panel-app .fi-main:has(.cc-board) { padding-top: 16px; }
    html body.fi-panel-app .fi-page:has(.cc-board),
    html body.fi-panel-app .fi-page:has(.cc-board) .fi-page-content { gap: 18px; }
    html body.fi-panel-app .fi-page:has(.cc-board) .fi-header { margin: 0; padding: 0; }
    html body.fi-panel-app .fi-page:has(.cc-board) .fi-page-header-main-ctn { padding-block: 0; row-gap: 16px; }
    html body.fi-panel-app .fi-page:has(.cc-board) .fi-header-heading { font-size: var(--text-3xl); line-height: var(--text-3xl--line-height); font-weight: 700; }
    html body.fi-panel-app .fi-page:has(.cc-board) .fi-header-subheading { font-size: var(--text-sm); margin-top: 4px; max-width: none; }
    html body.fi-panel-app .fi-page:has(.cc-board) .ce-annc { padding: 8px 12px; gap: 12px; border-radius: 8px; }
    html body.fi-panel-app .fi-page:has(.cc-board) .ce-annc:not(.ce-annc-critical) > div:first-child { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
    html body.fi-panel-app .fi-page:has(.cc-board) .ce-annc :is(.ce-annc-title,.ce-annc-body) { font-size: var(--text-xs); margin: 0; }
    html body.fi-panel-app .ce-favorites:not(:has(a)) { display: none; }
    .cc-product-brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font: 600 var(--text-lg)/1.3 var(--font-family); }
    .cc-product-brand .cc-art-icon { width: 32px; height: 32px; }
    .cc-art-icon { width: 28px; height: 28px; flex-shrink: 0; }
    .cc-board { color: var(--cc-ink); min-width: 0; }
    .cc-board-meta { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 10px; color: var(--cc-muted); font-size: var(--text-xs); line-height: 1.3; }
    .cc-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
    .cc-kpi { position: relative; display: flex; align-items: flex-start; gap: 12px; min-width: 0; min-height: 126px; padding: 20px 16px 16px; border: 1px solid var(--cc-line); border-radius: 9px; background: var(--cc-surface); box-shadow: 0 3px 12px rgb(18 50 77 / 3%); overflow: hidden; }
    .cc-kpi-icon { color: var(--cc-accent); padding-top: 3px; }
    .cc-kpi-main { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
    .cc-kpi-label { font-size: var(--text-sm); font-weight: 600; color: var(--cc-ink); }
    .cc-kpi-value { font-family: var(--ce-num-font); font-size: clamp(var(--text-2xl), 2.4vw, var(--text-4xl)); font-weight: 600; line-height: 1.3; letter-spacing: -.04em; padding-block: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
    .cc-kpi-value small { font-family: var(--font-family); font-weight: 500; font-size: var(--text-sm); letter-spacing: 0; }
    .cc-kpi-note { font-size: var(--text-xs); color: var(--cc-muted); line-height: 1.6; }
    .cc-kpi-art { position: absolute; right: 12px; top: 44px; color: var(--cc-accent); opacity: .09; }
    .cc-kpi-art .cc-art-icon { width: 58px; height: 58px; }
    .cc-board-grid { display: grid; grid-template-columns: minmax(0,1.95fr) minmax(350px,1fr); gap: 20px; margin-bottom: 20px; align-items: stretch; }
    .cc-panel { min-width: 0; background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: 9px; box-shadow: 0 2px 12px rgb(18 50 77 / 3%); }
    .cc-panel-head { flex-wrap: wrap; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 14px; }
    .cc-panel-head h2 { margin: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.6; color: var(--cc-ink); }
    .cc-panel-head h2 > span { font-size: var(--text-sm); font-weight: 400; }
    .cc-panel-head a { white-space: nowrap; font-size: var(--text-xs); color: var(--cc-accent); text-decoration: none; }
    .cc-panel-head a:hover, .cc-order-table a:hover { text-decoration: underline; }
    .cc-orders-panel { display: flex; flex-direction: column; min-height: 432px; }
    .cc-order-scroll { overflow-x: auto; margin-inline: 16px; flex: 1; }
    .cc-order-table { width: 100%; border-collapse: collapse; text-align: start; font-size: var(--text-sm); }
    .cc-order-table th { background: var(--cc-soft); color: var(--cc-muted); font-weight: 600; font-size: var(--text-xs); padding: 12px 10px; white-space: nowrap; }
    .cc-order-table td { border-bottom: 1px solid var(--ce-line-soft); padding: 13px 10px; line-height: 1.6; vertical-align: middle; white-space: nowrap; }
    .cc-order-table th:first-child { border-radius: 6px 0 0 6px; }
    .cc-order-table th:last-child { border-radius: 0 6px 6px 0; }
    .cc-order-table tbody tr:hover { background: var(--cc-soft); }
    .cc-order-table a { color: var(--cc-accent); font-weight: 500; }
    .cc-order-table .cc-customer { max-width: 185px; overflow: hidden; text-overflow: ellipsis; }
    .cc-align-end { text-align: end; font-variant-numeric: tabular-nums; }
    .cc-status { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; }
    .cc-status-good { color: #096447; background: #dff3e9; }
    .cc-status-info { color: #1554a0; background: #e3efff; }
    .cc-status-warn { color: #904209; background: #fff0d7; }
    .cc-status-bad { color: #a22232; background: #ffe7eb; }
    .cc-status-neutral { color: #4f6174; background: #edf1f5; }
    .cc-panel-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 18px; font-size: var(--text-xs); color: var(--cc-muted); border-top: 1px solid var(--ce-line-soft); }
    .cc-board-side { display: flex; flex-direction: column; gap: 16px; }
    .cc-progress-panel { flex: 1; }
    .cc-progress-content { display: flex; align-items: center; gap: 18px; padding: 0 18px 8px; }
    .cc-donut { width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%; background: conic-gradient(#079ba1 calc(var(--cc-percent) * 1%), var(--cc-line) 0); padding: 10px; }
    .cc-donut > div { width: 100%; height: 100%; border-radius: 50%; background: var(--cc-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .cc-donut strong { font: 600 var(--text-2xl)/1.2 var(--ce-num-font); color: var(--cc-ink); }
    .cc-donut span { font-size: var(--text-xs); color: var(--cc-muted); margin-top: 4px; }
    .cc-donut small { font-size: var(--text-xs); color: var(--cc-ink); }
    .cc-legend { flex: 1; font-size: var(--text-sm); margin: 0; }
    .cc-legend > div { display: flex; justify-content: space-between; gap: 12px; margin-block: 12px; }
    .cc-legend dt { display: flex; align-items: center; gap: 7px; color: var(--cc-muted); }
    .cc-legend dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
    .cc-dot { display: inline-block; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; }
    .cc-dot-good { background: #159f75; }.cc-dot-info { background: #3188d7; }.cc-dot-neutral { background: #9eacba; }.cc-dot-bad { background: #cb4556; }.cc-dot-warn { background: #c07821; }
    .cc-progress-note { margin: 0 16px 10px; padding: 6px 10px; border-radius: 5px; background: var(--cc-tint); color: var(--cc-accent); font-size: var(--text-xs); line-height: 1.4; }
    .cc-stock-panel { flex: 1; }
    .cc-stock-list { display: flex; flex-direction: column; gap: 8px; padding: 0 18px 8px; }
    .cc-stock-row { display: flex; gap: 10px; align-items: flex-start; }
    .cc-stock-icon { color: var(--cc-muted); background: var(--cc-soft); border-radius: 5px; padding: 5px; margin-top: 2px; }
    .cc-stock-icon .cc-art-icon { width: 23px; height: 23px; }
    .cc-stock-detail { flex: 1; min-width: 0; }
    .cc-stock-label { flex-wrap: wrap; display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); line-height: 1.4; }
    .cc-stock-label strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cc-stock-label > span { white-space: nowrap; color: var(--cc-muted); font-size: var(--text-xs); }
    .cc-meter-line { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
    .cc-meter-line small { min-width: 28px; font-size: var(--text-xs); text-align: end; color: var(--cc-muted); }
    .cc-meter { background: var(--cc-line); flex: 1; height: 6px; border-radius: 5px; overflow: hidden; }
    .cc-meter > span { display: block; height: 100%; background: linear-gradient(90deg,#007f8b,#2bc6ac); border-radius: inherit; }
    .cc-meter > .cc-meter-low { background: #c07821; }
    .cc-bin-name { display: block; color: var(--cc-muted); font-size: var(--text-xs); margin-top: 2px; line-height: 1.4; }
    .cc-stock-foot { color: var(--cc-muted); font-size: var(--text-xs); padding: 0 18px 10px; }
    .cc-board-side .cc-panel-head { padding-block: 12px; }
    .cc-fleet-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: var(--text-xs); color: var(--cc-muted); }
    .cc-fleet-legend > span { display: inline-flex; align-items: center; gap: 5px; }
    .cc-fleet-legend b { font-weight: 500; color: var(--cc-ink); }
    .cc-fleet-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; padding: 0 18px 16px; }
    .cc-vehicle { min-width: 0; border: 1px solid var(--cc-line); border-bottom-width: 3px; border-radius: 7px; padding: 12px; }
    .cc-vehicle-good { border-bottom-color: #159f75; }.cc-vehicle-info { border-bottom-color: #3188d7; }.cc-vehicle-bad { border-bottom-color: #cb4556; }
    .cc-vehicle-title { display: flex; align-items: center; gap: 8px; }
    .cc-vehicle-title strong { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cc-vehicle-title .cc-art-icon { color: var(--cc-accent); width: 28px; height: 28px; }
    .cc-vehicle-state { display: flex; align-items: center; gap: 5px; font-size: var(--text-xs); margin-top: 5px; color: var(--cc-muted); }
    .cc-vehicle-detail { display: flex; justify-content: space-between; gap: 6px; font-size: var(--text-xs); color: var(--cc-muted); margin-top: 10px; }
    .cc-empty { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--cc-muted); text-align: center; white-space: normal; }
    .cc-empty .cc-art-icon { width: 38px; height: 38px; opacity: .7; }
    .cc-empty strong { font-size: var(--text-sm); font-weight: 500; }
    .cc-empty > span { font-size: var(--text-xs); }
    .cc-empty-small { padding: 12px 0; color: var(--cc-muted); font-size: var(--text-xs); grid-column: 1/-1; }
    @media (max-width: 1200px) and (min-width: 1024px) {
        .cc-kpi { padding: 16px 12px; gap: 8px; }.cc-kpi-icon .cc-art-icon { width: 22px; }.cc-kpi-value { font-size: var(--text-2xl); }
        .cc-kpi-note { font-size: var(--text-xs); }.cc-board-grid { grid-template-columns: minmax(0,1.6fr) minmax(330px,1fr); gap: 14px; }
        .cc-progress-content { gap: 10px; }.cc-donut { width: 132px; height: 132px; }
    }
    @media (max-width: 767px) {
        html body.fi-panel-app .fi-page:has(.cc-board) .fi-header-heading { font-size: var(--text-2xl); line-height: var(--text-2xl--line-height); }
        .cc-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
        .cc-kpi { padding: 12px; min-height: 116px; gap: 7px; }.cc-kpi-icon .cc-art-icon { width: 21px; height: 21px; }
        .cc-kpi-value { font-size: var(--text-2xl); }.cc-kpi-value small { font-size: var(--text-sm); }.cc-kpi-note { font-size: var(--text-xs); }.cc-kpi-label { font-size: var(--text-sm); }
        .cc-board-grid { grid-template-columns: minmax(0,1fr); gap: 14px; margin-bottom: 14px; }
        .cc-orders-panel { min-height: 0; }.cc-order-table { min-width: 580px; }.cc-order-scroll { max-height: 430px; }
        .cc-board-side { gap: 14px; }.cc-panel-head { padding: 14px; }.cc-panel-head h2 { font-size: var(--text-base); }
        .cc-progress-content { justify-content: center; gap: 12px; flex-wrap: wrap; }.cc-legend { max-width: 180px; }
        .cc-fleet-panel .cc-panel-head { align-items: flex-start; flex-direction: column; gap: 8px; }
        .cc-fleet-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-inline: 14px; }
        .cc-vehicle { flex: 0 0 170px; scroll-snap-align: start; }
        .cc-stock-list { gap: 16px; }.cc-stock-label { font-size: var(--text-sm); }.cc-bin-name { font-size: var(--text-xs); }
        .cc-product-brand { font-size: var(--text-base); }
    }
    @media (prefers-reduced-motion: no-preference) {
        .cc-board { animation: cc-board-enter 240ms ease-out; }
        @keyframes cc-board-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
    }
}
