/* 帳號管理「代入帳號」畫中畫視窗(ImpersonateWin.js)與代入視窗內的橫幅(FatherPage.js showImpBanner)
   全站白底 var(--jacc, #369);代入相關一律加橘色(#D9480F)作為「目前是別人的身分」的醒目提示 */
.impwin {
	position: fixed;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: #FFF;
	border: 2px solid #D9480F;
	border-radius: 8px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(217, 72, 15, 0.25);
	overflow: hidden;
	min-width: 360px;
	min-height: 260px;
	box-sizing: border-box;
	font-family: "微軟正黑體", "Microsoft JhengHei", "PingFang TC", sans-serif;
}
.impwin.is-active {
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34), 0 0 0 3px rgba(217, 72, 15, 0.30);
}
.impwin-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	height: 40px;
	padding: 0 6px 0 10px;
	background: #D9480F;
	color: #FFF;
	cursor: move;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}
.impwin-lead {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	flex: 1 1 auto;
}
.impwin-badge {
	flex: 0 0 auto;
	padding: 2px 8px;
	border-radius: 10px;
	background: #FFF;
	color: #D9480F;
	font-size: 12px;
	font-weight: bold;
	line-height: 16px;
}
.impwin-title {
	font-size: 15px;
	font-weight: bold;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}
.impwin-acts {
	display: flex;
	align-items: center;
	gap: 2px;
	flex: 0 0 auto;
}
.impwin-btn {
	width: 32px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #FFF;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.impwin-btn:hover,
.impwin-btn:focus-visible {
	background: rgba(255, 255, 255, 0.22);
	outline: none;
}
.impwin-close:hover {
	background: #A61E1E;
}
.impwin-btn svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.impwin-body {
	flex: 1 1 auto;
	position: relative;
	background: #FFF;
	min-height: 0;
}
.impwin-frame {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: #FFF;
}
.impwin.is-dragging .impwin-frame {
	pointer-events: none;
}
.impwin.is-ended .impwin-bar {
	background: #8A8F98;
}
.impwin.is-ended {
	border-color: #8A8F98;
}
.impwin.is-ended .impwin-badge {
	color: #8A8F98;
}
/* 最大化:滿版(留 6px 邊) */
.impwin.is-max {
	left: 6px !important;
	top: 6px !important;
	right: 6px;
	bottom: 6px;
	width: auto !important;
	height: auto !important;
}
.impwin.is-max .impwin-bar {
	cursor: default;
}
/* 最小化:右下角小卡(bottom 由 JS 依序排列) */
.impwin.is-min {
	left: auto !important;
	top: auto !important;
	right: 12px;
	width: 280px !important;
	height: 42px !important;
	min-width: 0;
	min-height: 0;
	border-radius: 21px;
	z-index: 2147482000 !important;	/* 小卡永遠在一般/最大化視窗之上,才點得到 */
}
.impwin.is-min .impwin-body,
.impwin.is-min .impwin-rs,
.impwin.is-min .impwin-max {
	display: none;
}
.impwin.is-min .impwin-bar {
	cursor: pointer;
	border-radius: 21px;
	height: 38px;
}
/* 改大小把手 */
.impwin-rs {
	position: absolute;
	z-index: 2;
}
.impwin-rs-n, .impwin-rs-s { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.impwin-rs-n { top: -3px; }
.impwin-rs-s { bottom: -3px; }
.impwin-rs-e, .impwin-rs-w { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.impwin-rs-e { right: -3px; }
.impwin-rs-w { left: -3px; }
.impwin-rs-ne, .impwin-rs-nw, .impwin-rs-se, .impwin-rs-sw { width: 12px; height: 12px; }
.impwin-rs-ne { top: -3px; right: -3px; cursor: nesw-resize; }
.impwin-rs-sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
.impwin-rs-nw { top: -3px; left: -3px; cursor: nwse-resize; }
.impwin-rs-se { bottom: -3px; right: -3px; cursor: nwse-resize; }
.impwin.is-max .impwin-rs { display: none; }
/* 拖曳中全頁遮罩:讓滑鼠經過 iframe 時事件仍由外層接收 */
.impwin-shield {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 2147483000;
	cursor: move;
}
.impwin-shield.is-n, .impwin-shield.is-s { cursor: ns-resize; }
.impwin-shield.is-e, .impwin-shield.is-w { cursor: ew-resize; }
.impwin-shield.is-ne, .impwin-shield.is-sw { cursor: nesw-resize; }
.impwin-shield.is-nw, .impwin-shield.is-se { cursor: nwse-resize; }
/* 手機:全螢幕覆蓋 + 返回 */
.impwin.is-phone.is-max {
	left: 0 !important;
	top: 0 !important;
	right: 0;
	bottom: 0;
	border-width: 0;
	border-radius: 0;
}
.impwin.is-phone .impwin-bar {
	height: 46px;
	cursor: default;
	padding-top: env(safe-area-inset-top);
}
.impwin.is-phone .impwin-btn {
	width: 40px;
	height: 40px;
}
.impwin.is-phone.is-min {
	width: 220px !important;
}

/* 代入視窗內(FatherPage.html?impw=)頁首橫幅 */
/* 固定在頁首正中央的小標籤:不推擠外框表格版面(FatherPage 以 100% 高表格排版),也不攔點擊 */
.fp-imp-banner {
	position: fixed;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	max-width: 70%;
	z-index: 99998;
	pointer-events: none;
	padding: 3px 14px;
	background: #FFF4E6;
	color: #9C3608;
	border: 2px solid #D9480F;
	border-top: 0;
	border-radius: 0 0 10px 10px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	font-size: 13px;
	font-weight: bold;
	line-height: 18px;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
/* 手機版外框原本隱藏副標題;代入模式一律顯示(代入標示放在這裡) */
body.fp-imp-mode #tbSecondTitle {
	display: block !important;
}
/* 頁首副標題位置的代入標示(取代「Supervisory Control And Data Acquisition」) */
.fp-imp-subtitle {
	display: inline-block;
	max-width: min(62vw, 560px);
	box-sizing: border-box;
	padding: 0 6px;
	border: 1px solid #D9480F;
	border-radius: 4px;
	background: #FFF4E6;
	color: #9C3608;
	font-weight: bold;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: middle;
}
.fp-imp-ended {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #FFF;
	padding: 16px;
}
.fp-imp-ended-msg {
	max-width: 420px;
	padding: 18px 20px;
	border: 1px solid #D9480F;
	border-left-width: 6px;
	border-radius: 6px;
	background: #FFF4E6;
	color: #333;
	font-size: 16px;
	font-weight: bold;
	line-height: 1.6;
	text-align: center;
}

/* ---------- 深色色系(規格 2026-10-20-dark-theme)---------- */
@media screen {
	html.jnc-dark .impwin {
		background: #22272f;
		box-shadow: 0 12px 32px rgba(0, 0, 0, .6), 0 0 0 1px rgba(217, 72, 15, .35);
	}

	html.jnc-dark .impwin.is-active {
		box-shadow: 0 16px 40px rgba(0, 0, 0, .65), 0 0 0 3px rgba(217, 72, 15, .4);
	}

	html.jnc-dark .impwin-body,
	html.jnc-dark .impwin-frame {
		background: #121418;
	}

	html.jnc-dark .fp-imp-banner,
	html.jnc-dark .fp-imp-subtitle {
		background: #3a2414;
		color: #ffb48a;
	}

	html.jnc-dark .fp-imp-banner {
		box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
	}

	html.jnc-dark .fp-imp-ended {
		background: #121418;
	}

	html.jnc-dark .fp-imp-ended-msg {
		background: #3a2414;
		color: #e6e8eb;
	}
}
