/* admin/css/webtoon-factory.css — หน้าโรงงานเว็บตูนธรรมบท (/admin/webtoon-factory.php) · สีตาม design.md (ชุดเดียวกับโรงงานการ์ตูน) */
[v-cloak] { display: none; }
.wf { --ind: #4f46e5; --ind-d: #312e81; --ind-s: #eef2ff; --pan: #3f7d51; --pan-s: #e9f5eb; --cus: #f5bf45; --cus-s: #fff6d8;
	--org: #c2410c; --org-s: #fff1e6; --err: #e11d48; --err-s: #fff1f2; --ink: #172033; --mut: #566174; --line: #e2e8f0; --paper: #fffdf8;
	color: var(--ink); max-width: 1180px; margin: 0 auto; }
.wf-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.wf-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: .78rem; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.wf-st-review { background: var(--cus-s); color: #8a5a00; border-color: #f3d27a; }
.wf-st-working { background: var(--ind-s); color: var(--ind-d); border-color: #c7d2fe; }
.wf-st-working i.fa-gear, .wf-st-working i.fa-gears { animation: wf-spin 2.4s linear infinite; }
.wf-st-stuck { background: var(--err-s); color: #9f1239; border-color: #fecdd3; }
.wf-st-queued { background: #f1f5f9; color: var(--mut); border-color: var(--line); }
.wf-st-done { background: var(--pan-s); color: var(--pan); border-color: #b9dcc2; }
.wf-st-approved { background: #ecfdf5; color: #065f46; border: 1px dashed #34d399; }
.wf-st-skipped { background: #f8fafc; color: #94a3b8; border: 1px dashed #cbd5e1; }
.wf-st-fixing { background: var(--org-s); color: #9a3412; border-color: #fdba74; }
@keyframes wf-spin { to { transform: rotate(360deg); } }
.wf-stat b { display: block; font-size: 1.75rem; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.wf-stat span { font-size: .8rem; color: var(--mut); font-weight: 600; }
.wf-bar { height: 10px; border-radius: 999px; background: #eef1f6; overflow: hidden; display: flex; }
.wf-bar i { display: block; height: 100%; transition: width .4s; }
.wf-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: .85rem; font-weight: 700; color: var(--mut); cursor: pointer; white-space: nowrap; }
.wf-chip.on { background: var(--ind); border-color: var(--ind); color: #fff; }
.wf-chip .n { font-weight: 800; opacity: .75; margin-left: 4px; }
.wf-tab { padding: 10px 4px; font-weight: 800; color: var(--mut); border-bottom: 3px solid transparent; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.wf-tab.on { color: var(--ind); border-color: var(--ind); }
.wf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--err); display: inline-block; }
.wf-btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 12px; padding: 9px 15px; font-weight: 800; font-size: .88rem; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.wf-btn[disabled] { opacity: .45; cursor: default; }
.wf-btn-pri { background: var(--ind); color: #fff; }
.wf-btn-pri:not([disabled]):hover { background: #4338ca; }
.wf-btn-ok { background: var(--pan); color: #fff; }
.wf-btn-ok:not([disabled]):hover { filter: brightness(1.08); }
.wf-btn-soft { background: #fff; border-color: var(--line); color: var(--ink); }
.wf-btn-soft:not([disabled]):hover { border-color: #c7d2fe; color: var(--ind); }
.wf-btn-fix { background: var(--org-s); color: #9a3412; border-color: #fdba74; }
.wf-btn-fix:not([disabled]):hover { background: #ffe4cc; }
.wf-btn-fixon { background: var(--org); color: #fff; border-color: var(--org); }
.wf-btn-okoff { background: #f1f5f9; color: #64748b; border-color: var(--line); }
.wf-btn-okoff:hover { color: var(--pan); border-color: #b9dcc2; }
.wf-btn-okon { background: #1f6b3a; color: #fff; border-color: #1f6b3a; }

/* รายการเล่ม */
.wf-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: start; padding: 13px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.wf-row:first-child { border-top: 0; }
.wf-row:hover { background: #fafbff; }
.wf-q { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .95rem; background: #f1f5f9; color: var(--mut); }
.wf-q.q-published { background: var(--pan-s); color: var(--pan); }
.wf-q.q-working, .wf-q.q-ai_review { background: var(--ind); color: #fff; }
.wf-q.q-review, .wf-q.q-waiting { background: var(--cus); color: #4a3200; }
.wf-q.q-fixing { background: var(--org-s); color: #9a3412; }
.wf-q.q-stuck { background: var(--err-s); color: #9f1239; }
.wf-q.q-approved, .wf-q.q-publishing { background: #d1fae5; color: #065f46; }
.wf-title { font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.wf-sub { font-size: .8rem; color: var(--mut); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.wf-tag { background: #f1f5f9; color: var(--mut); border-radius: 6px; padding: 1px 7px; font-size: .72rem; font-weight: 800; display: inline-flex; gap: 4px; align-items: center; }
.wf-tag-ok { background: var(--pan-s); color: var(--pan); }
.wf-tag-warn { background: var(--cus-s); color: #8a5a00; }
.wf-steps { display: flex; gap: 3px; max-width: 360px; }
.wf-steps span { flex: 1; height: 5px; border-radius: 3px; background: #e5e9f0; }
.wf-steps span.done { background: #3f7d51; }
.wf-steps span.now { background: var(--ind); animation: wf-pulse 1.6s ease-in-out infinite; }
.wf-steps span.bad { background: var(--err); }
@keyframes wf-pulse { 50% { opacity: .45; } }

/* แผงเล่ม */
.wf-drawer-bg { position: fixed; inset: 0; background: rgba(16, 39, 95, .35); z-index: 60; }
.wf-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: #f8fafc; z-index: 61; display: flex; flex-direction: column; box-shadow: -18px 0 40px rgba(16, 39, 95, .18); }
.wf-drawer-h { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.wf-drawer-b { flex: 1; overflow-y: auto; padding: 14px 16px 8px; }
.wf-pipe { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.wf-pstep { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.wf-pstep i { width: 100%; height: 6px; border-radius: 3px; background: #e5e9f0; display: block; }
.wf-pstep span { font-size: .66rem; font-weight: 700; color: #94a3b8; line-height: 1.2; }
.wf-pstep.done i { background: #3f7d51; } .wf-pstep.done span { color: var(--pan); }
.wf-pstep.now i { background: var(--ind); animation: wf-pulse 1.6s ease-in-out infinite; } .wf-pstep.now span { color: var(--ind-d); font-weight: 800; }
.wf-pstep.bad i { background: var(--err); } .wf-pstep.bad span { color: #9f1239; font-weight: 800; }
.wf-statusline { background: var(--paper); border: 1px solid #efe6cf; border-radius: 10px; padding: 8px 11px; font-size: .88rem; color: #4b4130; line-height: 1.5; }
.wf-scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.wf-scene { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; font-size: .8rem; display: flex; flex-wrap: wrap; justify-content: space-between; }
.wf-scene .wf-bar { flex-basis: 100%; }
.wf-scene span { color: var(--mut); font-weight: 700; }
.wf-scene.done { background: var(--pan-s); border-color: #b9dcc2; }
.wf-gate { font-size: .74rem; font-weight: 800; border-radius: 999px; padding: 2px 9px; }
.wf-gate.ok { background: var(--pan-s); color: var(--pan); }
.wf-gate.bad { background: var(--err-s); color: #9f1239; }
.wf-sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.wf-sheet { margin: 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #f6f1e4; }
.wf-sheet img { display: block; width: 100%; height: auto; }
.wf-sheet figcaption { background: #fff; padding: 8px 10px; }
.wf-sheet.is-pending { border-color: var(--cus); }
.wf-sheet.is-approved { border-color: var(--pan); }
.wf-sheet.is-rejected { border-color: #fdba74; }
.wf-ai { border-radius: 12px; padding: 10px 12px; }
.wf-ai.clean { background: var(--pan-s); color: #24563a; }
.wf-ai.has { background: var(--ind-s); color: var(--ind-d); }
.wf-sev { font-size: .7rem; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.wf-sev.sev-high { background: #fee2e2; color: #991b1b; }
.wf-sev.sev-mid { background: #ffedd5; color: #9a3412; }
.wf-sev.sev-low { background: #f1f5f9; color: #475569; }
.wf-thread { display: flex; flex-direction: column; gap: 10px; }
.wf-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: .95rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.wf-msg.owner { align-self: flex-end; background: var(--ind); color: #fff; border-bottom-right-radius: 5px; }
.wf-msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.wf-msg.system { align-self: center; background: transparent; color: var(--mut); font-size: .8rem; text-align: center; padding: 2px 8px; }
.wf-msg .meta { display: block; font-size: .7rem; opacity: .7; margin-bottom: 2px; font-weight: 700; }
.wf-at { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin-bottom: 4px; cursor: pointer; background: var(--ind-s); color: var(--ind-d); }
.wf-msg.owner .wf-at { background: rgba(255, 255, 255, .22); color: #fff; }
.wf-attach { max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.wf-compose { background: #fff; border-top: 1px solid var(--line); padding: 10px 12px; }
.wf-compose textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none; font-size: 16px; line-height: 1.5; min-height: 48px; max-height: 160px; }
.wf-compose textarea:focus, .wf-note:focus { outline: 2px solid #c7d2fe; border-color: var(--ind); }
.wf-chatbox { height: calc(100vh - 330px); min-height: 420px; display: flex; flex-direction: column; overflow: hidden; }

/* ต้นทุน */
.wf-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.wf-table th { font-size: .74rem; color: var(--mut); font-weight: 800; padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.wf-table td { padding: 8px 12px; border-top: 1px solid #f1f5f9; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wf-table td:first-child, .wf-table th:first-child { text-align: left; white-space: normal; }
.wf-tr-story td { font-weight: 800; background: #f8fafc; }
.wf-days { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.wf-dcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.wf-dcol i { display: block; width: 100%; min-height: 2px; background: #818cf8; border-radius: 4px 4px 0 0; }
.wf-dcol span { font-size: .68rem; color: #94a3b8; font-weight: 700; }

/* ตรวจทีละหน้า */
.wf-reader { position: fixed; inset: 0; z-index: 70; background: #1e2433; display: flex; flex-direction: column; }
.wf-rbar { display: flex; align-items: center; gap: 10px; background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.wf-rbody { flex: 1; display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
.wf-rpage { overflow-y: auto; position: relative; padding: 16px; outline: none; overscroll-behavior: contain; }
.wf-rstrip { width: min(100%, 820px); margin: 0 auto; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.wf-rp { position: relative; aspect-ratio: 800 / 1131; }
.wf-rp img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.wf-rp-tag { position: absolute; top: 8px; right: calc(100% + 10px); min-width: 40px; height: 26px; padding: 0 8px; border-radius: 999px; display: inline-flex;
	align-items: center; justify-content: center; gap: 4px; font-size: .78rem; font-weight: 800; cursor: pointer; z-index: 1;
	background: rgba(255, 255, 255, .1); color: #cbd5e1; border: 1px solid rgba(255, 255, 255, .16); }
.wf-rp-tag i { font-size: .68rem; }
.wf-rp-tag.ai::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a5b4fc; }
.wf-rp-tag.m-ok { background: #1f6b3a; border-color: #1f6b3a; color: #fff; }
.wf-rp-tag.m-fix { background: var(--org); border-color: var(--org); color: #fff; }
.wf-rp-tag.on { outline: 3px solid #818cf8; outline-offset: 1px; color: #fff; }
.wf-rside { background: #f8fafc; overflow-y: auto; padding: 14px; border-left: 1px solid #0f172a; }
.wf-note { width: 100%; border: 1px solid #fdba74; border-radius: 10px; padding: 8px 10px; font-size: 15px; line-height: 1.5; resize: vertical; background: #fff; }
.wf-find { border: 1px solid var(--line); border-left-width: 1px; border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; background: #fff; }
.wf-find.sev-high { border-color: #fca5a5; }
.wf-find.is-agree { background: var(--org-s); }
.wf-find.is-dismiss { opacity: .55; }
.wf-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; }
.wf-thumb { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: .78rem; font-weight: 800; color: var(--mut); cursor: pointer; position: relative; }
.wf-thumb.m-ok { background: var(--pan-s); color: var(--pan); border-color: #b9dcc2; }
.wf-thumb.m-fix { background: var(--org); color: #fff; border-color: var(--org); }
.wf-thumb.ai::after { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--ind); }
.wf-thumb.on { outline: 3px solid var(--ind); outline-offset: 1px; }
/* ดูภาพใหญ่ */
.wf-zoomable { display: block; position: relative; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; }
.wf-zoomable.block { width: auto; }
.wf-zoom-hint { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; background: rgba(15, 23, 42, .72); color: #fff;
	font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 3px 9px; opacity: .85; transition: opacity .15s; pointer-events: none; }
.wf-zoomable:hover .wf-zoom-hint { opacity: 1; }
.wf-zoomable:hover img { filter: brightness(1.04); }
.wf-lb { position: fixed; inset: 0; z-index: 80; background: rgba(9, 13, 26, .95); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; flex-direction: column; color: #fff; }
.wf-lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #090d1a; }
.wf-lb-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.05rem; }
.wf-lb-btn:hover { background: rgba(255, 255, 255, .2); }
.wf-lb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 8px 64px 16px; overflow: hidden; }
.wf-lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; -webkit-user-drag: none; background: #fff;
	box-shadow: 0 14px 40px rgba(0, 0, 0, .5); border-radius: 4px; }
.wf-lb-stage.zoom { display: block; overflow: auto; padding: 0; }
.wf-lb-stage.zoom img { max-width: none; max-height: none; display: block; margin: 0 auto; cursor: zoom-out; border-radius: 0; }
.wf-lb-spin { position: absolute; top: 50%; left: 50%; margin: -14px 0 0 -14px; font-size: 28px; opacity: .7; }
.wf-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border-radius: 14px; background: rgba(255, 255, 255, .12);
	color: #fff; font-size: 1.3rem; display: grid; place-items: center; }
.wf-lb-nav:not([disabled]):hover { background: rgba(255, 255, 255, .24); }
.wf-lb-nav[disabled] { opacity: .25; cursor: default; }
.wf-lb-nav.prev { left: 10px; }
.wf-lb-nav.next { right: 10px; }
.wf-lb-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 auto 14px; width: min(760px, calc(100vw - 24px)); background: #fff; color: var(--ink);
	border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }

.wf-form { display: grid; gap: 10px; text-align: left; }
.wf-form label { display: grid; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--mut); }
.swal2-html-container .wf-form input, .swal2-html-container .wf-form select { background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 11px; font-size: 16px; color: #172033; }
.swal2-html-container .wf-form input:focus, .swal2-html-container .wf-form select:focus { outline: 2px solid #c7d2fe; border-color: #4f46e5; }
.swal2-html-container .wf-form label { color: #566174; }

@media (max-width: 1320px) {                 /* ขอบข้างแถบแคบเกินวางป้ายเลขหน้า → วางในมุมภาพ */
	.wf-rp-tag { right: auto; left: 8px; background: rgba(15, 23, 42, .62); }
}
@media (max-width: 860px) {
	.wf-rbody { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
	.wf-rside { max-height: 44vh; border-left: 0; border-top: 1px solid #0f172a; }
	.wf-rpage { padding: 8px; }
}
@media (max-width: 640px) {
	.wf-lb-stage { padding: 4px 4px 10px; }
	.wf-lb-nav { width: 38px; height: 52px; background: rgba(9, 13, 26, .5); }
	.wf-lb-nav.prev { left: 4px; } .wf-lb-nav.next { right: 4px; }
	.wf-lb-foot { margin-bottom: 10px; }
	.wf-stat { padding: 10px 12px !important; }
	.wf-stat b { font-size: 1.3rem; }
	.wf-stat span { font-size: .72rem; line-height: 1.25; display: block; }
	.wf-row { grid-template-columns: 36px 1fr; }
	.wf-row .wf-right { grid-column: 2; justify-self: start; text-align: left; }
	.wf-q { width: 34px; height: 34px; font-size: .85rem; }
	.wf-tabs { gap: 14px; overflow-x: auto; }
	.wf-tab { white-space: nowrap; font-size: .9rem; }
	.wf-pipe { grid-template-columns: repeat(6, 1fr); row-gap: 8px; }
	main.admin-content { padding: 12px !important; }
}
button.wf-tag { border: 0; cursor: pointer; font-size: .8rem; padding: 3px 9px; }
button.wf-tag:hover { box-shadow: 0 0 0 2px #fed7aa; }
