/*
 * คำสั่ง 55 (CEO 13/10/2026) — จอคอม ≥ 1024px: แถบซ้าย + แถบบนพื้นขาว + เนื้อหาเต็มจอทุกแท็บ (ข้อ B),
 * หน้า "ออเดอร์สกรีน" แบบใหม่ (ข้อ C), กรองสถานะ 3 กลุ่ม (ข้อ D) · ข้อความ "สกรีนเสร็จแล้ว" สีเขียว (ข้อ E ทุกจอ)
 *
 * มือถือ < 1024px: นอก @media มีแค่ซ่อนแถบซ้าย/ชื่อแท็บบนแถบบน (ไม่เคยแสดงบนมือถือ) และสีเขียวของข้อ E
 * แบบเดียวกับเว็บเซลล์ (sales-gocup คำสั่ง 21): แถบซ้าย 268px · โลโก้ 48px มุม 12px · เมนูสูง 46px มุม 12px · ชื่อ/ผู้ใช้ล่างสุด
 */
.fd-side,
.fd-top-title {
  display: none;
}

/* ข้อ E — ออเดอร์ที่แก้วทุกตัว "สกรีนเสร็จแล้ว" (ทุกจอ) */
#appPage .production-due-done {
  color: #15803d;
  font-weight: 800;
}

@media (min-width: 1024px) {
  :root {
    --fd-side-w: 268px;
    --fd-top-h: 68px;
    --fd-gutter: 28px;
    --fd-brand-h: 89px;
    --fd-user-h: 70px;
  }

  /* ───── B: เนื้อหาเต็มจอ (ไม่มีตัวจำกัดความกว้าง 1180px / 920px เดิม) ───── */
  #appPage.wrap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: calc(var(--fd-top-h) + 22px) var(--fd-gutter) var(--fd-gutter) calc(var(--fd-side-w) + var(--fd-gutter));
  }

  #appPage.wrap::before {
    background: #f5f3ef;
  }

  #appPage .receiving-page {
    max-width: none;
  }

  /* ปุ่มบันทึกแบบติดล่าง: เดิมเว้นที่ให้แถบเมนูล่าง — จอคอมไม่มีแถบล่างแล้ว */
  #appPage .save-btn {
    bottom: 16px;
  }

  /* ───── B: แถบซ้าย ───── */
  /* ชั้นบนของแถบซ้าย (โปร่งใส กดทะลุได้): โลโก้บน + ผู้ใช้ล่าง — อยู่เหนือเมนู เพื่อให้กล่อง "ออกจากระบบ" ไม่ถูกเมนูบัง
     พื้นขาว/เส้นขอบขวาของแถบซ้ายมาจาก .tabs ด้านล่าง */
  .fd-side {
    position: fixed;
    z-index: 92;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: calc(var(--fd-side-w) - 1px);
    background: transparent;
    pointer-events: none;
  }

  .fd-brand,
  .fd-user {
    background: #fff;
    pointer-events: auto;
  }

  .fd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    height: var(--fd-brand-h);
    margin: 0 16px;
    border-bottom: 1px solid #e7e5e4;
  }

  .fd-brand img {
    display: block;
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .fd-brand-text {
    min-width: 0;
  }

  .fd-brand-name {
    color: #eb5727;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 700;
  }

  .fd-brand-sub {
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 600;
    white-space: nowrap;
  }

  .fd-user {
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    box-sizing: border-box;
    height: var(--fd-user-h);
    padding: 8px 0;
    border-top: 1px solid #e7e5e4;
  }

  .fd-user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(100% + 16px);
    min-height: 52px;
    margin: 0 -8px;
    padding: 0 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #111;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .fd-user-btn:hover {
    background: #fafaf9;
  }

  .fd-user.open .fd-user-btn {
    background: #f6f2ee;
  }

  .fd-avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #eb5727;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
  }

  .fd-user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .fd-user-menu {
    position: absolute;
    z-index: 2;
    right: -8px;
    bottom: 100%;
    left: -8px;
    margin-bottom: 8px;
    padding: 6px;
    border: 1px solid #ece5df;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(59, 14, 9, 0.12);
  }

  .fd-user-menu[hidden] {
    display: none;
  }

  .fd-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: #fef2f2;
    color: #dc2626;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  .fd-logout svg {
    flex: none;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* เมนู 5 แท็บ (คำสั่ง 120) = ปุ่ม .tab ชุดเดิมของแถบล่าง (onclick/active/nav-timing/ป้ายใกล้ครบกำหนดเดิม) วางในช่องกลางของแถบซ้าย */
  #appPage .tabs {
    position: fixed;
    z-index: 91;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: var(--fd-side-w);
    min-height: 0;
    margin: 0;
    padding: calc(var(--fd-brand-h) + 12px) 12px calc(var(--fd-user-h) + 12px);
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid #e7e5e4;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  #appPage .tab {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: #44403c;
    text-align: left;
  }

  #appPage .tab:hover {
    background: #fafaf9;
  }

  #appPage .tab svg {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    stroke-width: 2;
  }

  #appPage .tab .lb {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: #44403c;
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
  }

  #appPage .tab.active {
    background: #fff1ec;
    box-shadow: none;
  }

  #appPage .tab.active .lb {
    color: #eb5727;
    font-weight: 700;
  }

  /* ป้าย "ใกล้ครบกำหนด N ลัง" ของแท็บออเดอร์สกรีน: เดิมลอยเหนือแถบล่าง → จอคอมขึ้นบรรทัดใต้ชื่อเมนู (ชื่อเมนูไม่ถูกตัด) */
  #appPage .tabs .production-nav-tab {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  #appPage .tabs .production-nav-tab:has(.production-nav-notice:not([hidden])) {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #appPage .tabs .production-nav-tab .lb {
    flex: 1 1 calc(100% - 32px);
  }

  #appPage .tabs .production-nav-tab .production-nav-notice {
    position: static;
    flex: none;
    max-width: calc(100% - 32px);
    margin-left: 32px;
    overflow: hidden;
    padding: 2px 8px;
    transform: none;
    box-shadow: none;
    font-size: 11px;
    text-overflow: ellipsis;
  }

  #appPage .tabs .production-nav-tab .production-nav-notice::after {
    display: none;
  }

  /* ───── B: แถบบนพื้นขาว = หัวส้มเดิม (คำทักทาย · อัปเดต · ปุ่มรีเฟรชตัวเดิม) จัดใหม่ ───── */
  #appPage .head {
    position: fixed;
    z-index: 80;
    top: 0;
    right: 0;
    left: var(--fd-side-w);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    column-gap: 0;
    box-sizing: border-box;
    min-height: var(--fd-top-h);
    margin: 0;
    padding: 10px var(--fd-gutter);
    overflow: visible;
    border-bottom: 1px solid #e7e5e4;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: #111;
  }

  #appPage .head h1,
  #appPage .head .logout,
  #appPage .head br {
    display: none;
  }

  #appPage .head .fd-top-title {
    display: block;
    grid-column: 1 / 3;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    color: #111;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  #appPage .head .welcome-text,
  #appPage .head .updated {
    grid-row: 2;
    margin: 2px 0 0;
    color: #78716c;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 400;
    opacity: 1;
    white-space: nowrap;
  }

  #appPage .head .welcome-text {
    grid-column: 1;
  }

  #appPage .head .updated {
    grid-column: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #appPage .head .updated::before {
    content: "\00a0·\00a0";
  }

  #appPage .head .refresh-btn {
    position: static;
    grid-column: 3;
    grid-row: 1 / 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 0;
    min-height: 40px;
    margin-left: 16px;
    padding: 0 16px;
    border: 1px solid #f3c6b4;
    border-radius: 12px;
    background: #fff;
    color: #eb5727;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
  }

  #appPage .head .refresh-btn:hover:not(:disabled) {
    background: #fff7f3;
  }

  #appPage .head .refresh-btn::before {
    content: "\21bb";
    font-size: 15px;
    font-weight: 700;
  }

  /* ───── C: (คำสั่ง 121 เอาออก) การ์ดงานจอคอม .fd-order-* / .fd-items-* — การ์ดแบบดูง่ายอยู่ใน production-board.css ───── */
}
