/*
 * Fallback only when the left sidebar rail is missing.
 * Never position:fixed over the native icon bar — that covers Text/Vorlagen.
 */
.tma-am-designer-quickdock {
	position: fixed;
	left: 8px;
	bottom: 16px;
	z-index: 100070;
	display: none;
	flex-direction: column;
	gap: 8px;
	width: 72px;
	pointer-events: none;
}

.tma-am-designer-quickdock.is-visible {
	display: flex;
	pointer-events: auto;
}

.tma-am-sayings-toggle,
.tma-am-ct-designer-save--bar {
	display: none;
	width: 66px;
	margin: 0;
	padding: 6px 4px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	white-space: normal;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.tma-am-designer-quickdock.is-visible .tma-am-sayings-toggle,
.tma-am-designer-quickdock.is-visible .tma-am-ct-designer-save--bar {
	display: block;
	position: static;
}

.tma-am-ct-designer-save--bar {
	background: #0e7490;
	color: #fff;
	border-color: #0e7490;
}

.tma-am-nav-item {
	cursor: pointer;
	text-align: center;
}

.tma-am-nav-item .tma-am-nav-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0 auto 4px;
}

.tma-am-nav-item .tma-am-nav-icon img {
	display: block;
	width: 26px;
	height: 26px;
}

.tma-am-nav-item > span:not(.tma-am-nav-icon),
.tma-am-nav-item .tma-am-nav-label {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	font-size: 11px !important;
	line-height: 1.15 !important;
	margin-top: 4px;
	text-align: center;
	white-space: normal;
	max-width: 72px;
}

.nbd-sidebar .tma-am-nav-item > span:not(.tma-am-nav-icon),
.nbd-sidebar-wrapper .tma-am-nav-item > span:not(.tma-am-nav-icon),
.nbd-sidebar .tma-am-nav-item .tma-am-nav-label,
.nbd-sidebar-wrapper .tma-am-nav-item .tma-am-nav-label {
	color: #fff !important;
}

.tma-am-designer-quickdock .tma-am-nav-item--sayings .tma-am-nav-icon,
.tma-am-designer-quickdock .tma-am-nav-item--template .tma-am-nav-icon,
.tma-am-designer-quickdock .tma-am-nav-item--save .tma-am-nav-icon,
.tma-am-designer-quickdock .tma-am-nav-item--open .tma-am-nav-icon {
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 6px;
}

.tma-am-designer-quickdock .tma-am-nav-icon--dock {
	display: flex;
	justify-content: center;
	margin-bottom: 4px;
}

.tma-am-designer-quickdock .tma-am-nav-icon--dock img {
	width: 22px;
	height: 22px;
}

.tma-am-ct-designer-save--bar .tma-am-nav-icon--dock img {
	filter: brightness(0) invert(1);
}

.nbd-sidebar .tma-am-nav-item,
.nbd-sidebar-wrapper .tma-am-nav-item {
	pointer-events: auto;
	display: block;
	visibility: visible;
	opacity: 1;
	flex: 0 0 auto;
}

.nbd-sidebar .tma-am-nav-item .tma-am-nav-icon,
.nbd-sidebar-wrapper .tma-am-nav-item .tma-am-nav-icon {
	background: transparent;
	border: 0;
}

.nbd-sidebar .tma-am-nav-item .tma-am-nav-icon img,
.nbd-sidebar-wrapper .tma-am-nav-item .tma-am-nav-icon img {
	filter: brightness(0) invert(1);
	opacity: 0.9;
}

.nbd-sidebar .tma-am-nav-item:hover .tma-am-nav-icon img,
.nbd-sidebar-wrapper .tma-am-nav-item:hover .tma-am-nav-icon img,
.nbd-sidebar .tma-am-nav-item.active .tma-am-nav-icon img,
.nbd-sidebar-wrapper .tma-am-nav-item.active .tma-am-nav-icon img {
	opacity: 1;
}

/*
 * Extra host is a non-tab footer inside the icon rail.
 * Do not restyle native .main-menu / .nbd-tabs (flex here used to shift Text/Vorlagen).
 */
#tma-am-sidebar-extra,
.tma-am-sidebar-extra {
	flex: 0 0 auto;
	width: 100%;
	box-sizing: border-box;
	padding: 4px 0 8px;
	margin: 0;
	position: relative;
	z-index: 1;
	pointer-events: auto;
}

#tma-am-sidebar-extra.is-active,
.tma-am-sidebar-extra.is-active {
	border-top: 1px solid rgba(255, 255, 255, 0.14);
}

body.tma-am-designer-nav-in-sidebar .tma-am-sayings-toggle,
body.tma-am-designer-nav-in-sidebar .tma-am-ct-designer-save--bar {
	display: none !important;
}

.nbd-sidebar #tma-am-frame-nav,
.nbd-sidebar-wrapper #tma-am-frame-nav {
	margin-top: 4px;
}

.nbd-sidebar #tma-am-sayings-nav,
.nbd-sidebar-wrapper #tma-am-sayings-nav {
	margin-top: 2px;
}

.nbd-sidebar #tma-am-ct-save-nav,
.nbd-sidebar-wrapper #tma-am-ct-save-nav,
.nbd-sidebar #tma-am-nbd-save-nav,
.nbd-sidebar-wrapper #tma-am-nbd-save-nav,
.nbd-sidebar #tma-am-nbd-open-nav,
.nbd-sidebar-wrapper #tma-am-nbd-open-nav {
	margin-bottom: 4px;
}

.tma-am-ct-name-dialog {
	position: fixed;
	inset: 0;
	z-index: 100090;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, 0.45);
}

.tma-am-ct-name-dialog[hidden] {
	display: none !important;
}

.tma-am-ct-name-dialog__box {
	width: min(92vw, 360px);
	padding: 1rem 1.1rem;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.tma-am-ct-name-dialog__box label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 600;
}

.tma-am-ct-name-dialog__box input {
	width: 100%;
	margin-bottom: 0.75rem;
}

.tma-am-ct-name-dialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
}

.tma-am-sayings-panel {
	position: fixed;
	top: 56px;
	left: auto;
	right: auto;
	z-index: 10050;
	width: min(360px, calc(100vw - 120px));
	max-height: calc(100vh - 72px);
	overflow: auto;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	box-sizing: border-box;
}

.tma-am-sayings-panel[hidden] {
	display: none !important;
}

/*
 * Nur die Inhalts-Spalte überdecken — die Icon-Leiste (Vorlagen/Text/Fotos)
 * bleibt klickbar, damit Sprüche beim Tab-Wechsel schließen kann.
 */
body.tma-am-sayings-panel-open .nbd-sidebar .tabs-content,
body.tma-am-sayings-panel-open .nbd-sidebar-wrapper .tabs-content,
body.tma-am-frame-panel-open .nbd-sidebar .tabs-content,
body.tma-am-frame-panel-open .nbd-sidebar-wrapper .tabs-content,
body.tma-am-format-panel-open .nbd-sidebar .tabs-content,
body.tma-am-format-panel-open .nbd-sidebar-wrapper .tabs-content {
	visibility: hidden !important;
	pointer-events: none !important;
}

body.tma-am-sayings-panel-open #tma-am-sayings-nav.tma-am-nav-item,
body.tma-am-frame-panel-open #tma-am-frame-nav.tma-am-nav-item,
body.tma-am-format-panel-open #tma-am-format-nav.tma-am-nav-item,
body.tma-am-zoom-panel-open #tma-am-zoom-nav.tma-am-nav-item {
	opacity: 1;
}

body.tma-am-sayings-panel-open #tma-am-sayings-nav.tma-am-nav-item .tma-am-nav-icon,
body.tma-am-frame-panel-open #tma-am-frame-nav.tma-am-nav-item .tma-am-nav-icon,
body.tma-am-format-panel-open #tma-am-format-nav.tma-am-nav-item .tma-am-nav-icon,
body.tma-am-zoom-panel-open #tma-am-zoom-nav.tma-am-nav-item .tma-am-nav-icon {
	background: #2271b1;
	border-color: #2271b1;
}

.nbd-sidebar .tma-am-nav-item#tma-am-sayings-nav,
.nbd-sidebar-wrapper .tma-am-nav-item#tma-am-sayings-nav,
.nbd-sidebar .tma-am-nav-item#tma-am-frame-nav,
.nbd-sidebar-wrapper .tma-am-nav-item#tma-am-frame-nav,
.nbd-sidebar .tma-am-nav-item#tma-am-format-nav,
.nbd-sidebar-wrapper .tma-am-nav-item#tma-am-format-nav,
.nbd-sidebar .tma-am-nav-item#tma-am-zoom-nav,
.nbd-sidebar-wrapper .tma-am-nav-item#tma-am-zoom-nav {
	position: relative;
	z-index: 20;
}

/*
 * Native zoom chip: hidden from the object toolbar, shown as flyout
 * next to the left-nav lupe.
 */
.nbd-workspace .main > .nbd-toolbar-zoom,
.nbd-toolbar-zoom {
	position: fixed !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
	z-index: 10060 !important;
}

body.tma-am-zoom-panel-open .nbd-workspace .main > .nbd-toolbar-zoom,
body.tma-am-zoom-panel-open .nbd-toolbar-zoom {
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer,
body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer-toolbar,
body.tma-am-zoom-panel-open .nbd-toolbar-zoom .sub-menu,
body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer-popover {
	pointer-events: auto !important;
	overflow: visible !important;
}

body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer-popover,
body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer-level .sub-menu {
	max-height: min(60vh, calc(100vh - 96px)) !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
}

body.tma-am-zoom-panel-open .nbd-toolbar-zoom .zoomer-popover-list {
	max-height: inherit !important;
	overflow: visible !important;
}

.tma-am-format-panel-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 10px 12px 14px;
}

#tma-am-format-panel .tma-am-height-handle {
	border: none;
	box-shadow: none;
	max-width: none;
	width: 100%;
	padding: 0;
	align-items: stretch;
	background: transparent;
}

.tma-am-format-height-label {
	font-size: 12px;
	font-weight: 600;
	color: #1d2327;
}

.tma-am-format-height-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tma-am-format-height-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 34px;
	padding: 4px 8px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
}

.tma-am-format-height-range {
	width: 100%;
	height: 28px;
	margin: 0;
	accent-color: #1e3a5f;
}

.tma-am-format-meta {
	margin: 0;
	padding: 8px 0 0;
	border-top: 1px solid #dcdcde;
}

.tma-am-format-meta__row {
	display: grid;
	grid-template-columns: 5.5em 1fr;
	gap: 8px;
	align-items: start;
	margin: 0 0 6px;
	font-size: 13px;
}

.tma-am-format-meta dt {
	margin: 0;
	color: #646970;
	font-weight: 600;
}

.tma-am-format-meta dd {
	margin: 0;
	color: #1d2327;
}

.tma-am-format-price {
	margin: 8px 0 0;
	padding: 8px 0 0;
	border-top: 1px solid #dcdcde;
}

.tma-am-format-price__title {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	color: #1d2327;
}

#tma-am-format-panel .tma-am-frame-follow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	padding: 8px;
	background: #f6f7f7;
	border-radius: 6px;
	font-size: 12px;
}

.tma-am-sayings-panel-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 12px;
	border-bottom: 1px solid #dcdcde;
	background: #f6f7f7;
}

.tma-am-sayings-close {
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.tma-am-sayings-search-wrap,
.tma-am-sayings-filters {
	padding: 0 12px 10px;
}

.tma-am-sayings-filter-label {
	display: block;
	margin: 8px 0 4px;
	font-size: 12px;
	font-weight: 600;
	color: #1d2327;
}

.tma-am-sayings-filters .tma-am-sayings-filter-label:first-child {
	margin-top: 0;
}

.tma-am-sayings-group-select,
.tma-am-sayings-search {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	font-size: 13px;
	line-height: 1.3;
}

.tma-am-sayings-group-select {
	cursor: pointer;
}

.tma-am-sayings-group-select:focus,
.tma-am-sayings-search:focus {
	border-color: #2271b1;
	outline: none;
	box-shadow: 0 0 0 1px #2271b1;
}

.tma-am-sayings-hint,
.tma-am-sayings-cat-name,
.tma-am-sayings-empty,
.tma-am-sayings-loading {
	margin: 10px 12px;
	font-size: 12px;
	color: #50575e;
}

.tma-am-sayings-group {
	padding: 0 12px 12px;
}

.tma-am-sayings-group h3 {
	margin: 12px 0 8px;
	font-size: 13px;
}

.tma-am-sayings-item {
	display: block;
	width: 100%;
	margin: 0 0 8px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	text-align: left;
	cursor: pointer;
	white-space: pre-wrap;
	font-size: 13px;
	line-height: 1.4;
}

.tma-am-sayings-item:hover {
	border-color: #2271b1;
	background: #f0f6fc;
}

.tma-am-sayings-item.is-default {
	border-color: #2271b1;
}

.tma-am-sayings-item-title {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.tma-am-sayings-item-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 0 6px;
	border-radius: 8px;
	background: #2271b1;
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	vertical-align: middle;
}

.tma-am-sayings-status {
	margin: 0 12px 12px;
	font-size: 12px;
	color: #00a32a;
}

.tma-am-frame-panel-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 4px 12px 14px;
}

.tma-am-frame-panel-opt {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	padding: 8px 10px;
	cursor: pointer;
}

.tma-am-frame-panel-opt:hover {
	border-color: #2271b1;
	background: #f0f6fc;
}

@media (max-width: 782px) {
	.tma-am-sayings-panel,
	.tma-am-format-panel,
	.tma-am-frame-panel {
		max-width: calc(100vw - 16px);
	}

	.tma-am-height-handle__col,
	.tma-am-height-handle__frame-btn,
	.tma-am-frame-panel-opt,
	.tma-am-sayings-panel .tma-am-sayings-close,
	.tma-am-format-height-input {
		min-height: 44px;
	}

	.tma-am-format-height-range {
		height: 40px;
	}

	.nbd-sidebar .tma-am-nav-item,
	.nbd-sidebar-wrapper .tma-am-nav-item {
		flex: 0 0 64px;
		width: 64px;
		min-width: 64px;
		max-width: 64px;
		padding: 4px 2px;
		box-sizing: border-box;
	}

	#tma-am-sidebar-extra,
	.tma-am-sidebar-extra,
	#tma-am-sidebar-extra.is-active,
	.tma-am-sidebar-extra.is-active {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		width: max-content;
		max-width: none;
		flex: 0 0 auto;
		padding: 0;
		border-top: 0;
	}

	.nbd-sidebar .tma-am-nav-item > span:not(.tma-am-nav-icon),
	.nbd-sidebar-wrapper .tma-am-nav-item > span:not(.tma-am-nav-icon),
	.nbd-sidebar .tma-am-nav-item .tma-am-nav-label,
	.nbd-sidebar-wrapper .tma-am-nav-item .tma-am-nav-label {
		max-width: 64px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		font-size: 10px !important;
	}
}
