/* BreXus — Breakdown Nexus (สไตล์แอป /brexus) */
.bx-body { --bx-ink: #111; --bx-muted: #6b7280; --bx-line: #e5e7eb; --bx-soft: #f6f6f4; --bx-card: #fff; --bx-accent: #e11d48; --bx-cast: #c00000; }
.bx-root { font-family: "Noto Sans Thai", system-ui, sans-serif; color: var(--bx-ink); min-height: 70vh; padding-bottom: 48px; }
.bx-root .form-label { font-size: .78rem; font-weight: 600; color: #374151; margin-bottom: 2px; }
.bx-root .btn { border-radius: 8px; }
.bx-muted { color: var(--bx-muted); }
.bx-boot { display: flex; justify-content: center; padding: 80px 0; }

/* Logo / top bar */
.bx-logo { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; line-height: 0; }
.bx-logo img { height: 34px; width: auto; display: block; }
.bx-logo-lg { display: flex; justify-content: center; margin-bottom: 6px; }
.bx-logo-lg img { height: auto; width: 100%; max-width: 280px; }
.bx-top { background: #fff; border-bottom: 1px solid var(--bx-line); position: sticky; top: 0; z-index: 20; }
.bx-top-inner { max-width: 1320px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bx-top-sep { color: #c4c4c4; font-size: .8rem; }
.bx-top-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bx-top-tag { color: var(--bx-muted); font-size: .8rem; }
.bx-save { margin-left: auto; font-size: .78rem; color: var(--bx-muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }

/* Tabs (steps) */
.bx-tabs { background: #fff; border-bottom: 1px solid var(--bx-line); display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.bx-tabs::-webkit-scrollbar { display: none; }
.bx-tab { display: flex; align-items: center; gap: 6px; padding: 11px 12px; color: var(--bx-muted); text-decoration: none; font-size: .88rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.bx-tab:hover { color: var(--bx-ink); }
.bx-tab.active { color: var(--bx-ink); border-bottom-color: var(--bx-ink); font-weight: 600; }
.bx-tab-step { width: 18px; height: 18px; border-radius: 50%; background: #eee; font-size: .68rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.bx-tab.active .bx-tab-step { background: var(--bx-ink); color: #fff; }
.bx-subtabs { background: #fafafa; border-bottom: 1px solid var(--bx-line); display: flex; gap: 6px; padding: 7px 12px; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
.bx-subtabs::-webkit-scrollbar { display: none; }
.bx-subtab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-size: .82rem; color: var(--bx-muted); text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.bx-subtab:hover { color: var(--bx-ink); background: #fff; border-color: var(--bx-line); }
.bx-subtab.active { background: var(--bx-ink); color: #fff; font-weight: 600; }
.bx-tab-badge { background: #eee; border-radius: 10px; padding: 0 7px; font-size: .7rem; font-weight: 600; }
.bx-tab-badge.warn { background: #fde68a; color: #92400e; }
/* จัดกลางเมื่อแท็บพอดีจอ — ใช้ margin auto แทน justify-content:center เพื่อให้ยังเลื่อนไปแท็บแรกได้เมื่อแท็บล้นจอ */
@media (min-width: 1200px) { .bx-tabs > :first-child { margin-left: auto; } .bx-tabs > :last-child { margin-right: auto; } }

.bx-wrap { max-width: 1320px; margin: 0 auto; padding: 20px 16px; }
.bx-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bx-head p { margin: 2px 0 0; font-size: .85rem; }
.bx-h1 { font-size: 1.6rem; font-weight: 700; margin: 0; }
.bx-h2 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.bx-h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 8px; }
.bx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bx-card { background: var(--bx-card); border: 1px solid var(--bx-line); border-radius: 12px; padding: 16px; }
.bx-empty { text-align: center; padding: 56px 16px; color: var(--bx-muted); background: #fff; border: 1px dashed #d4d4d4; border-radius: 12px; }
.bx-empty i { font-size: 2.2rem; display: block; margin-bottom: 8px; color: #bdbdbd; }
.bx-alert { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 12px; flex-wrap: wrap; }
.bx-alert.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.bx-alert.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.bx-alert .btn-link { padding: 0 4px; font-size: .85rem; color: inherit; font-weight: 600; }

/* Gate */
.bx-gate { display: flex; justify-content: center; padding: 56px 16px; }
.bx-gate-card { background: #fff; border: 1px solid var(--bx-line); border-radius: 16px; padding: 32px 28px; max-width: 440px; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.bx-gate-sub { text-align: center; color: var(--bx-muted); margin: 4px 0 20px; }
.bx-gate-list { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; font-size: .92rem; }
.bx-gate-list i { color: var(--bx-accent); margin-right: 6px; }

/* Project cards */
.bx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.bx-pcard { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--bx-line); border-radius: 14px; padding: 18px; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.bx-pcard:hover { border-color: #111; transform: translateY(-2px); color: inherit; }
.bx-pcard-type { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bx-accent); font-weight: 700; }
.bx-pcard-title { font-size: 1.15rem; font-weight: 700; line-height: 1.35; word-break: break-word; }
.bx-pcard-stats { display: flex; gap: 14px; font-size: .85rem; color: #374151; margin-top: 8px; }
.bx-pcard-foot { margin-top: auto; padding-top: 10px; font-size: .75rem; color: var(--bx-muted); }

/* Info form */
.bx-contacts th { font-size: .78rem; color: var(--bx-muted); font-weight: 600; }
.bx-form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bx-line); }
.bx-danger { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: #fecaca; }

/* Toolbar / search */
.bx-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.bx-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.bx-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: .8rem; }
.bx-search .form-control { padding-left: 28px; }
.bx-search.px-2 i { left: 18px; }

/* Tables */
.bx-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--bx-line); border-radius: 12px; }
.bx-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.bx-table th { position: sticky; top: 0; background: #f3f4f6; font-weight: 600; font-size: .75rem; color: #374151; padding: 8px; border-bottom: 1px solid var(--bx-line); white-space: nowrap; text-align: left; }
.bx-table td { padding: 7px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.bx-table tbody tr:hover { background: #fafafa; }
.bx-table .c { text-align: center; }
.bx-table .wide { min-width: 280px; }
.bx-bd tbody tr { cursor: pointer; }
.bx-bd.wide td { min-width: 110px; }
.bx-bd.wide td.wide { min-width: 300px; }
.bx-col-handle { width: 26px; padding-right: 0 !important; }
.bx-col-act { width: 40px; }
.bx-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.bx-handle { cursor: grab; color: #a3a3a3; display: inline-flex; padding: 2px; touch-action: none; }
.bx-handle:hover { color: #111; }
.bx-ghost { opacity: .35; background: #fef3c7 !important; }
.bx-sno { display: inline-block; min-width: 28px; padding: 1px 7px; border-radius: 6px; background: #111; color: #fff; font-weight: 700; font-size: .78rem; text-align: center; }
.bx-used { color: #16a34a; margin-left: 4px; font-size: .8rem; }
.bx-ie { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: #eef2ff; color: #3730a3; }
.bx-ie-ext { background: #ecfdf5; color: #065f46; }
.bx-ie-intext, .bx-ie-extint { background: #fff7ed; color: #9a3412; }
.bx-chip { display: inline-block; background: #fef2f2; color: var(--bx-cast); border-radius: 20px; padding: 0 8px; margin: 1px 3px 1px 0; font-size: .75rem; white-space: nowrap; }
.bx-day-badge { display: inline-block; background: #e0f2fe; color: #075985; border-radius: 6px; padding: 0 6px; font-size: .72rem; margin: 1px 3px 1px 0; white-space: nowrap; font-weight: 600; }
.bx-day-badge.none { background: #fef3c7; color: #92400e; }

/* Stats */
.bx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.bx-stat { background: #fff; border: 1px solid var(--bx-line); border-radius: 12px; padding: 10px 14px; }
.bx-stat-v { font-size: 1.3rem; font-weight: 700; }
.bx-stat-l { font-size: .75rem; color: var(--bx-muted); }

/* Locations */
.bx-loc-index { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.bx-loc-pill { background: #fff; border: 1px solid var(--bx-line); border-radius: 20px; padding: 4px 12px; font-size: .82rem; color: inherit; text-decoration: none; }
.bx-loc-pill b { background: #111; color: #fff; border-radius: 10px; padding: 0 6px; font-size: .7rem; margin-left: 4px; }
.bx-loc { margin-bottom: 14px; padding: 0; overflow: hidden; scroll-margin-top: 70px; }
.bx-loc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 12px 16px; background: #fafafa; border-bottom: 1px solid var(--bx-line); }
.bx-loc .bx-table-wrap { border: 0; border-radius: 0; }

/* Scene editor modal */
.bx-modal .modal-content { font-family: "Noto Sans Thai", system-ui, sans-serif; border-radius: 14px; }
/* <form> ห่อ header/body/footer — ต้องเป็น flex column เองไม่งั้น modal-dialog-scrollable ไม่เลื่อนแค่ body (footer หลุดจอ) */
.bx-modal .modal-content > form { display: flex; flex-direction: column; min-height: 0; max-height: 100%; overflow: hidden; }
.bx-modal .modal-content > form > .modal-body { overflow-y: auto; }
.bx-modal .form-label { font-size: .78rem; font-weight: 600; color: #374151; margin-bottom: 2px; }
.bx-fs { border: 0; margin: 0 0 14px; padding: 0; }
.bx-fs legend { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bx-accent); margin-bottom: 6px; float: none; width: auto; }
.bx-cast-pick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.bx-chip-btn { border: 1px solid #fecaca; background: #fff; color: var(--bx-cast); border-radius: 20px; padding: 1px 10px; font-size: .78rem; }
.bx-chip-btn.on { background: var(--bx-cast); color: #fff; border-color: var(--bx-cast); }

/* One Line */
.bx-days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; }
.bx-day-tab { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--bx-line); border-radius: 10px; padding: 7px 12px 7px 6px; text-align: left; white-space: nowrap; color: inherit; }
.bx-day-tab span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.bx-day-tab small { color: var(--bx-muted); font-size: .72rem; }
.bx-day-tab.active { background: #111; color: #fff; border-color: #111; }
.bx-day-tab.active small, .bx-day-tab.active .bx-handle { color: #d4d4d4; }
.bx-ol { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 991.98px) { .bx-ol { grid-template-columns: 1fr; } }
.bx-day-form { padding: 12px 14px; margin-bottom: 10px; }
.bx-day-title { font-weight: 800; font-size: 1rem; padding-bottom: 6px; white-space: nowrap; }
.bx-ol-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bx-ol-list { display: flex; flex-direction: column; gap: 6px; min-height: 120px; padding-bottom: 40px; }
.bx-ol-empty { border: 2px dashed #d4d4d4; border-radius: 12px; padding: 36px 16px; text-align: center; color: var(--bx-muted); background: #fff; }
.bx-item { display: flex; align-items: flex-start; gap: 8px; background: #fff; border: 1px solid var(--bx-line); border-radius: 10px; padding: 8px 8px 8px 6px; position: relative; }
.bx-item .bx-handle { padding-top: 6px; }
.bx-item-del { padding: 2px 6px; margin-left: auto; }
.bx-scene { border-left: 4px solid #111; }
.bx-scene.blk-1 { border-left-color: #9ca3af; }
.bx-scene.blk-cont { margin-top: -4px; border-top-left-radius: 0; border-top-right-radius: 0; }
.bx-scene-time { flex: 0 0 auto; width: 200px; }
.bx-time { display: flex; align-items: center; gap: 2px; }
.bx-time .form-control { padding: 2px 4px; font-size: .8rem; min-width: 0; flex: 1 1 0; font-weight: 600; }
/* เวลาที่ระบบคำนวณให้ = ตัวเทา, ที่ผู้ใช้กำหนดเอง (ล็อก) = ตัวเข้ม + ไอคอนกุญแจ */
.bx-time .form-control.auto { color: #6b7280; font-weight: 400; background: #fafafa; }
.bx-unlock { padding: 0 4px; color: #b45309; font-size: .8rem; }
.bx-mins { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: .74rem; color: var(--bx-muted); }
.bx-mins .form-control { width: 52px; flex: 0 0 auto; padding: 1px 4px; font-size: .8rem; text-align: right; }
.bx-mins .bx-end-in { width: auto; flex: 1 1 0; min-width: 0; text-align: left; font-weight: 600; }
.bx-end-note { font-size: .72rem; color: var(--bx-muted); margin-top: 2px; }
.bx-end-note:empty { display: none; }
.bx-scene-main { flex: 1 1 auto; min-width: 0; font-size: .85rem; }
.bx-scene-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bx-scene-desc { margin-top: 3px; color: #374151; white-space: pre-line; }
.bx-scene-cast { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bx-scene-cast span { color: var(--bx-cast); font-size: .78rem; font-weight: 600; }
.bx-scene-cast span:not(:last-child)::after { content: ","; color: #d4d4d4; }
.bx-scene-dept { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: .76rem; color: var(--bx-muted); }
.bx-dup { background: #fee2e2; color: #b91c1c; border-radius: 6px; padding: 0 6px; font-size: .72rem; font-weight: 600; }
.bx-break { background: #3f3f3f; border-color: #3f3f3f; color: #fff; align-items: center; }
.bx-break.note { background: #e5e7eb; border-color: #d1d5db; color: #111; }
.bx-break .bx-handle { color: #bdbdbd; padding-top: 2px; }
.bx-break-time { width: 200px; flex: 0 0 auto; }
.bx-break .bx-time .form-control.auto { background: #555; color: #e5e5e5; border-color: #666; }
.bx-break .bx-mins, .bx-break .bx-end-note { color: #e5e5e5; }
.bx-break .bx-unlock { color: #fcd34d; }
.bx-break.note .bx-time .form-control.auto { background: #fafafa; color: #6b7280; border-color: #d1d5db; }
.bx-break.note .bx-mins, .bx-break.note .bx-end-note { color: #374151; }
.bx-break-text { flex: 1 1 auto; font-weight: 600; text-align: center; }
.bx-break-style { width: 104px; flex: 0 0 auto; font-size: .75rem; }
.bx-break .bx-item-del { color: #fca5a5 !important; }
.bx-break.note .bx-item-del { color: #dc2626 !important; }
@media (max-width: 575.98px) {
  .bx-item { flex-wrap: wrap; }
  .bx-scene-time, .bx-break-time { width: calc(100% - 70px); }
  .bx-scene-main { flex-basis: 100%; padding-left: 22px; }
  .bx-break-text { flex-basis: 100%; order: 5; }
}

/* Pool */
.bx-ol-pool { position: sticky; top: 64px; }
.bx-pool-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 10px 8px; flex-wrap: wrap; }
.bx-pool-list { max-height: calc(100vh - 260px); min-height: 120px; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 991.98px) { .bx-ol-pool { position: static; } .bx-pool-list { max-height: 420px; } }
.bx-pool-card { display: flex; gap: 6px; align-items: flex-start; border: 1px solid var(--bx-line); border-radius: 10px; padding: 7px 4px 7px 4px; background: #fff; font-size: .82rem; }
.bx-pool-card.used { background: #fafafa; }
.bx-pool-body { flex: 1 1 auto; min-width: 0; }
.bx-pool-add { padding: 0 4px; font-size: 1.1rem; color: #111; }
.bx-pool-foot { border-top: 1px solid var(--bx-line); padding: 8px 12px; }
/* การ์ดจาก pool ระหว่างลากเข้าลิสต์ */
.bx-ol-list .bx-pool-card { border-style: dashed; }

/* Scene picker (SweetAlert) */
.bx-picker-wrap { text-align: left !important; }
.bx-picker-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.bx-picker-tools .form-control { max-width: 300px; }
.bx-picker { max-height: 55vh; overflow-y: auto; border: 1px solid var(--bx-line); border-radius: 10px; font-size: .85rem; }
.bx-pk-gh { position: sticky; top: 0; background: #f3f4f6; padding: 6px 10px; font-weight: 700; z-index: 1; }
.bx-pk-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.bx-pk-row.used { background: #fffbeb; }
.bx-pk-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Shooting + Shot List */
.bx-ss-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 12px; }
.bx-ss-list { display: flex; flex-direction: column; gap: 10px; }
.bx-ss-block { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
.bx-ss-time { font-weight: 700; font-size: .85rem; padding-top: 12px; text-align: right; color: #374151; }
.bx-ss-scenes { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bx-ss-scene { padding: 10px 12px; }
.bx-ss-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bx-ss-desc { font-size: .84rem; color: #374151; margin: 4px 0 6px; }
.bx-ss-count { font-size: .78rem; font-weight: 700; background: #e0f2fe; color: #075985; border-radius: 99px; padding: 2px 10px; }
.bx-ss-shots { font-size: .8rem; margin-top: 4px; }
.bx-ss-shots .bx-handle { cursor: grab; color: #9ca3af; padding-right: 0; }
.bx-ss-shots th { font-size: .7rem; color: #6b7280; white-space: nowrap; }
.bx-ss-shots tr:not(.on) td { color: #9ca3af; }
.bx-ss-shots tr.on td { background: #f0fdf4; }
.bx-ss-split { font-size: .78rem; background: #eef2ff; color: #3730a3; border-radius: 8px; padding: 3px 10px; margin-top: 6px; display: inline-block; }
.bx-ss-other { display: inline-block; font-size: .7rem; background: #fef3c7; color: #92400e; border-radius: 99px; padding: 0 7px; margin-left: 4px; }
.bx-ss-brk { background: #434343; color: #fff; text-align: center; font-weight: 700; border-radius: 8px; padding: 6px; margin-left: 106px; }
/* มือถือ: ช่วงเวลาอยู่บนการ์ด, หัวซีนตัดบรรทัด, ช็อตแต่ละแถวเป็นการ์ดเล็ก (CUT + SHOT TYPE / คำอธิบาย / ป้าย ANGLE · MOVEMENT · EQUIPMENT) */
@media (max-width: 767.98px) {
  .bx-ss-block { grid-template-columns: 1fr; gap: 4px; }
  .bx-ss-time { text-align: left; padding: 0 2px; font-size: .8rem; color: #6b7280; }
  .bx-ss-brk { margin-left: 0; }
  .bx-ss-bar { padding: 10px 12px; }
  .bx-ss-bar > .d-flex { width: 100%; }
  .bx-ss-bar > .d-flex .btn { flex: 1 1 0; }
  .bx-ss-scene { padding: 10px; }
  .bx-ss-head .bx-ss-count { order: 10; margin-left: 0 !important; }
  .bx-ss-head .btn-group { order: 11; margin-left: auto; }
  .bx-ss-shots, .bx-ss-shots tbody { display: block; width: 100%; }
  .bx-ss-shots thead { display: none; }
  .bx-ss-shots tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; position: relative; padding: 8px 8px 8px 62px; margin-top: 6px; border: 1px solid var(--bx-line); border-radius: 10px; min-height: 48px; }
  .bx-ss-shots tbody tr.on { border-color: #bbf7d0; background: #f0fdf4; }
  .bx-ss-shots tbody td { display: block; border: 0; padding: 0; background: transparent !important; }
  .bx-ss-shots tbody td:nth-child(1) { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); }
  .bx-ss-shots tbody td:nth-child(2) { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); }
  .bx-ss-shots tbody td:nth-child(2) .form-check-input { width: 1.25em; height: 1.25em; margin: 0; }
  .bx-ss-shots tbody td:nth-child(3) { font-size: .95rem; }
  .bx-ss-shots tbody td:nth-child(3)::before { content: 'CUT '; font-size: .68rem; font-weight: 700; color: #6b7280; }
  .bx-ss-shots tbody td:nth-child(4) { font-weight: 700; }
  .bx-ss-shots tbody td:nth-child(5) { flex: 1 0 100%; font-size: .85rem; }
  .bx-ss-shots tbody td:nth-child(n+6):not(:empty) { font-size: .72rem; background: #f3f4f6 !important; color: #374151; border-radius: 99px; padding: 1px 8px; }
  .bx-ss-shots tbody tr:not(.on) td:nth-child(n+6):not(:empty) { color: #9ca3af; }
}

/* Shot List */
.bx-sl { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.bx-sl-scenes { position: sticky; top: 12px; padding: 12px; }
.bx-sl-list { max-height: calc(100vh - 260px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.bx-sl-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--bx-line); border-radius: 10px; padding: 6px 8px; color: inherit; }
.bx-sl-item:hover { border-color: #9ca3af; }
.bx-sl-item.active { background: #111; color: #fff; border-color: #111; }
.bx-sl-item.active small { color: #d4d4d4; }
.bx-sl-item[hidden] { display: none; }
.bx-sl-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; font-size: .82rem; }
.bx-sl-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-sl-name small { color: var(--bx-muted); font-size: .72rem; }
.bx-sl-count { min-width: 24px; text-align: center; border-radius: 99px; background: #e0f2fe; color: #075985; font-weight: 700; font-size: .75rem; padding: 1px 6px; }
.bx-sl-count.zero { background: #f3f4f6; color: #9ca3af; }
.bx-sl-main { padding: 14px; min-width: 0; }
.bx-sl-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--bx-line); padding-bottom: 10px; margin-bottom: 10px; }
.bx-sl-title { font-weight: 800; font-size: 1.15rem; }
.bx-sl-title span { font-weight: 600; font-size: .95rem; margin-left: 6px; }
.bx-sl-desc { font-size: .85rem; margin-top: 4px; max-width: 720px; }
/* ช็อต: ตารางแบบ spreadsheet (คล้าย phpMyAdmin) — เส้นตารางชัด ทุกช่องสูงเท่ากัน จอเล็กเลื่อนซ้ายขวา คอลัมน์ CUT ค้างไว้ */
.bx-grid-wrap { overflow-x: auto; overflow-y: hidden; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.bx-shotgrid { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .86rem; }
.bx-shotgrid th { background: #f3f4f6; color: #374151; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  text-align: left; padding: 8px 8px; border-bottom: 1px solid #d1d5db; border-right: 1px solid #e5e7eb; white-space: nowrap; }
.bx-shotgrid td { padding: 0; height: 36px; border-bottom: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb; background: #fff; vertical-align: middle; }
.bx-shotgrid th:last-child, .bx-shotgrid td:last-child { border-right: 0; }
.bx-shotgrid tbody tr:last-child td { border-bottom: 0; }
.bx-shotgrid tbody tr:nth-child(even) td { background: #fafafa; }
.bx-shotgrid tbody tr:hover td { background: #f1f5f9; }
.bx-g-in { display: block; width: 100%; height: 36px; border: 0; outline: 0; background: transparent; padding: 0 8px; font: inherit; color: inherit; text-overflow: ellipsis; }
.bx-g-in::placeholder { color: #c0c4cc; }
.bx-g-in:focus { background: #fff; box-shadow: inset 0 0 0 2px #2563eb; border-radius: 2px; }
.bx-g-in.c { text-align: center; } .bx-g-in.b { font-weight: 800; }
.bx-g-in:disabled { background: transparent; color: inherit; }
.bx-g-h { text-align: center; }
.bx-shotgrid .bx-handle { display: inline-flex; height: 36px; align-items: center; cursor: grab; color: #9ca3af; }
.bx-g-act { text-align: center; white-space: nowrap; }
.bx-g-act button { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 6px; color: #6b7280; }
.bx-g-act button:hover { background: #e5e7eb; color: #111; }
.bx-g-act button.del:hover { background: #fee2e2; color: #b91c1c; }
/* คอลัมน์ ⋮ + CUT ค้างซ้ายเมื่อเลื่อนตารางบนจอเล็ก */
.bx-shotgrid th:nth-child(1), .bx-shotgrid td:nth-child(1) { position: sticky; left: 0; z-index: 1; }
.bx-shotgrid th:nth-child(2), .bx-shotgrid td:nth-child(2) { position: sticky; left: 30px; z-index: 1; box-shadow: 1px 0 0 #d1d5db; }
.bx-shotgrid th:nth-child(1), .bx-shotgrid th:nth-child(2) { z-index: 3; }
.bx-ghost td { background: #e0f2fe !important; }
.bx-sl-addbtn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; padding: 11px; border: 1.5px dashed #cbd5e1; border-radius: 10px; background: #fff; color: #334155; font-weight: 600; }
.bx-sl-addbtn:hover { border-color: #111; color: #111; background: #fafafa; }
.bx-sl-mpick { display: none; gap: 6px; margin-bottom: 12px; }
.bx-sl-mpick .form-select { min-width: 0; }
@media (max-width: 991.98px) { .bx-sl-mpick { display: flex; } }
@media (max-width: 575.98px) {
  .bx-g-in { font-size: 16px; } /* กัน iOS ซูมเข้าเมื่อแตะช่อง */
  .bx-sl-main { padding: 10px; }
}
@media (max-width: 991.98px) { .bx-sl { grid-template-columns: 1fr; } .bx-sl-scenes { display: none; } }

/* AI ช่วยกรอก Breakdown */
.bx-ai-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.bx-ai-how > div { border: 1px solid var(--bx-line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }
.bx-ai-how i { font-size: 1.3rem; }
.bx-ai-how span { color: var(--bx-muted); }
.bx-ai-bal { margin-top: 10px; }
.bx-ai-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.bx-ai-tile { border: 1px solid var(--bx-line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; line-height: 1.3; }
.bx-ai-tile b { font-size: 1.25rem; }
.bx-ai-tile span { font-size: .78rem; color: #374151; }
.bx-ai-tile small { font-size: .7rem; color: var(--bx-muted); }
.bx-ai-tile.low { border-color: #fecaca; background: #fef2f2; }
.bx-ai-tile.low b { color: #b91c1c; }
.bx-ai-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: #fff; border: 1px solid var(--bx-line); border-radius: 12px; padding: 8px 10px 8px 14px; font-size: .88rem; }
.bx-ai-bar > .bi-stars { color: #7c3aed; }
.bx-ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.bx-ai-dot.on { background: #22c55e; }
.bx-ai-card-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.bx-flash { animation: bxFlash 1.6s ease-out; }
@keyframes bxFlash { 0% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .45); } 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); } }
.bx-ai-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 6px 10px; font-size: .88rem; }
.bx-ai-info { border: 1px dashed var(--bx-line); border-radius: 10px; padding: 12px; min-height: 100%; }
.bx-ai-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.bx-ai-stats b { display: block; font-size: 1.15rem; }
.bx-ai-stats span { font-size: .75rem; color: var(--bx-muted); }
.bx-ai-pre { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: .78rem; background: #f8f9fa; border-radius: 8px; padding: 8px; margin: 6px 0 0; }
.bx-ai-table { max-height: 50vh; overflow: auto; border: 1px solid var(--bx-line); border-radius: 10px; }
.bx-ai-table table { font-size: .8rem; }
.bx-ai-table thead th { position: sticky; top: 0; background: #f3f4f6; z-index: 1; white-space: nowrap; }
.bx-ai-table .pre { white-space: pre-line; }
.bx-ai-table .bx-ai-wide { min-width: 220px; }
@media (max-width: 575.98px) { .bx-ai-stats { grid-template-columns: repeat(2, 1fr); } }

/* Call Sheet */
.bx-cx { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.bx-cx-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
.bx-cx-src ul { padding-left: 18px; font-size: .85rem; margin-bottom: 12px; }
.bx-cx-src li { margin-bottom: 4px; }
.bx-cx-paper { position: relative; overflow: hidden; background: #e5e7eb; border: 1px solid var(--bx-line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.08); min-height: 300px; }
.bx-cx-paper iframe { position: absolute; top: 0; left: 0; width: 794px; border: 0; transform-origin: 0 0; pointer-events: none; }
@media (max-width: 991.98px) { .bx-cx { grid-template-columns: 1fr; } .bx-cx-side { position: static; } }

/* ป้าย PageCount */
.bx-pg { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: 0 0 auto; min-width: 50px; padding: 4px 6px; border-radius: 8px; background: #fff7d6; border: 1px solid #f0d27a; color: #6b4b00; line-height: 1; white-space: nowrap; }
.bx-pg b { font-size: .95rem; font-weight: 800; }
.bx-pg small { font-size: .65rem; font-weight: 600; }
.bx-pg-bar { display: flex; gap: 1px; }
.bx-pg-bar i { width: 4px; height: 5px; border-radius: 1px; background: #eadba9; }
.bx-pg-bar i.on { background: #c48a00; }
.bx-pg.full { background: #ffe9a8; border-color: #e0b443; }
.bx-pg.empty { background: #f3f4f6; border-color: #e5e7eb; color: #9ca3af; }
.bx-pg.inline { flex-direction: row; gap: 5px; min-width: 0; padding: 2px 7px; border-radius: 999px; }
.bx-pg.inline b { font-size: .85rem; }
.bx-pool-card > .bx-pg { align-self: center; }
.bx-pk-row .bx-pg { align-self: center; }
.bx-pk-sum { margin-left: auto; font-size: .85rem; color: #6b4b00; background: #fff7d6; border: 1px solid #f0d27a; border-radius: 999px; padding: 3px 12px; white-space: nowrap; }

/* Export */
.bx-export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.bx-export { display: flex; flex-direction: column; }
.bx-export .d-flex { margin-top: auto; }
.bx-export-ico { width: 40px; height: 40px; border-radius: 10px; background: #111; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 10px; }
.bx-export-all { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Cast List */
.bx-cast-table .bx-handle { margin-right: 2px; }
.bx-cast-no { font-weight: 700; font-size: .8rem; }
.bx-roles:empty { display: none; }
.bx-multi-role { display: inline-block; margin-top: 3px; font-size: .72rem; color: #7c2d12; background: #ffedd5; border-radius: 6px; padding: 0 6px; }
.bx-chip b { font-size: .65rem; opacity: .7; }
.bx-chip-btn b { font-size: .68rem; opacity: .75; }
.bx-chip-btn small { display: block; font-size: .65rem; line-height: 1.1; opacity: .8; }
.bx-chip-btn.off-list { border-style: dashed; color: #6b7280; border-color: #d1d5db; }
.bx-chip-btn.off-list.on { background: #6b7280; border-color: #6b7280; color: #fff; }
.bx-cast-warn { margin-top: 6px; font-size: .8rem; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 5px 9px; }
.bx-scene-cast small { color: var(--bx-muted); font-weight: 400; }
.bx-scene-cast em { font-style: normal; }
.bx-scene-cast em::after, .bx-scene-cast span:last-of-type::after { content: none !important; }
.bx-day-actors { margin: -2px 0 8px; }
.bx-day-actors:empty { display: none; }

/* Collaborators — สิทธิ์: ซ่อนปุ่มแก้ไขในหน้าที่ดูได้อย่างเดียว / ปุ่มลบสำหรับคนที่ไม่ใช่เจ้าของ */
.bx-ro [data-edit], .bx-ro .bx-handle, .bx-not-owner .bx-owner-only, .bx-no-export .bx-need-export { display: none !important; }
.bx-ro .bx-bd tbody tr { cursor: zoom-in; }
.bx-shared-bar { max-width: 1320px; margin: 0 auto; padding: 8px 16px 0; font-size: .82rem; color: #374151; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bx-ro-tag { background: #e5e7eb; border-radius: 6px; padding: 1px 8px; font-weight: 600; }
.bx-ed-tag { background: #dcfce7; color: #166534; border-radius: 6px; padding: 1px 8px; font-weight: 600; }
.bx-invites { display: grid; gap: 8px; margin-bottom: 18px; }
.bx-invite { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-color: #fde68a; background: #fffbeb; padding: 12px 16px; }
.bx-pcard.shared { border-style: dashed; }
.bx-owner-tag { color: #6b7280; text-transform: none; letter-spacing: 0; font-weight: 600; }
.bx-share { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 991.98px) { .bx-share { grid-template-columns: 1fr; } }
.bx-lookup { min-height: 22px; margin-top: 5px; font-size: .82rem; }
.bx-look-ok { color: #166534; }
.bx-look-bad { color: #b91c1c; font-weight: 600; }
.bx-perm th { font-size: .75rem; color: #6b7280; font-weight: 600; }
.bx-perm td { font-size: .85rem; }
.bx-member { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bx-line); }
.bx-member:last-child { border-bottom: 0; }
.bx-member-main { min-width: 0; }
.bx-member-act { display: flex; gap: 6px; flex: 0 0 auto; }

/* แจ้งเตือนการแก้ไขจากผู้ร่วมงาน (ลอยมุมล่างซ้าย) */
.bx-remote { position: fixed; left: 16px; bottom: 16px; z-index: 1080; max-width: min(420px, calc(100vw - 32px)); display: flex; gap: 10px; background: #fff; border: 1px solid #fcd34d; border-left: 4px solid #f59e0b; border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.12); font-family: "Noto Sans Thai", system-ui, sans-serif; }
.bx-remote-ico { color: #f59e0b; font-size: 1.1rem; }
.bx-remote-body { min-width: 0; }

.bx-legal { margin-top: 18px; font-size: .78rem; color: var(--bx-muted); }
.bx-legal a { color: inherit; text-decoration: underline; }

/* หน้าต่างอธิบายรูปแบบไฟล์ก่อนนำเข้า */
.bx-import-guide { text-align: left; font-size: .86rem; }
.bx-import-table { max-height: 46vh; overflow: auto; border: 1px solid var(--bx-line); border-radius: 8px; margin: 8px 0; }
.bx-import-table table { margin: 0; font-size: .8rem; }
.bx-import-table th { position: sticky; top: 0; background: #f3f4f6; }
.bx-import-table code { color: #111; font-weight: 700; }

/* Coming soon */
.bx-tab-badge.soon { background: #e0e7ff; color: #3730a3; text-transform: uppercase; letter-spacing: .03em; font-size: .62rem; }
.bx-soon { text-align: center; padding: 56px 16px; background: #fff; border: 1px dashed #c7d2fe; border-radius: 14px; }
.bx-soon-ico { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px; background: #111; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.bx-soon-tag { display: inline-block; background: #e11d48; color: #fff; font-weight: 700; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; border-radius: 20px; padding: 3px 12px; }

/* เวลา Call ทีมงาน (ฟอร์มหัวคิว) */
.bx-calls { margin-top: 10px; border-top: 1px solid var(--bx-line); padding-top: 8px; }
.bx-calls summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.bx-call-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 6px 14px; margin-top: 8px; }
.bx-call-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 4px; align-items: center; padding: 3px; border-radius: 8px; }
.bx-call-row.bold [data-ct=label], .bx-call-row.bold [data-ct=time] { font-weight: 700; }
.bx-call-row.meal { background: #eeefda; }
@media (max-width: 575.98px) { .bx-call-rows { grid-template-columns: 1fr; } }

.bx-schema-warn { margin: 8px 0; padding: 7px 10px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: .82rem; }
.bx-schema-warn code { color: inherit; font-weight: 700; }

/* Call Sheet ท้ายกระดาษ (ฟอร์ม) */
.bx-cs-h { font-size: .85rem; font-weight: 700; margin: 8px 0 4px; }
.bx-cs-table th { font-size: .72rem; color: var(--bx-muted); font-weight: 600; white-space: nowrap; }
.bx-cs-table td { font-size: .85rem; }
.bx-cs-table input[type=time] { min-width: 96px; }
.bx-onset { font-weight: 700; white-space: nowrap; }
.bx-ex-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 34px; gap: 4px; margin-bottom: 4px; max-width: 560px; }
.bx-cs-auto { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: .8rem; background: #f8faf6; border: 1px solid #e2efda; border-radius: 8px; padding: 8px 10px; white-space: pre-line; }
.bx-cs-qr { border: 1px dashed var(--bx-line); border-radius: 10px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; }
.bx-cs-qr img { width: 110px; height: 110px; image-rendering: pixelated; }
@media (max-width: 575.98px) { .bx-cs-auto { grid-template-columns: 1fr; } }
.bx-cs-table input.auto { color: #9ca3af; background: #fafafa; }
/* มือถือ: ตาราง Call Sheet ท้ายกระดาษ → การ์ดรายแถว (ชื่อด้านบน, ช่องเวลาเรียง 2 คอลัมน์, Remark เต็มแถว) */
@media (max-width: 767.98px) {
  .bx-cs-table, .bx-cs-table tbody, .bx-cs-table tfoot { display: block; width: 100%; }
  .bx-cs-table thead { display: none; }
  .bx-cs-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; border: 1px solid var(--bx-line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
  .bx-cs-table tbody td { display: block; border: 0; padding: 0; min-width: 0; font-size: .9rem; text-align: left !important; }
  .bx-cs-table tbody td::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 700; letter-spacing: .03em; color: var(--bx-muted); margin-bottom: 3px; }
  .bx-cs-table tbody td:first-child { grid-column: 1 / -1; font-size: 1rem; padding-bottom: 6px; border-bottom: 1px dashed var(--bx-line); }
  .bx-cs-table tbody td:first-child::before { display: none; }
  .bx-cs-table tbody td.wide { grid-column: 1 / -1; }
  .bx-cs-table tbody td.bx-onset { font-weight: 700; }
  .bx-cs-table input[type=time] { min-width: 0; width: 100%; }
  .bx-cs-table .form-control { font-size: 16px; } /* กัน iOS ซูมเข้าเมื่อแตะช่อง */
  .bx-cs-table tfoot tr, .bx-cs-table tfoot th { display: block; border: 0; padding: 4px 2px; }
}
.bx-pv .modal-content { border-radius: 0; }
.bx-pv .modal-body { position: relative; background: #e5e7eb; overflow: hidden; }
.bx-pv iframe { display: block; width: 100%; height: 100%; border: 0; }
.bx-pv-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #374151; }
.bx-pv-load[hidden] { display: none; }
.bx-sun-edit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; font-size: .8rem; font-weight: 700; color: #92400e; }
.bx-sun-edit input { width: 108px; flex: 0 0 auto; background: #fffbeb; }
