/**
 * Step Guides - dialog styling.
 *
 * Three columns: what to place on the left, the picture in the middle,
 * what it looks like on the right. The middle one is the point of the
 * whole thing, so it gets the room, and the outer two scroll on their
 * own with a reserved gutter so nothing shifts sideways when a scrollbar
 * appears.
 */

#wpie-root .wpiesg-wrap {
	display: grid;
	grid-template-columns: 250px minmax(360px, 1fr) 258px;
	gap: 12px;
	align-items: stretch;
	height: min(70vh, 640px);
	min-height: 400px;
}

#wpie-root .wpiesg-side {
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-gutter: stable;
	padding-right: 4px;
}

#wpie-root .wpiesg-side > * {
	flex-shrink: 0;
}

#wpie-root .wpiesg-stage {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	overflow: hidden;
}

#wpie-root .wpiesg-canvas {
	display: block;
	width: 100%;
	height: auto;
	flex: 1 1 240px;
	min-height: 220px;
	border: 1px solid var(--ed-border, #3a3f47);
	border-radius: var(--btn-radius, 6px);
	background: var(--ed-panel, #23272e);
	outline: none;
}

#wpie-root .wpiesg-canvas:focus-visible {
	border-color: var(--ed-accent, #3b66ff);
}

#wpie-root .wpiesg-hint {
	min-height: 15px;
	font-size: 11px;
	color: var(--ed-text-dim, #8b929c);
}

#wpie-root .wpiesg-groups {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

#wpie-root .wpiesg-grouptitle {
	margin-top: 2px;
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--ed-text-dim, #8b929c);
	opacity: 0.8;
}

#wpie-root .wpiesg-grouptitle:first-child {
	margin-top: 0;
}

#wpie-root .wpiesg-palette {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 4px;
}

#wpie-root .wpiesg-tool {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 5px 6px;
	min-height: 27px;
	border: 1px solid var(--ed-border, #3a3f47);
	border-radius: var(--btn-radius, 6px);
	background: var(--ed-panel, #23272e);
	color: var(--ed-text-dim, #8b929c);
	font-size: 11px;
	line-height: 1.1;
	text-align: left;
	cursor: pointer;
	min-width: 0;
}

/* A truncated tool name is a guessing game. Two lines are cheaper than
   "Nummerie..." and "Beschriftu..." side by side. */
#wpie-root .wpiesg-tool span {
	min-width: 0;
	overflow-wrap: break-word;
	hyphens: auto;
}

#wpie-root .wpiesg-tool svg {
	flex: 0 0 auto;
}

#wpie-root .wpiesg-tool:hover {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
}

#wpie-root .wpiesg-tool.is-on {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
	box-shadow: 0 0 0 1px var(--ed-accent, #3b66ff) inset;
}

#wpie-root .wpiesg-list {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

#wpie-root .wpiesg-row {
	display: flex;
	align-items: center;
	gap: 4px;
	border-radius: var(--btn-radius, 6px);
	padding: 1px 2px;
}

#wpie-root .wpiesg-row.is-active {
	background: var(--ed-panel-2, #2a2e35);
}

#wpie-root .wpiesg-rowname {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 5px;
	min-width: 0;
	padding: 3px 4px;
	border: 0;
	background: transparent;
	color: var(--ed-text, #e8eaee);
	font-size: 11px;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

#wpie-root .wpiesg-rowname span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#wpie-root .wpiesg-rowname svg {
	flex: 0 0 auto;
	opacity: 0.7;
}

#wpie-root .wpiesg-row.is-active .wpiesg-rowname svg {
	opacity: 1;
	color: var(--ed-accent, #3b66ff);
}

#wpie-root .wpiesg-rowtools {
	display: flex;
	gap: 2px;
}

#wpie-root .wpiesg-mini {
	width: 20px;
	height: 20px;
	border: 1px solid var(--ed-border, #3a3f47);
	border-radius: 4px;
	background: transparent;
	color: var(--ed-text-dim, #8b929c);
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
}

#wpie-root .wpiesg-mini:hover {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
}

#wpie-root .wpiesg-empty {
	margin: 0;
	font-size: 11px;
	line-height: 1.5;
	color: var(--ed-text-dim, #8b929c);
}

#wpie-root .wpiesg-btnrow {
	display: flex;
	gap: 6px;
	margin-top: 6px;
}

#wpie-root .wpiesg-note {
	margin: 0 0 2px;
	font-size: 10.5px;
	line-height: 1.45;
	color: var(--ed-text-dim, #8b929c);
}

#wpie-root .wpiesg-warn {
	margin: 0 0 4px;
	padding: 5px 7px;
	border-left: 2px solid var(--ed-warning, #f5a524);
	border-radius: 3px;
	background: rgba(245, 165, 36, 0.08);
	font-size: 10.5px;
	line-height: 1.45;
	color: var(--ed-text, #e8eaee);
}

#wpie-root .wpiesg-stamps {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 3px;
	max-height: 148px;
	margin-top: 4px;
	overflow-y: auto;
	scrollbar-gutter: stable;
}

#wpie-root .wpiesg-stamp {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 5px;
	background: var(--ed-panel, #23272e);
	color: var(--ed-text-dim, #8b929c);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

#wpie-root .wpiesg-stamp:hover {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
}

#wpie-root .wpiesg-stamp.is-on {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
	box-shadow: 0 0 0 1px var(--ed-accent, #3b66ff) inset;
}

#wpie-root .wpiesg-stations {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-top: 2px;
	padding-top: 4px;
	border-top: 1px solid var(--ed-border, #3a3f47);
}

#wpie-root .wpiesg-stations .dsm-rowline-label {
	flex: 0 0 18px;
	text-align: right;
	opacity: 0.65;
}

/* The little way back from "this one mark" to "whatever the default is". */
#wpie-root .wpiesg-reset {
	margin-left: 6px;
	padding: 2px 6px;
	border: 1px solid var(--ed-border, #3a3f47);
	border-radius: 4px;
	background: transparent;
	color: var(--ed-text-dim, #8b929c);
	font-size: 10px;
	cursor: pointer;
}

#wpie-root .wpiesg-reset:hover {
	color: var(--ed-text, #e8eaee);
	border-color: var(--ed-accent, #3b66ff);
}

/* Typing happens on the picture, so the field sits on the picture. */
#wpie-root .wpiesg-inline {
	position: absolute;
	z-index: 5;
	box-sizing: border-box;
	padding: 5px 7px;
	border: 1px solid var(--ed-accent, #3b66ff);
	border-radius: var(--btn-radius, 6px);
	background: var(--ed-panel, #23272e);
	color: var(--ed-text, #e8eaee);
	font: inherit;
	font-size: 12px;
	line-height: 1.35;
	resize: none;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

#wpie-root .wpiesg-file {
	display: none;
}

#wpie-root .wpiesg-right .dsm-input,
#wpie-root .wpiesg-right .dsm-select {
	width: 100%;
	box-sizing: border-box;
}

#wpie-root .wpiesg-status {
	max-width: 60%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#wpie-root .wpiesg-right .wpiesg-btnrow .ai-btn {
	flex: 1;
}

@media (max-width: 1100px) {
	#wpie-root .wpiesg-wrap {
		grid-template-columns: 214px minmax(280px, 1fr) 226px;
	}

	#wpie-root .wpiesg-palette {
		grid-template-columns: minmax(0, 1fr);
	}
}
