.plotter-shell {
	color: var(--app-text);
}

.header-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.plotter-workspace-badge {
	display: inline-flex;
	align-items: center;
	padding: 10px 2px 10px 0;
	font-size: 12px;
	color: var(--app-muted);
	white-space: nowrap;
}

.plotter-shell .app-account-button {
	width: auto;
	height: auto;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.plotter-shell .app-account-button:hover,
.plotter-shell .app-account-button[aria-expanded="true"] {
	border: 0;
	background: transparent;
	box-shadow: none;
}

.sidebar {
	overflow-y: auto;
}

.sidebar h3 {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--app-muted);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	cursor: pointer;
	user-select: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.sidebar h3::after {
	content: '';
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	flex: 0 0 28px;
	border-radius: var(--app-radius);
	border: 1px solid var(--panel-border);
	background: var(--panel-surface);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(232,238,236,0.9)' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 15px 15px;
	transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.sidebar h3:hover::after {
	transform: translateY(-1px);
	border-color: var(--panel-border-strong);
	background-color: var(--panel-surface-strong);
}

.sidebar-section.collapsed h3::after {
	transform: rotate(90deg);
}

.sidebar-section.collapsed h3:hover::after {
	transform: rotate(90deg) translateY(-1px);
}

.sidebar-section-content {
	overflow: hidden;
	transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
	max-height: 2000px;
	opacity: 1;
}

.sidebar-section.collapsed .sidebar-section-content {
	max-height: 0 !important;
	opacity: 0;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.sidebar-section {
	background: var(--app-panel-bg);
	padding: 12px;
	border-radius: var(--app-radius);
}

.sidebar-section-fill {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.sidebar-section-content-fill {
	flex: 1;
	display: flex;
	flex-direction: column;
}

button:not(.app-header-button) {
	background: linear-gradient(180deg, rgba(23, 36, 40, 0.98), rgba(13, 21, 24, 0.98));
	color: #f1f7f5;
	border: 1px solid rgba(159, 196, 188, 0.18);
	padding: 6px 12px;
	margin: 2px 0;
	border-radius: var(--app-radius);
	cursor: pointer;
	font-size: 12px;
	width: 100%;
	font-weight: 700;
	transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

button:not(.app-header-button):hover {
	background: linear-gradient(180deg, rgba(29, 45, 50, 0.98), rgba(18, 28, 32, 0.98));
	border-color: rgba(255, 209, 102, 0.28);
	transform: translateY(-1px);
}

button.primary:not(.app-header-button) {
	background: linear-gradient(180deg, rgba(233, 197, 130, 0.96), rgba(180, 136, 67, 0.96));
	border-color: rgba(186, 136, 62, 0.5);
	color: rgba(34, 22, 8, 0.96);
	box-shadow: 0 1px 0 rgba(255, 238, 203, 0.28) inset;
}

button.primary:not(.app-header-button):hover {
	background: linear-gradient(180deg, rgba(242, 208, 145, 0.98), rgba(193, 147, 75, 0.98));
	color: rgba(28, 18, 6, 0.98);
}

button.danger:not(.app-header-button) {
	background: linear-gradient(180deg, rgba(59, 27, 27, 0.98), rgba(38, 17, 17, 0.98));
	border-color: rgba(182, 101, 101, 0.38);
	color: #f4dddd;
}

button.danger:not(.app-header-button):hover {
	background: linear-gradient(180deg, rgba(75, 34, 34, 0.98), rgba(47, 22, 22, 0.98));
	border-color: rgba(216, 132, 132, 0.5);
}

button.success:not(.app-header-button) {
	background: linear-gradient(180deg, rgba(233, 197, 130, 0.96), rgba(180, 136, 67, 0.96));
	border-color: rgba(186, 136, 62, 0.5);
	color: rgba(34, 22, 8, 0.96);
	box-shadow: 0 1px 0 rgba(255, 238, 203, 0.28) inset;
}

button.success:not(.app-header-button):hover {
	background: linear-gradient(180deg, rgba(242, 208, 145, 0.98), rgba(193, 147, 75, 0.98));
	color: rgba(28, 18, 6, 0.98);
}

button:not(.app-header-button):disabled {
	background: #2d3336;
	border-color: #394144;
	color: #7e8a90;
	cursor: not-allowed;
	opacity: 0.75;
}

button:not(.app-header-button):disabled:hover {
	background: #2d3336;
	border-color: #394144;
}

.main-content {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
}

.grid-container {
	position: relative;
	width: min(100%, 800px);
	aspect-ratio: 1 / 1;
	background: #000;
	border: 2px solid #444;
	border-radius: var(--app-radius);
	cursor: crosshair;
}

.background-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0.5;
	pointer-events: none;
	z-index: 1;
}

.canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
}

.pattern-name-input {
	background: #1a1a1a;
	color: #fff;
	border: 1px solid #444;
	padding: 6px 10px;
	border-radius: var(--app-radius);
	font-size: 12px;
	width: 100%;
	margin-bottom: 8px;
}

.pattern-name-input::placeholder {
	color: #7e8a90;
}

.pattern-name-input:focus {
	outline: none;
	border-color: #4a9eff;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	cursor: pointer;
	margin: 4px 0;
}

.checkbox-label input[type="checkbox"] {
	cursor: pointer;
}

.checkbox-label-inline {
	margin: 0;
	flex: 0 0 auto;
	font-size: 10px;
}

.pattern-list {
	flex: 0 1 auto;
	min-height: 0;
	max-height: 368px;
	overflow-y: auto;
	margin-top: 8px;
}

.pattern-list-empty {
	color: #888;
	font-size: 11px;
	margin: 0;
	padding: 8px;
}

.pattern-item {
	background: linear-gradient(180deg, rgba(21, 32, 36, 0.98), rgba(12, 18, 21, 0.98));
	border: 1px solid rgba(159, 196, 188, 0.16);
	padding: 6px 8px;
	margin: 2px 0;
	border-radius: var(--app-radius);
	font-size: 11px;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
	display: block;
	row-gap: 6px;
}

.pattern-item:hover {
	background: linear-gradient(180deg, rgba(27, 40, 45, 0.98), rgba(16, 25, 29, 0.98));
	border-color: rgba(255, 209, 102, 0.24);
}

.pattern-item-details {
	min-width: 0;
	width: 100%;
}

.pattern-item-name {
	cursor: pointer;
	display: block;
	color: #f1f7f5;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.2;
	margin-bottom: 6px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pattern-item-actions {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0;
	margin-top: 0;
	width: 100%;
}

.pattern-item-open {
	width: auto !important;
	flex: 1 1 auto;
	padding: 4px 12px;
	font-size: 11px;
	line-height: 1;
	margin: 0;
	border-radius: 18px 0 0 18px !important;
	border-right: 0 !important;
	min-height: 30px;
}

button.pattern-item-delete {
	width: 38px;
	min-width: 38px;
	height: 30px;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(182, 101, 101, 0.46);
	border-left: 1px solid rgba(97, 53, 31, 0.55);
	background: linear-gradient(180deg, rgba(207, 71, 55, 0.98), rgba(164, 44, 31, 0.98));
	color: #fff5f2;
	box-shadow: inset 0 1px 0 rgba(255, 203, 190, 0.18);
	flex: 0 0 38px;
	border-radius: 0 18px 18px 0;
}

button.pattern-item-delete:hover {
	background: linear-gradient(180deg, rgba(222, 84, 66, 0.99), rgba(177, 53, 38, 0.99));
	border-color: rgba(224, 149, 136, 0.52);
	color: #ffffff;
	transform: none;
}

button.pattern-item-delete svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
	pointer-events: none;
}

.pattern-item-preview {
	display: block;
	width: 68px;
	height: 68px;
	border-radius: 10px;
	border: 1px solid rgba(255, 209, 102, 0.18);
	background: linear-gradient(180deg, rgba(10, 14, 16, 0.98), rgba(5, 8, 9, 0.98));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.pattern-preview-tooltip {
	position: fixed;
	z-index: 80;
	padding: 10px;
	border-radius: var(--app-radius);
	border: 1px solid rgba(255, 209, 102, 0.28);
	background: linear-gradient(180deg, rgba(17, 25, 29, 0.98), rgba(9, 14, 16, 0.98));
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
	pointer-events: none;
}

.pattern-preview-tooltip[hidden] {
	display: none;
}

.pattern-preview-tooltip .pattern-item-preview {
	width: 124px;
	height: 124px;
}

.shape-selector {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.shape-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 20px 20px;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.shape-button {
	display: block;
	width: 100%;
	background: #2a2a2a;
	border-color: #444;
	opacity: 0.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	height: 30px;
	margin: 0;
	font-size: 11px;
	line-height: 1;
}

.shape-button.has-points {
	background: #3a3a3a;
	opacity: 1;
}

.shape-button.is-active {
	background: var(--shape-color, #4a9eff);
	border-color: var(--shape-color, #4a9eff);
}

button.shape-action-icon {
	width: 20px;
	min-width: 20px;
	height: 20px;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: center;
	border: 0;
	background: transparent;
	border-radius: 0;
	color: #9db0ba;
	box-shadow: none;
	cursor: pointer;
}

button.shape-action-icon:hover {
	background: transparent;
	border: 0;
	transform: none;
}

.shape-options-button {
	color: #8da6bb;
}

.shape-options-button:hover {
	color: #d4e6f5;
}

.shape-delete-button:hover {
	color: #ff8f8f;
}

button.shape-action-icon svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
	pointer-events: none;
}

.button-dimmed {
	opacity: 0.5;
}

.file-input-hidden,
input[type="file"].file-input-hidden {
	display: none;
}

.image-meta {
	margin-top: 8px;
	font-size: 10px;
	color: #888;
	line-height: 1.5;
}

.setting-label {
	display: block;
	margin-bottom: 4px;
	font-size: 12px;
}

.setting-range {
	width: 100%;
	margin-bottom: 8px;
}

.setting-range-tight {
	width: 100%;
	margin-bottom: 4px;
}

.setting-help {
	font-size: 10px;
	color: #888;
	margin-bottom: 12px;
}

.setting-help-tight {
	font-size: 10px;
	color: #888;
	margin-bottom: 8px;
}

.shape-hint {
	font-size: 11px;
	color: #888;
	line-height: 1.5;
}

.panel-kicker {
	font-size: 11px;
	color: #aaa;
	margin-bottom: 8px;
}

.field-row {
	display: flex;
	gap: 4px;
	margin-bottom: 4px;
}

.field-input-compact {
	flex: 1;
	padding: 4px;
	font-size: 11px;
}

.button-compact {
	width: auto;
	padding: 4px 8px;
	font-size: 10px;
}

.panel-action {
	margin-bottom: 12px;
}

.particle-summary {
	padding: 8px;
	background: #2a2a2a;
	border-radius: var(--app-radius);
	font-size: 11px;
}

.particle-summary-label {
	margin-bottom: 4px;
}

.particle-summary-value {
	font-size: 13px;
	font-weight: bold;
}

.particle-summary-value.is-warning,
.particle-summary-note.is-warning {
	color: #ff6b4a;
}

.particle-summary-value.is-ok,
.particle-summary-note.is-ok {
	color: #4aff6b;
}

.particle-summary-note {
	margin-top: 4px;
	font-size: 10px;
}

.crop-modal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(5, 8, 10, 0.82);
	backdrop-filter: blur(6px);
	z-index: 50;
}

.crop-modal.is-open {
	display: flex;
}

.crop-modal-panel {
	width: min(760px, 100%);
	background: #1b2529;
	border: 1px solid #38535d;
	border-radius: var(--app-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	padding: 18px;
	display: grid;
	gap: 16px;
}

.crop-modal-panel--compact {
	width: min(420px, 100%);
}

.shape-options-panel {
	display: grid;
	gap: 10px;
	padding: 4px 0;
}

.shape-options-checkbox {
	margin: 0;
	font-size: 13px;
}

.crop-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.crop-modal-header h2 {
	margin: 0;
	font-size: 18px;
}

.crop-modal-copy {
	font-size: 12px;
	color: #9bb0b9;
	line-height: 1.5;
}

.crop-workspace {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 200px;
	gap: 16px;
	align-items: start;
}

.crop-preview-shell {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px;
	border-radius: var(--app-radius);
	background:
		linear-gradient(45deg, #202a2d 25%, transparent 25%, transparent 75%, #202a2d 75%),
		linear-gradient(45deg, #202a2d 25%, transparent 25%, transparent 75%, #202a2d 75%);
	background-position: 0 0, 10px 10px;
	background-size: 20px 20px;
	border: 1px solid #33444b;
}

.crop-preview {
	width: min(100%, 360px);
	aspect-ratio: 1;
	background: #0d1113;
	border-radius: var(--app-radius);
	cursor: grab;
	touch-action: none;
}

.crop-preview.is-dragging {
	cursor: grabbing;
}

.crop-sidebar {
	display: grid;
	gap: 12px;
}

.crop-group {
	padding: 12px;
	border-radius: var(--app-radius);
	background: #131b1f;
	border: 1px solid #2c3a40;
}

.crop-group label {
	display: block;
	margin-bottom: 6px;
	font-size: 11px;
	color: #b7c7cd;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.crop-group input[type="range"] {
	width: 100%;
}

.crop-hint,
.crop-value {
	font-size: 11px;
	color: #95a7ae;
	line-height: 1.5;
}

.crop-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.crop-actions button {
	width: auto;
	min-width: 130px;
}

.instructions-list {
	margin: 0;
	padding-left: 18px;
	display: grid;
	gap: 10px;
	font-size: 13px;
	line-height: 1.6;
	color: #d8e2e6;
}

.instructions-list strong {
	color: #ffffff;
}
