/**
 * Ready2Teach manual lesson editor.
 *
 * Scoped to [data-r2t-manual-lesson-editor] so the stylesheet cannot alter
 * Lesson Launch, Teacher Mode, Student TV, the planner, or WordPress admin.
 *
 * @package Ready2Teach_Portal_Core_Improvements
 * @version 1.9.0-single-dynamic-editor
 */

.r2t-manual-lesson-editor {
	--r2t-editor-ink: #172033;
	--r2t-editor-muted: #667085;
	--r2t-editor-soft: #f6f8fc;
	--r2t-editor-soft-2: #eef2f7;
	--r2t-editor-white: #ffffff;
	--r2t-editor-border: #d8e0ea;
	--r2t-editor-border-strong: #b8c4d3;
	--r2t-editor-focus: #2563eb;
	--r2t-editor-primary: #315efb;
	--r2t-editor-primary-dark: #2149d8;
	--r2t-editor-success: #15803d;
	--r2t-editor-success-soft: #ecfdf3;
	--r2t-editor-warning: #a16207;
	--r2t-editor-warning-soft: #fffbeb;
	--r2t-editor-danger: #b42318;
	--r2t-editor-danger-soft: #fff1f0;
	--r2t-editor-shadow: 0 18px 48px rgba(23, 32, 51, 0.11);
	--r2t-editor-shadow-small: 0 8px 22px rgba(23, 32, 51, 0.08);
	--r2t-editor-radius: 22px;
	--r2t-editor-radius-small: 14px;
	--r2t-editor-control-height: 44px;

	box-sizing: border-box;
	width: min(100%, 1500px);
	margin: 0 auto;
	padding: clamp(12px, 2.2vw, 28px);
	color: var(--r2t-editor-ink);
	font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

.r2t-manual-lesson-editor,
.r2t-manual-lesson-editor *,
.r2t-manual-lesson-editor *::before,
.r2t-manual-lesson-editor *::after {
	box-sizing: border-box;
}

.r2t-manual-lesson-editor [hidden] {
	display: none !important;
}

.r2t-manual-lesson-editor a {
	text-underline-offset: 0.16em;
}

.r2t-manual-lesson-editor button,
.r2t-manual-lesson-editor input,
.r2t-manual-lesson-editor select,
.r2t-manual-lesson-editor textarea {
	font: inherit;
}

.r2t-manual-lesson-editor button,
.r2t-manual-lesson-editor summary,
.r2t-manual-lesson-editor a {
	-webkit-tap-highlight-color: transparent;
}

.r2t-manual-lesson-editor :focus-visible {
	outline: 3px solid color-mix(in srgb, var(--r2t-editor-focus) 72%, white 28%);
	outline-offset: 3px;
}

/* --------------------------------------------------------------------------
 * Header and contextual notices
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-notice,
.r2t-manual-lesson-conflict {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin: 0 0 14px;
	padding: 14px 16px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: var(--r2t-editor-radius-small);
	background: var(--r2t-editor-white);
	box-shadow: var(--r2t-editor-shadow-small);
}

.r2t-manual-lesson-notice strong,
.r2t-manual-lesson-conflict strong {
	display: block;
	margin: 0;
	font-weight: 800;
}

.r2t-manual-lesson-notice span,
.r2t-manual-lesson-conflict p {
	display: block;
	margin: 2px 0 0;
	color: var(--r2t-editor-muted);
}

.r2t-manual-lesson-notice-success {
	border-color: #a7e8bf;
	background: var(--r2t-editor-success-soft);
	color: #14532d;
}

.r2t-manual-lesson-conflict {
	border-color: #f6c0bc;
	background: var(--r2t-editor-danger-soft);
	color: #7a271a;
}

.r2t-manual-lesson-header {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: 126px;
	padding: clamp(20px, 3vw, 34px);
	border-radius: var(--r2t-editor-radius) var(--r2t-editor-radius) 0 0;
	background-color: var(--r2t-lesson-colour, #6d4cff);
	background-image:
		linear-gradient(135deg, rgba(13, 24, 45, 0.18), rgba(13, 24, 45, 0.42)),
		radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.22), transparent 30%);
	color: #ffffff;
	box-shadow: var(--r2t-editor-shadow);
	overflow: hidden;
}

.r2t-manual-lesson-header-colour,
.r2t-manual-lesson-print-mirror {
	display: none;
}

.r2t-manual-lesson-header::after {
	content: "";
	position: absolute;
	right: -56px;
	bottom: -92px;
	width: 240px;
	height: 240px;
	border: 34px solid rgba(255, 255, 255, 0.08);
	border-radius: 50%;
	pointer-events: none;
}

.r2t-manual-lesson-header-copy,
.r2t-manual-lesson-header-actions {
	position: relative;
	z-index: 1;
}

.r2t-manual-lesson-header[data-r2t-return-to-planner] {
	cursor: pointer;
}

.r2t-manual-lesson-header[data-r2t-return-to-planner]:focus-visible {
	outline: 3px solid rgba(255, 255, 255, .95);
	outline-offset: 3px;
}

.r2t-manual-lesson-header[data-r2t-return-to-planner] .r2t-manual-lesson-header-copy {
	transition: transform .16s ease;
}

.r2t-manual-lesson-header[data-r2t-return-to-planner]:hover .r2t-manual-lesson-header-copy {
	transform: translateX(-2px);
}

.r2t-manual-lesson-header-copy {
	min-width: 0;
}

.r2t-manual-lesson-context,
.r2t-manual-lesson-time,
.r2t-manual-lesson-date {
	margin: 0;
	color: inherit;
}

.r2t-manual-lesson-context {
	font-size: clamp(1.25rem, 2vw, 1.7rem);
	font-weight: 850;
	letter-spacing: -0.025em;
	line-height: 1.2;
}

.r2t-manual-lesson-time {
	margin-top: 9px;
	font-size: clamp(1rem, 1.5vw, 1.18rem);
	font-weight: 760;
}

.r2t-manual-lesson-date {
	margin-top: 3px;
	font-size: 0.93rem;
	font-weight: 600;
	opacity: 0.86;
}

.r2t-manual-lesson-header-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	flex: 0 0 auto;
}

.r2t-manual-lesson-header-link,
.r2t-manual-lesson-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	border: 1px solid rgba(255, 255, 255, 0.44);
	border-radius: 999px;
	background: rgba(9, 19, 37, 0.2);
	color: #ffffff !important;
	font-weight: 800;
	text-decoration: none !important;
	backdrop-filter: blur(7px);
	transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.r2t-manual-lesson-header-link {
	padding: 9px 15px;
}

.r2t-manual-lesson-icon-button {
	width: 44px;
	padding: 0;
	cursor: pointer;
}

.r2t-manual-lesson-header-link:hover,
.r2t-manual-lesson-icon-button:hover {
	border-color: rgba(255, 255, 255, 0.75);
	background: rgba(9, 19, 37, 0.34);
	transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
 * Main form and reusable controls
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-form {
	position: relative;
	padding: clamp(15px, 2.4vw, 28px);
	border: 1px solid var(--r2t-editor-border);
	border-top: 0;
	border-radius: 0 0 var(--r2t-editor-radius) var(--r2t-editor-radius);
	background: var(--r2t-editor-soft);
	box-shadow: var(--r2t-editor-shadow);
}

.r2t-manual-lesson-title-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 14px;
	margin-bottom: 14px;
	padding: 14px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: var(--r2t-editor-radius-small);
	background: var(--r2t-editor-white);
}

.r2t-manual-lesson-title-field {
	min-width: 0;
}

.r2t-manual-lesson-title-field input[type="text"] {
	display: block;
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 7px;
	background: transparent;
	color: var(--r2t-editor-ink);
	font-size: clamp(1.25rem, 2vw, 1.7rem);
	font-weight: 780;
	letter-spacing: -0.025em;
	line-height: 1.25;
	box-shadow: none;
	transition: border-color 160ms ease, background-color 160ms ease;
}

.r2t-manual-lesson-title-field input[type="text"]:hover {
	background: #f9fbfd;
}

.r2t-manual-lesson-title-field input[type="text"]:focus {
	border-bottom-color: var(--r2t-editor-focus);
	background: #ffffff;
	outline: 0;
}

.r2t-manual-lesson-top-actions,
.r2t-manual-lesson-footer-primary,
.r2t-manual-lesson-footer-secondary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.r2t-manual-lesson-status-label {
	display: inline-flex;
	align-items: center;
}

.r2t-manual-lesson-status-label select {
	min-height: var(--r2t-editor-control-height);
	margin: 0;
	padding: 8px 38px 8px 13px;
	border: 1px solid var(--r2t-editor-border-strong);
	border-radius: 999px;
	background-color: #ffffff;
	color: var(--r2t-editor-ink);
	font-weight: 750;
	cursor: pointer;
	box-shadow: none;
}

.r2t-manual-lesson-editor .r2t-button,
.r2t-manual-lesson-editor .r2t-editor-tool {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--r2t-editor-control-height);
	margin: 0;
	border: 1px solid transparent;
	border-radius: 999px;
	font-weight: 800;
	line-height: 1.15;
	text-align: center;
	text-decoration: none !important;
	cursor: pointer;
	box-shadow: none;
	transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.r2t-manual-lesson-editor .r2t-button {
	padding: 10px 17px;
}

.r2t-manual-lesson-editor .r2t-button:hover,
.r2t-manual-lesson-editor .r2t-editor-tool:hover {
	transform: translateY(-1px);
}

.r2t-manual-lesson-editor .r2t-button:disabled,
.r2t-manual-lesson-editor .r2t-editor-tool:disabled,
.r2t-manual-lesson-editor [aria-disabled="true"] {
	cursor: not-allowed;
	opacity: 0.58;
	transform: none;
}

.r2t-button-primary {
	border-color: var(--r2t-editor-primary) !important;
	background: var(--r2t-editor-primary) !important;
	color: #ffffff !important;
	box-shadow: 0 8px 18px rgba(49, 94, 251, 0.22) !important;
}

.r2t-button-primary:hover {
	border-color: var(--r2t-editor-primary-dark) !important;
	background: var(--r2t-editor-primary-dark) !important;
	box-shadow: 0 10px 22px rgba(49, 94, 251, 0.28) !important;
}

.r2t-button-secondary,
.r2t-button-icon-text,
.r2t-button-small {
	border-color: var(--r2t-editor-border-strong) !important;
	background: #ffffff !important;
	color: var(--r2t-editor-ink) !important;
}

.r2t-button-secondary:hover,
.r2t-button-icon-text:hover,
.r2t-button-small:hover {
	border-color: #8ea0b7 !important;
	background: #f8fafc !important;
	box-shadow: var(--r2t-editor-shadow-small) !important;
}

.r2t-button-small {
	min-height: 34px !important;
	padding: 7px 12px !important;
	font-size: 0.87rem;
}

.r2t-button-locked {
	border-style: dashed !important;
	background: #fafafa !important;
	color: #475467 !important;
}

.r2t-button[aria-busy="true"] {
	position: relative;
	padding-right: 42px;
}

.r2t-button[aria-busy="true"]::after {
	content: "";
	position: absolute;
	right: 15px;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: r2t-editor-spin 800ms linear infinite;
}

/* --------------------------------------------------------------------------
 * Editor shell and WordPress/TinyMCE controls
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-editor-shell {
	border: 1px solid var(--r2t-editor-border);
	border-radius: var(--r2t-editor-radius-small);
	background: #ffffff;
	overflow: hidden;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), var(--r2t-editor-shadow-small);
}

.r2t-manual-lesson-insert-tools {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--r2t-editor-border);
	background: linear-gradient(180deg, #ffffff, #f7f9fc);
}

.r2t-manual-lesson-editor .r2t-editor-tool {
	min-height: 36px;
	padding: 7px 11px;
	border-color: var(--r2t-editor-border);
	border-radius: 10px;
	background: #ffffff;
	color: #344054;
	font-size: 0.9rem;
}

.r2t-manual-lesson-editor .r2t-editor-tool:hover {
	border-color: var(--r2t-editor-border-strong);
	background: #eef3ff;
	color: #1d4ed8;
}

.r2t-manual-lesson-wordpress-editor {
	position: relative;
	min-width: 0;
	background: #ffffff;
}

.r2t-manual-lesson-editor .wp-editor-wrap {
	margin: 0;
	border: 0;
	background: #ffffff;
}

.r2t-manual-lesson-editor .wp-editor-tools {
	position: relative;
	z-index: 5;
	min-height: 38px;
	padding: 7px 10px 0;
	border-bottom: 1px solid var(--r2t-editor-border);
	background: #ffffff;
}

.r2t-manual-lesson-editor .wp-editor-tabs {
	margin: 0;
}

.r2t-manual-lesson-editor .wp-switch-editor {
	box-sizing: border-box;
	min-height: 31px;
	margin: 0 0 0 5px;
	padding: 6px 12px;
	border: 1px solid var(--r2t-editor-border);
	border-bottom: 0;
	border-radius: 8px 8px 0 0;
	background: #f3f5f8;
	color: #475467;
	font-weight: 750;
}

.r2t-manual-lesson-editor .tmce-active .switch-tmce,
.r2t-manual-lesson-editor .html-active .switch-html {
	background: #ffffff;
	color: var(--r2t-editor-ink);
}

.r2t-manual-lesson-editor .wp-media-buttons {
	padding: 1px 0 6px;
}

.r2t-manual-lesson-editor .wp-media-buttons .button {
	min-height: 32px;
	margin: 0 6px 0 0;
	border-color: var(--r2t-editor-border-strong);
	border-radius: 8px;
	background: #ffffff;
	color: #344054;
	font-weight: 700;
	box-shadow: none;
}

.r2t-manual-lesson-editor .wp-editor-container {
	border: 0;
	border-radius: 0;
	background: #ffffff;
}

.r2t-manual-lesson-editor .mce-tinymce,
.r2t-manual-lesson-editor .mce-container,
.r2t-manual-lesson-editor .mce-panel {
	box-shadow: none;
}

.r2t-manual-lesson-editor .mce-tinymce {
	border: 0 !important;
}

.r2t-manual-lesson-editor .mce-top-part::before {
	box-shadow: none;
}

.r2t-manual-lesson-editor .mce-toolbar-grp,
.r2t-manual-lesson-editor .mce-toolbar .mce-container-body {
	background: #fbfcfe;
}

.r2t-manual-lesson-editor .mce-toolbar-grp {
	padding: 7px 8px 5px !important;
	border-bottom: 1px solid var(--r2t-editor-border) !important;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-btn {
	margin: 1px 2px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-btn:hover,
.r2t-manual-lesson-editor .mce-toolbar .mce-btn:focus,
.r2t-manual-lesson-editor .mce-toolbar .mce-btn.mce-active,
.r2t-manual-lesson-editor .mce-toolbar .mce-btn.mce-active:hover {
	border-color: #c7d2fe;
	background: #eef2ff;
}

.r2t-manual-lesson-editor .mce-edit-area {
	border: 0 !important;
}

.r2t-manual-lesson-editor .mce-edit-area iframe {
	display: block;
	min-height: 520px !important;
	background: #ffffff;
}

.r2t-manual-lesson-editor .mce-statusbar {
	border-top: 1px solid var(--r2t-editor-border) !important;
	background: #fbfcfe;
}

.r2t-manual-lesson-editor .quicktags-toolbar {
	padding: 8px;
	border-bottom: 1px solid var(--r2t-editor-border);
	background: #fbfcfe;
}

.r2t-manual-lesson-editor .quicktags-toolbar input.button {
	min-height: 30px;
	margin: 2px;
	border-color: var(--r2t-editor-border-strong);
	border-radius: 7px;
	background: #ffffff;
	color: #344054;
	font-weight: 700;
	box-shadow: none;
}

.r2t-manual-lesson-editor textarea.wp-editor-area {
	display: block;
	width: 100%;
	min-height: 560px;
	padding: 18px;
	border: 0;
	background: #ffffff;
	color: #172033;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 14px;
	line-height: 1.65;
	resize: vertical;
}

/* --------------------------------------------------------------------------
 * Save state
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-save-region {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 32px;
	padding: 8px 4px 0;
	color: var(--r2t-editor-muted);
	font-size: 0.9rem;
	font-weight: 650;
}

.r2t-manual-lesson-save-indicator {
	width: 9px;
	height: 9px;
	flex: 0 0 9px;
	border-radius: 50%;
	background: #98a2b3;
	box-shadow: 0 0 0 4px rgba(152, 162, 179, 0.14);
}

.r2t-manual-lesson-save-indicator[data-state="dirty"] {
	background: #f59e0b;
	box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

.r2t-manual-lesson-save-indicator[data-state="saving"] {
	background: #2563eb;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
	animation: r2t-editor-pulse 1.15s ease-in-out infinite;
}

.r2t-manual-lesson-save-indicator[data-state="saved"] {
	background: #22c55e;
	box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.r2t-manual-lesson-save-indicator[data-state="error"],
.r2t-manual-lesson-save-indicator[data-state="conflict"] {
	background: #ef4444;
	box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.r2t-manual-lesson-editor[data-save-state="error"] .r2t-manual-lesson-save-region,
.r2t-manual-lesson-editor[data-save-state="conflict"] .r2t-manual-lesson-save-region {
	color: var(--r2t-editor-danger);
}

/* --------------------------------------------------------------------------
 * Collapsible lesson panels
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-panels {
	display: grid;
	gap: 10px;
	margin-top: 14px;
}

.r2t-manual-lesson-panel {
	border: 1px solid var(--r2t-editor-border);
	border-radius: var(--r2t-editor-radius-small);
	background: #ffffff;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(23, 32, 51, 0.04);
}

.r2t-manual-lesson-panel summary {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 52px;
	padding: 13px 48px 13px 16px;
	color: var(--r2t-editor-ink);
	font-weight: 800;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.r2t-manual-lesson-panel summary::-webkit-details-marker {
	display: none;
}

.r2t-manual-lesson-panel summary::after {
	content: "+";
	position: absolute;
	right: 16px;
	top: 50%;
	width: 24px;
	height: 24px;
	margin-top: -12px;
	border-radius: 50%;
	background: var(--r2t-editor-soft-2);
	color: #475467;
	font-size: 18px;
	font-weight: 500;
	line-height: 24px;
	text-align: center;
	transition: transform 160ms ease, background-color 160ms ease;
}

.r2t-manual-lesson-panel[open] summary::after {
	content: "−";
	background: #e8edff;
	color: #2446c5;
	transform: rotate(180deg);
}

.r2t-manual-lesson-panel summary:hover {
	background: #fafbfc;
}

.r2t-panel-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 27px;
	height: 27px;
	margin-left: auto;
	padding: 0 8px;
	border-radius: 999px;
	background: #eef2ff;
	color: #3730a3;
	font-size: 0.83rem;
	font-weight: 850;
}

.r2t-manual-lesson-panel-body {
	padding: 16px;
	border-top: 1px solid var(--r2t-editor-border);
	background: #ffffff;
}

.r2t-manual-lesson-panel-body > :first-child {
	margin-top: 0;
}

.r2t-manual-lesson-panel-body > :last-child {
	margin-bottom: 0;
}

.r2t-manual-lesson-panel-body label {
	display: block;
	margin-bottom: 6px;
	font-weight: 800;
}

.r2t-manual-lesson-panel-body .description {
	margin: 5px 0 12px;
	color: var(--r2t-editor-muted);
	font-size: 0.92rem;
	font-style: normal;
	line-height: 1.5;
}

.r2t-manual-lesson-panel-body textarea,
.r2t-manual-lesson-panel-body input[type="file"] {
	width: 100%;
	margin: 0;
	border: 1px solid var(--r2t-editor-border-strong);
	border-radius: 10px;
	background: #ffffff;
	color: var(--r2t-editor-ink);
	box-shadow: none;
}

.r2t-manual-lesson-panel-body textarea {
	min-height: 132px;
	padding: 12px 13px;
	line-height: 1.55;
	resize: vertical;
}

.r2t-manual-lesson-panel-body input[type="file"] {
	min-height: 44px;
	padding: 6px;
}

.r2t-manual-lesson-panel-body input[type="file"]::file-selector-button {
	min-height: 30px;
	margin-right: 10px;
	padding: 6px 11px;
	border: 1px solid var(--r2t-editor-border-strong);
	border-radius: 7px;
	background: var(--r2t-editor-soft-2);
	color: #344054;
	font-weight: 750;
	cursor: pointer;
}

.r2t-file-upload-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
}

.r2t-manual-lesson-file-list {
	display: grid;
	gap: 9px;
	margin-top: 14px;
}

.r2t-manual-lesson-file {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 11px 12px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 11px;
	background: #fbfcfe;
}

.r2t-manual-lesson-file-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: #e9efff;
	font-size: 1rem;
}

.r2t-manual-lesson-file-copy {
	min-width: 0;
}

.r2t-manual-lesson-file-copy strong,
.r2t-manual-lesson-file-copy span {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.r2t-manual-lesson-file-copy strong {
	font-size: 0.95rem;
}

.r2t-manual-lesson-file-copy span {
	margin-top: 2px;
	color: var(--r2t-editor-muted);
	font-size: 0.82rem;
}

.r2t-empty-state {
	margin: 0;
	padding: 14px;
	border: 1px dashed var(--r2t-editor-border-strong);
	border-radius: 10px;
	background: #fbfcfe;
	color: var(--r2t-editor-muted);
	text-align: center;
}

.r2t-manual-lesson-resource-action {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--r2t-editor-border);
}

.r2t-manual-lesson-resource-action p {
	margin: 0;
	color: var(--r2t-editor-muted);
}

/* Generic styling for resource cards returned by the bridge. */
.r2t-manual-lesson-panel [class*="resource-card"],
.r2t-manual-lesson-panel [class*="resource-item"],
.r2t-manual-lesson-panel .r2t-lesson-resource {
	margin: 8px 0;
	padding: 12px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 11px;
	background: #fbfcfe;
}

/* --------------------------------------------------------------------------
 * Footer action bar
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-footer {
	position: sticky;
	z-index: 20;
	bottom: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-top: 18px;
	padding: 12px;
	border: 1px solid rgba(184, 196, 211, 0.92);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 16px 42px rgba(23, 32, 51, 0.14);
	backdrop-filter: blur(12px);
}


/* --------------------------------------------------------------------------
 * Visual editor bootstrap state
 * ----------------------------------------------------------------------- */

.r2t-manual-editor-readiness {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
	padding: 13px 14px;
	border: 1px solid #bfdbfe;
	border-radius: var(--r2t-editor-radius-small);
	background: #eff6ff;
	color: #1e3a8a;
	box-shadow: 0 5px 16px rgba(37, 99, 235, 0.08);
}

.r2t-manual-editor-readiness > div {
	min-width: 0;
}

.r2t-manual-editor-readiness strong,
.r2t-manual-editor-readiness span {
	display: block;
}

.r2t-manual-editor-readiness strong {
	margin: 0;
	font-weight: 850;
	line-height: 1.3;
}

.r2t-manual-editor-readiness [data-r2t-editor-readiness-message] {
	margin-top: 2px;
	color: #415b8f;
	font-size: 0.9rem;
	line-height: 1.45;
}

.r2t-manual-editor-readiness-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(37, 99, 235, 0.22);
	border-right-color: #2563eb;
	border-radius: 50%;
	animation: r2t-editor-spin 800ms linear infinite;
}

.r2t-manual-editor-readiness[data-editor-state="ready"] {
	border-color: #a7e8bf;
	background: var(--r2t-editor-success-soft);
	color: #14532d;
}

.r2t-manual-editor-readiness[data-editor-state="ready"]
.r2t-manual-editor-readiness-spinner {
	border-color: #86efac;
	border-right-color: #15803d;
	animation: none;
}

.r2t-manual-editor-readiness[data-editor-state="ready"]
.r2t-manual-editor-readiness-spinner::after {
	content: "✓";
	display: block;
	color: #15803d;
	font-size: 13px;
	font-weight: 900;
	line-height: 14px;
	text-align: center;
}

.r2t-manual-editor-readiness[data-editor-state="ready"]
[data-r2t-editor-readiness-message] {
	color: #32724b;
}

.r2t-manual-editor-readiness[data-editor-state="error"] {
	border-color: #f6c0bc;
	background: var(--r2t-editor-danger-soft);
	color: #7a271a;
}

.r2t-manual-editor-readiness[data-editor-state="error"]
.r2t-manual-editor-readiness-spinner {
	border-color: #fda29b;
	border-right-color: #b42318;
	animation: none;
}

.r2t-manual-editor-readiness[data-editor-state="error"]
.r2t-manual-editor-readiness-spinner::after {
	content: "!";
	display: block;
	color: #b42318;
	font-size: 13px;
	font-weight: 900;
	line-height: 14px;
	text-align: center;
}

.r2t-manual-editor-readiness[data-editor-state="error"]
[data-r2t-editor-readiness-message] {
	color: #8a3b32;
}

.r2t-manual-lesson-editor[data-editor-state="loading"]
.r2t-manual-lesson-wordpress-editor {
	visibility: hidden;
	min-height: 520px;
	opacity: 0;
	pointer-events: none;
}

.r2t-manual-lesson-editor[data-editor-state="ready"]
.r2t-manual-lesson-wordpress-editor {
	visibility: visible;
	opacity: 1;
	transition: opacity 180ms ease;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-insert-tools,
.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-wordpress-editor {
	display: none !important;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-editor-shell {
	min-height: 0;
	border-style: dashed;
	background: #fff8f7;
}

/* --------------------------------------------------------------------------
 * Full toolbar support for WordPress TinyMCE 4
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-editor .mce-toolbar-grp {
	max-width: 100%;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #b8c4d3 transparent;
}

.r2t-manual-lesson-editor .mce-toolbar-grp::-webkit-scrollbar {
	height: 7px;
}

.r2t-manual-lesson-editor .mce-toolbar-grp::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: #b8c4d3;
}

.r2t-manual-lesson-editor .mce-toolbar-grp::-webkit-scrollbar-track {
	background: transparent;
}

.r2t-manual-lesson-editor .mce-toolbar,
.r2t-manual-lesson-editor .mce-toolbar .mce-flow-layout {
	min-width: max-content;
	white-space: nowrap;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-flow-layout-item {
	float: none !important;
	display: inline-block !important;
	vertical-align: middle;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-btn-group {
	display: inline-flex !important;
	flex: 0 0 auto;
	vertical-align: middle;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-btn,
.r2t-manual-lesson-editor .mce-toolbar .mce-listbox {
	flex: 0 0 auto;
}

.r2t-manual-lesson-editor .mce-toolbar .mce-listbox button {
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
 * Full toolbar support for TinyMCE 5 and 6
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-editor .tox-tinymce {
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.r2t-manual-lesson-editor .tox .tox-editor-header {
	border-bottom: 1px solid var(--r2t-editor-border);
	box-shadow: none;
}

.r2t-manual-lesson-editor .tox .tox-toolbar-overlord,
.r2t-manual-lesson-editor .tox .tox-toolbar,
.r2t-manual-lesson-editor .tox .tox-toolbar__overflow,
.r2t-manual-lesson-editor .tox .tox-toolbar__primary {
	max-width: 100%;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	flex-wrap: nowrap !important;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.r2t-manual-lesson-editor .tox .tox-toolbar__group {
	flex: 0 0 auto;
	flex-wrap: nowrap;
}

.r2t-manual-lesson-editor .tox .tox-edit-area__iframe {
	min-height: 520px;
	background: #ffffff;
}

.r2t-manual-lesson-editor .tox .tox-statusbar {
	border-top-color: var(--r2t-editor-border);
}

/* --------------------------------------------------------------------------
 * Lesson options and action dialogs
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-eyebrow {
	margin: 0 0 4px;
	color: inherit;
	font-size: 0.74rem;
	font-weight: 850;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	opacity: 0.78;
}

.r2t-lesson-options {
	position: relative;
}

.r2t-lesson-options > summary {
	list-style: none;
}

.r2t-lesson-options > summary::-webkit-details-marker {
	display: none;
}

.r2t-lesson-options-menu {
	position: absolute;
	z-index: 80;
	top: calc(100% + 8px);
	right: 0;
	width: min(280px, calc(100vw - 32px));
	padding: 8px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 14px;
	background: #ffffff;
	box-shadow: 0 18px 45px rgba(23, 32, 51, 0.18);
}

.r2t-lesson-options-menu button {
	display: flex;
	width: 100%;
	align-items: center;
	gap: 10px;
	min-height: 42px;
	padding: 10px 12px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--r2t-editor-ink);
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

.r2t-lesson-options-menu button:hover,
.r2t-lesson-options-menu button:focus-visible {
	background: var(--r2t-editor-soft);
}

.r2t-lesson-options-menu .is-danger {
	color: var(--r2t-editor-danger);
}

.r2t-lesson-options-menu hr {
	margin: 6px 4px;
	border: 0;
	border-top: 1px solid var(--r2t-editor-border);
}

.r2t-lesson-action-dialog {
	width: min(640px, calc(100vw - 24px));
	max-height: calc(100dvh - 24px);
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: transparent;
	overflow: visible;
}

.r2t-lesson-action-dialog::backdrop {
	background: rgba(10, 20, 36, 0.56);
	backdrop-filter: blur(3px);
}

.r2t-lesson-action-dialog-card {
	max-height: calc(100dvh - 24px);
	overflow: auto;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 20px;
	background: #ffffff;
	box-shadow: 0 24px 80px rgba(10, 20, 36, 0.28);
	overscroll-behavior: contain;
}

.r2t-lesson-action-dialog-card > header {
	display: flex;
	justify-content: space-between;
	gap: 18px;
	padding: 22px 24px 16px;
	border-bottom: 1px solid var(--r2t-editor-border);
}

.r2t-lesson-action-dialog-card h2 {
	margin: 2px 0 4px;
	font-size: 1.4rem;
}

.r2t-lesson-action-dialog-card p {
	margin: 0;
	color: var(--r2t-editor-muted);
}

.r2t-dialog-kicker {
	color: var(--r2t-editor-primary);
	font-size: 0.72rem;
	font-weight: 850;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.r2t-dialog-close {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: var(--r2t-editor-soft);
	color: var(--r2t-editor-ink);
	font-size: 1.45rem;
	line-height: 1;
	cursor: pointer;
}

.r2t-dialog-fields {
	display: grid;
	gap: 15px;
	padding: 20px 24px;
}

.r2t-dialog-fields label {
	display: grid;
	gap: 6px;
	font-weight: 750;
}

.r2t-dialog-fields input,
.r2t-dialog-fields select {
	width: 100%;
	min-height: 44px;
	padding: 9px 11px;
	border: 1px solid var(--r2t-editor-border-strong);
	border-radius: 10px;
	background: #ffffff;
	color: var(--r2t-editor-ink);
	box-shadow: none;
}

.r2t-dialog-field-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.r2t-dialog-check {
	display: flex !important;
	grid-template-columns: none !important;
	align-items: flex-start;
	gap: 9px !important;
	font-weight: 600 !important;
}

.r2t-dialog-check input {
	width: auto;
	min-height: 0;
	margin-top: 4px;
}

.r2t-dialog-note {
	padding: 12px;
	border-radius: 10px;
	background: var(--r2t-editor-soft);
	font-size: 0.9rem;
}

.r2t-lesson-action-dialog-card > footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid var(--r2t-editor-border);
	background: var(--r2t-editor-soft);
}

.r2t-dialog-compact {
	max-width: 520px;
}

.r2t-button-danger {
	border-color: var(--r2t-editor-danger) !important;
	background: var(--r2t-editor-danger) !important;
	color: #ffffff !important;
}

.r2t-button-danger:hover {
	border-color: #912018 !important;
	background: #912018 !important;
}

/* --------------------------------------------------------------------------
 * One sticky action area only
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-footer {
	justify-content: flex-end;
	transition: opacity 150ms ease, visibility 150ms ease, transform 150ms ease;
}

.r2t-manual-lesson-footer
[data-r2t-open-panel],
.r2t-manual-lesson-footer
[data-r2t-attach-resource],
.r2t-manual-lesson-footer
button:not([data-r2t-save-lesson]),
.r2t-manual-lesson-footer
a:not([data-r2t-save-lesson]),
.r2t-manual-lesson-footer-secondary {
	display: none !important;
}

.r2t-manual-lesson-footer-primary {
	margin-left: auto;
}

.r2t-manual-lesson-save-button {
	min-width: 170px;
}

.r2t-manual-lesson-editor.is-r2t-dialog-open
.r2t-manual-lesson-footer {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(10px);
}

/* --------------------------------------------------------------------------
 * Mobile editor spacing and safe-area protection
 * ----------------------------------------------------------------------- */

@media (max-width: 720px) {
	.r2t-manual-lesson-editor {
		padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
	}

	.r2t-manual-lesson-form {
		padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	}

	.r2t-manual-editor-readiness {
		grid-template-columns: auto minmax(0, 1fr);
		align-items: start;
		padding: 12px;
	}

	.r2t-manual-editor-readiness [data-r2t-editor-reload] {
		grid-column: 1 / -1;
		width: 100%;
	}

	.r2t-manual-lesson-editor[data-editor-state="loading"]
	.r2t-manual-lesson-wordpress-editor {
		min-height: clamp(380px, 58vh, 500px);
	}

	.r2t-manual-lesson-editor .mce-edit-area iframe,
	.r2t-manual-lesson-editor .tox .tox-edit-area__iframe {
		min-height: clamp(380px, 58vh, 500px) !important;
	}

	.r2t-manual-lesson-editor textarea.wp-editor-area {
		min-height: clamp(400px, 60vh, 520px);
	}

	.r2t-manual-lesson-editor .mce-toolbar-grp,
	.r2t-manual-lesson-editor .tox .tox-toolbar-overlord,
	.r2t-manual-lesson-editor .tox .tox-toolbar,
	.r2t-manual-lesson-editor .tox .tox-toolbar__primary {
		scroll-snap-type: x proximity;
	}

	.r2t-manual-lesson-editor .mce-toolbar .mce-btn-group,
	.r2t-manual-lesson-editor .tox .tox-toolbar__group {
		scroll-snap-align: start;
	}

	.r2t-lesson-options-menu {
		position: fixed;
		right: 12px;
		bottom: calc(18px + env(safe-area-inset-bottom, 0px));
		left: 12px;
		top: auto;
		width: auto;
		max-height: min(70vh, 520px);
		overflow-y: auto;
	}

	.r2t-dialog-field-grid {
		grid-template-columns: 1fr;
	}

	.r2t-lesson-action-dialog {
		width: calc(100vw - 16px);
		max-height: calc(100dvh - 16px);
	}

	.r2t-lesson-action-dialog-card {
		max-height: calc(100dvh - 16px);
		border-radius: 16px;
	}

	.r2t-lesson-action-dialog-card > header,
	.r2t-dialog-fields,
	.r2t-lesson-action-dialog-card > footer {
		padding-right: 16px;
		padding-left: 16px;
	}

	.r2t-lesson-action-dialog-card > footer {
		position: sticky;
		bottom: 0;
		flex-direction: column-reverse;
		padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
	}

	.r2t-lesson-action-dialog-card > footer .r2t-button {
		width: 100%;
	}

	.r2t-manual-lesson-footer {
		position: fixed;
		right: 8px;
		bottom: calc(8px + env(safe-area-inset-bottom, 0px));
		left: 8px;
		z-index: 70;
		margin: 0;
		padding: 8px;
		border-radius: 14px;
	}

	.r2t-manual-lesson-footer-primary {
		display: block !important;
		width: 100%;
		margin: 0;
	}

	.r2t-manual-lesson-save-button {
		width: 100% !important;
		min-width: 0;
		min-height: 48px !important;
	}
}

@media (max-width: 460px) {
	.r2t-manual-editor-readiness {
		grid-template-columns: 1fr;
	}

	.r2t-manual-editor-readiness-spinner {
		display: none;
	}

	.r2t-manual-lesson-editor .mce-toolbar .mce-listbox button {
		max-width: 132px;
	}

	.r2t-manual-lesson-editor .wp-switch-editor {
		padding-right: 9px;
		padding-left: 9px;
	}

	.r2t-lesson-action-dialog-card > header {
		padding-top: 18px;
	}

	.r2t-lesson-action-dialog-card h2 {
		font-size: 1.2rem;
	}
}


/* --------------------------------------------------------------------------
 * Fullscreen mode
 * ----------------------------------------------------------------------- */

.r2t-manual-lesson-editor.is-r2t-fullscreen,
.r2t-manual-lesson-editor:fullscreen,
.r2t-manual-lesson-editor:-webkit-full-screen {
	position: fixed;
	inset: 0;
	z-index: 999999;
	width: 100vw;
	max-width: none;
	height: 100vh;
	margin: 0;
	padding: 12px;
	background: #eef2f7;
	overflow: auto;
	overscroll-behavior: contain;
}

.r2t-manual-lesson-editor.is-r2t-fullscreen .r2t-manual-lesson-header,
.r2t-manual-lesson-editor:fullscreen .r2t-manual-lesson-header,
.r2t-manual-lesson-editor:-webkit-full-screen .r2t-manual-lesson-header {
	min-height: 94px;
	border-radius: 14px 14px 0 0;
}

.r2t-manual-lesson-editor.is-r2t-fullscreen .r2t-manual-lesson-form,
.r2t-manual-lesson-editor:fullscreen .r2t-manual-lesson-form,
.r2t-manual-lesson-editor:-webkit-full-screen .r2t-manual-lesson-form {
	border-radius: 0 0 14px 14px;
}

.r2t-manual-lesson-editor.is-r2t-fullscreen .mce-edit-area iframe,
.r2t-manual-lesson-editor:fullscreen .mce-edit-area iframe,
.r2t-manual-lesson-editor:-webkit-full-screen .mce-edit-area iframe {
	min-height: max(520px, calc(100vh - 420px)) !important;
}

.r2t-manual-lesson-editor.is-r2t-fullscreen textarea.wp-editor-area,
.r2t-manual-lesson-editor:fullscreen textarea.wp-editor-area,
.r2t-manual-lesson-editor:-webkit-full-screen textarea.wp-editor-area {
	min-height: max(560px, calc(100vh - 390px));
}

.r2t-manual-lesson-editor.is-r2t-fullscreen .r2t-manual-lesson-footer,
.r2t-manual-lesson-editor:fullscreen .r2t-manual-lesson-footer,
.r2t-manual-lesson-editor:-webkit-full-screen .r2t-manual-lesson-footer {
	bottom: 0;
}

/* --------------------------------------------------------------------------
 * Responsive behaviour
 * ----------------------------------------------------------------------- */

@media (max-width: 900px) {
	.r2t-manual-lesson-title-row {
		grid-template-columns: 1fr;
	}

	.r2t-manual-lesson-top-actions {
		justify-content: flex-start;
	}

	.r2t-manual-lesson-footer {
		align-items: stretch;
		flex-direction: column;
	}

	.r2t-manual-lesson-footer-primary,
	.r2t-manual-lesson-footer-secondary {
		width: 100%;
	}

	.r2t-manual-lesson-footer-secondary {
		justify-content: flex-end;
	}
}

@media (max-width: 700px) {
	.r2t-manual-lesson-editor {
		width: 100%;
		padding: 6px;
	}

	.r2t-manual-lesson-header {
		align-items: flex-start;
		min-height: 118px;
		padding: 20px 16px;
		border-radius: 16px 16px 0 0;
	}

	.r2t-manual-lesson-header-actions {
		gap: 6px;
	}

	.r2t-manual-lesson-header-link {
		width: 42px;
		padding: 0;
	}

	.r2t-manual-lesson-header-link span:last-child {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.r2t-manual-lesson-form {
		padding: 10px;
		border-radius: 0 0 16px 16px;
	}

	.r2t-manual-lesson-title-row {
		padding: 10px;
	}

	.r2t-manual-lesson-top-actions,
	.r2t-manual-lesson-footer-primary,
	.r2t-manual-lesson-footer-secondary {
		display: grid;
		grid-template-columns: 1fr 1fr;
		width: 100%;
	}

	.r2t-manual-lesson-status-label,
	.r2t-manual-lesson-status-label select,
	.r2t-manual-lesson-editor .r2t-button {
		width: 100%;
	}

	.r2t-manual-lesson-insert-tools {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		padding: 8px;
	}

	.r2t-manual-lesson-editor .r2t-editor-tool {
		min-width: 0;
		padding: 7px 5px;
		font-size: 0.82rem;
	}

	.r2t-manual-lesson-editor .mce-toolbar-grp {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.r2t-manual-lesson-editor .mce-edit-area iframe {
		min-height: 470px !important;
	}

	.r2t-file-upload-row {
		grid-template-columns: 1fr;
	}

	.r2t-manual-lesson-file {
		grid-template-columns: auto minmax(0, 1fr);
	}

	.r2t-manual-lesson-file .r2t-button {
		grid-column: 1 / -1;
	}

	.r2t-manual-lesson-resource-action {
		align-items: stretch;
		flex-direction: column;
	}

	.r2t-manual-lesson-notice,
	.r2t-manual-lesson-conflict {
		align-items: stretch;
		flex-direction: column;
	}

	.r2t-manual-lesson-footer {
		bottom: 6px;
		padding: 9px;
		border-radius: 13px;
	}
}

@media (max-width: 460px) {
	.r2t-manual-lesson-context {
		font-size: 1.15rem;
	}

	.r2t-manual-lesson-time {
		font-size: 0.96rem;
	}

	.r2t-manual-lesson-date {
		font-size: 0.82rem;
	}

	.r2t-manual-lesson-top-actions,
	.r2t-manual-lesson-footer-primary,
	.r2t-manual-lesson-footer-secondary {
		grid-template-columns: 1fr;
	}

	.r2t-manual-lesson-insert-tools {
		grid-template-columns: 1fr 1fr;
	}

	.r2t-manual-lesson-panel summary {
		padding-left: 13px;
	}
}

/* --------------------------------------------------------------------------
 * Accessibility and motion preferences
 * ----------------------------------------------------------------------- */

@keyframes r2t-editor-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes r2t-editor-pulse {
	0%, 100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(0.76);
		opacity: 0.58;
	}
}

@media (prefers-reduced-motion: reduce) {
	.r2t-manual-lesson-editor *,
	.r2t-manual-lesson-editor *::before,
	.r2t-manual-lesson-editor *::after {
		scroll-behavior: auto !important;
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}

@media (forced-colors: active) {
	.r2t-manual-lesson-header,
	.r2t-manual-lesson-form,
	.r2t-manual-lesson-editor-shell,
	.r2t-manual-lesson-panel,
	.r2t-manual-lesson-footer {
		border: 1px solid CanvasText;
		box-shadow: none;
	}

	.r2t-manual-lesson-header {
		background: Canvas;
		color: CanvasText;
	}

	.r2t-manual-lesson-header-link,
	.r2t-manual-lesson-icon-button {
		border-color: ButtonText;
		background: ButtonFace;
		color: ButtonText !important;
	}

	.r2t-manual-lesson-save-indicator {
		border: 1px solid CanvasText;
	}
}

/* --------------------------------------------------------------------------
 * Print: lesson body first, interface chrome removed
 * ----------------------------------------------------------------------- */

@media print {
	@page {
		size: A4 portrait;
		margin: 9mm;
	}

	.r2t-manual-lesson-editor {
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
		color: #111827 !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	.r2t-manual-lesson-header {
		position: relative !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 7mm !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		color: #ffffff !important;
		overflow: hidden !important;
		break-after: avoid-page;
		page-break-after: avoid;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	.r2t-manual-lesson-header-colour {
		display: block !important;
		position: absolute !important;
		inset: 0 !important;
		z-index: 0 !important;
		width: 100% !important;
		height: 100% !important;
		pointer-events: none !important;
	}

	.r2t-manual-lesson-header::after {
		display: none !important;
	}

	.r2t-manual-lesson-header-copy {
		position: relative !important;
		z-index: 1 !important;
	}

	.r2t-manual-lesson-header .r2t-manual-lesson-context,
	.r2t-manual-lesson-header .r2t-manual-lesson-time,
	.r2t-manual-lesson-header .r2t-manual-lesson-date,
	.r2t-manual-lesson-header .r2t-manual-lesson-eyebrow {
		color: #ffffff !important;
	}

	.r2t-manual-lesson-header .r2t-manual-lesson-context {
		font-size: 20pt !important;
	}

	.r2t-manual-lesson-header .r2t-manual-lesson-time {
		margin-top: 2mm !important;
		font-size: 13pt !important;
	}

	.r2t-manual-lesson-header-actions,
	.r2t-manual-lesson-form,
	.r2t-manual-lesson-notice,
	.r2t-manual-lesson-conflict,
	.r2t-manual-editor-readiness,
	.r2t-lesson-action-dialogs,
	.r2t-table-grid-popover,
	.r2t-colour-popover {
		display: none !important;
	}

	.r2t-manual-lesson-print-mirror {
		display: block !important;
		margin: 0 !important;
		padding: 4mm 7mm 0 !important;
		border: 0 !important;
		background: #ffffff !important;
		box-shadow: none !important;
	}

	.r2t-manual-lesson-print-mirror > h1 {
		display: none !important;
	}

	.r2t-manual-lesson-print-rich {
		font-size: 11pt !important;
		line-height: 1.45 !important;
	}

	.r2t-manual-lesson-print-rich > :first-child {
		margin-top: 0 !important;
	}

	.r2t-manual-lesson-print-rich > :last-child {
		margin-bottom: 0 !important;
	}

	.r2t-manual-lesson-print-rich p,
	.r2t-manual-lesson-print-rich ul,
	.r2t-manual-lesson-print-rich ol,
	.r2t-manual-lesson-print-rich blockquote {
		margin-top: 0 !important;
		margin-bottom: 3mm !important;
	}

	.r2t-manual-lesson-print-rich table {
		width: 100% !important;
		margin: 4mm 0 !important;
		border-collapse: collapse !important;
		break-inside: auto;
	}

	.r2t-manual-lesson-print-rich th,
	.r2t-manual-lesson-print-rich td {
		padding: 2.2mm !important;
		border: 1px solid #7b8796 !important;
		vertical-align: top !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	.r2t-manual-lesson-print-rich hr {
		margin: 4mm 0 !important;
		border: 0 !important;
		border-top: 1.5pt solid #536273 !important;
	}

	.r2t-manual-lesson-print-rich img,
	.r2t-manual-lesson-print-rich video,
	.r2t-manual-lesson-print-rich iframe {
		max-width: 100% !important;
		height: auto !important;
	}

	.r2t-manual-lesson-print-section {
		margin-top: 5mm !important;
		padding-top: 4mm !important;
		border-top: 1px solid #cbd5e1 !important;
		break-inside: avoid-page;
	}

	.r2t-manual-lesson-print-section.is-empty {
		display: none !important;
	}

	.r2t-manual-lesson-print-section h2 {
		margin: 0 0 2mm !important;
		font-size: 13pt !important;
		color: #102846 !important;
	}

	.r2t-manual-lesson-print-section ul {
		margin: 0 !important;
		padding-left: 6mm !important;
	}

	.r2t-print-empty-copy {
		color: #64748b !important;
		font-style: italic;
	}
}

/* ==========================================================================
 * Single dynamic WordPress editor architecture
 *
 * PHP renders one plain textarea. wp.editor.initialize() upgrades that same
 * textarea once, so Add Media, Visual/Code and the toolbar cannot duplicate.
 * ======================================================================= */

.r2t-manual-lesson-plain-textarea {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 520px;
	margin: 0;
	padding: 18px;
	border: 0;
	border-radius: 0;
	background: #ffffff;
	color: var(--r2t-editor-ink);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 15px;
	line-height: 1.65;
	resize: vertical;
	box-shadow: inset 0 0 0 1px transparent;
}

.r2t-manual-lesson-plain-textarea:focus {
	outline: 0;
	box-shadow: inset 0 0 0 3px rgba(37, 99, 235, 0.42);
}

.r2t-manual-lesson-editor[data-editor-state="loading"]
.r2t-manual-lesson-wordpress-editor {
	visibility: visible !important;
	min-height: 520px;
	opacity: 1 !important;
	pointer-events: auto !important;
}

.r2t-manual-lesson-editor[data-editor-state="loading"]
.r2t-manual-lesson-plain-textarea {
	background:
		linear-gradient(110deg, #ffffff 8%, #f6f8fc 18%, #ffffff 33%);
	background-size: 220% 100%;
	animation: r2t-editor-loading-surface 1.35s linear infinite;
}

.r2t-manual-lesson-editor[data-editor-state="ready"]
.r2t-manual-lesson-wordpress-editor,
.r2t-manual-lesson-editor[data-editor-state="error"]
.r2t-manual-lesson-wordpress-editor {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-insert-tools {
	display: grid !important;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-wordpress-editor {
	display: block !important;
	min-height: 420px;
	border: 1px solid #f4b8b2;
	background: #ffffff;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-editor-shell {
	min-height: 0;
	border-style: solid;
	background: #ffffff;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-plain-textarea,
.r2t-manual-lesson-editor.r2t-editor-fallback-active
textarea.wp-editor-area {
	display: block !important;
	visibility: visible !important;
	min-height: 420px;
	background: #ffffff;
	color: var(--r2t-editor-ink);
	opacity: 1 !important;
	pointer-events: auto !important;
}

.r2t-manual-lesson-editor.r2t-editor-fallback-active
.r2t-manual-lesson-save-region {
	margin-top: 12px;
}

/* The dedicated readiness panel already explains editor failure. Avoid a
 * second, visually competing save-status alarm for the same event. */
.r2t-manual-lesson-editor[data-editor-state="error"]
.r2t-manual-lesson-save-region {
	color: var(--r2t-editor-muted);
}

@keyframes r2t-editor-loading-surface {
	0% {
		background-position: 100% 0;
	}
	100% {
		background-position: -100% 0;
	}
}

@media (max-width: 720px) {
	.r2t-manual-lesson-plain-textarea,
	.r2t-manual-lesson-editor.r2t-editor-fallback-active
	.r2t-manual-lesson-plain-textarea,
	.r2t-manual-lesson-editor.r2t-editor-fallback-active
	textarea.wp-editor-area {
		min-height: clamp(400px, 60vh, 520px);
		padding: 15px;
		font-size: 14px;
	}

	.r2t-manual-lesson-editor[data-editor-state="loading"]
	.r2t-manual-lesson-wordpress-editor {
		min-height: clamp(400px, 60vh, 520px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.r2t-manual-lesson-editor[data-editor-state="loading"]
	.r2t-manual-lesson-plain-textarea {
		animation: none;
		background: #ffffff;
	}
}



/* Ready2Teach 1.9.1: Chalk-style copy and one-step shift dialogs */
.r2t-lesson-action-dialog.r2t-copy-dialog {
	width: min(920px, calc(100vw - 24px));
}
.r2t-copy-dialog .r2t-lesson-action-dialog-card {
	max-height: min(90vh, 820px);
	overflow: auto;
}
.r2t-copy-workspace {
	display: grid;
	grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr);
	gap: 0;
	border-bottom: 1px solid var(--r2t-editor-border);
}
.r2t-copy-calendar-panel,
.r2t-copy-session-panel {
	min-width: 0;
	padding: 20px 24px 22px;
}
.r2t-copy-calendar-panel {
	border-right: 1px solid var(--r2t-editor-border);
	background: #fbfcff;
}
.r2t-copy-section-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}
.r2t-copy-section-heading > div {
	display: flex;
	align-items: center;
	gap: 9px;
}
.r2t-copy-section-heading h3 {
	margin: 0;
	font-size: 1rem;
	color: var(--r2t-editor-ink);
}
.r2t-copy-section-heading > span {
	color: var(--r2t-editor-muted);
	font-size: .8rem;
	font-weight: 800;
	white-space: nowrap;
}
.r2t-copy-step {
	display: grid;
	place-items: center;
	width: 25px;
	height: 25px;
	border-radius: 50%;
	background: var(--r2t-editor-primary);
	color: #fff;
	font-size: .76rem;
	font-weight: 900;
}
.r2t-copy-calendar-toolbar {
	display: grid;
	grid-template-columns: 40px 1fr 40px;
	align-items: center;
	margin-bottom: 10px;
}
.r2t-copy-calendar-toolbar strong {
	text-align: center;
	color: var(--r2t-editor-ink);
}
.r2t-copy-calendar-toolbar button {
	width: 36px;
	height: 36px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 10px;
	background: #fff;
	color: var(--r2t-editor-ink);
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
}
.r2t-copy-calendar-toolbar button:last-child {
	justify-self: end;
}
.r2t-copy-calendar-toolbar button:hover,
.r2t-copy-calendar-toolbar button:focus-visible {
	border-color: var(--r2t-editor-primary);
	outline: 3px solid rgba(37, 99, 235, .13);
}
.r2t-copy-calendar-weekdays,
.r2t-copy-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 5px;
}
.r2t-copy-calendar-weekdays {
	margin-bottom: 5px;
}
.r2t-copy-calendar-weekdays span {
	padding: 4px 0;
	color: var(--r2t-editor-muted);
	font-size: .68rem;
	font-weight: 850;
	text-align: center;
	text-transform: uppercase;
}
.r2t-copy-calendar-grid button,
.r2t-copy-calendar-spacer {
	aspect-ratio: 1;
	min-width: 0;
}
.r2t-copy-calendar-grid button {
	border: 1px solid transparent;
	border-radius: 10px;
	background: transparent;
	color: var(--r2t-editor-ink);
	font-weight: 750;
	cursor: pointer;
}
.r2t-copy-calendar-grid button:hover:not(:disabled),
.r2t-copy-calendar-grid button:focus-visible:not(:disabled) {
	border-color: var(--r2t-editor-primary);
	background: #eef4ff;
	outline: none;
}
.r2t-copy-calendar-grid button.is-selected {
	border-color: var(--r2t-editor-primary);
	background: var(--r2t-editor-primary);
	color: #fff;
	box-shadow: 0 5px 14px rgba(37, 99, 235, .22);
}
.r2t-copy-calendar-grid button:disabled {
	color: #c2cad5;
	cursor: not-allowed;
}
.r2t-copy-help {
	margin: -4px 0 12px !important;
	font-size: .85rem;
}
.r2t-copy-session-list {
	display: grid;
	gap: 9px;
	max-height: 310px;
	overflow: auto;
	padding-right: 3px;
}
.r2t-copy-empty {
	display: grid;
	min-height: 148px;
	place-items: center;
	padding: 22px;
	border: 1px dashed var(--r2t-editor-border-strong);
	border-radius: 14px;
	background: var(--r2t-editor-soft);
	color: var(--r2t-editor-muted);
	text-align: center;
}
.r2t-copy-session-card {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 12px;
	align-items: center;
	min-height: 62px;
	padding: 11px 13px 11px 17px;
	overflow: hidden;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 13px;
	background: #fff;
	cursor: pointer;
}
.r2t-copy-session-card::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 5px;
	background: var(--r2t-copy-session-colour, #64748b);
}
.r2t-copy-session-card:hover {
	border-color: var(--r2t-editor-border-strong);
	box-shadow: 0 6px 16px rgba(23, 32, 51, .08);
}
.r2t-copy-session-card:has(input:checked) {
	border-color: var(--r2t-copy-session-colour, var(--r2t-editor-primary));
	background: #fbfdff;
}
.r2t-copy-session-card input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}
.r2t-copy-session-card-copy {
	display: grid;
	gap: 3px;
	min-width: 0;
	padding-left: 2px;
}
.r2t-copy-session-card-copy strong {
	overflow: hidden;
	color: var(--r2t-editor-ink);
	text-overflow: ellipsis;
	white-space: nowrap;
}
.r2t-copy-session-card-copy small {
	color: var(--r2t-editor-muted);
}
.r2t-copy-session-card-tick {
	display: grid;
	place-items: center;
	width: 27px;
	height: 27px;
	border: 2px solid var(--r2t-editor-border-strong);
	border-radius: 50%;
	color: transparent;
	font-weight: 900;
}
.r2t-copy-session-card input:checked ~ .r2t-copy-session-card-tick {
	border-color: var(--r2t-copy-session-colour, var(--r2t-editor-primary));
	background: var(--r2t-copy-session-colour, var(--r2t-editor-primary));
	color: #fff;
}
.r2t-copy-preferences {
	display: grid;
	gap: 14px;
	padding: 18px 24px;
}
.r2t-copy-conflict-policy {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
}
.r2t-copy-conflict-policy legend {
	grid-column: 1 / -1;
	margin-bottom: 1px;
	color: var(--r2t-editor-ink);
	font-size: .84rem;
	font-weight: 800;
}
.r2t-copy-conflict-policy label {
	display: flex;
	gap: 9px;
	align-items: flex-start;
	padding: 11px;
	border: 1px solid var(--r2t-editor-border);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
}
.r2t-copy-conflict-policy label:has(input:checked) {
	border-color: var(--r2t-editor-primary);
	background: #f7f9ff;
}
.r2t-copy-conflict-policy input {
	margin-top: 3px;
}
.r2t-copy-conflict-policy span {
	display: grid;
	gap: 2px;
}
.r2t-copy-conflict-policy small {
	color: var(--r2t-editor-muted);
	line-height: 1.35;
}
@media (max-width: 760px) {
	.r2t-lesson-action-dialog.r2t-copy-dialog {
		width: min(100%, calc(100vw - 16px));
	}
	.r2t-copy-dialog .r2t-lesson-action-dialog-card {
		max-height: 94vh;
	}
	.r2t-copy-workspace {
		grid-template-columns: 1fr;
	}
	.r2t-copy-calendar-panel {
		border-right: 0;
		border-bottom: 1px solid var(--r2t-editor-border);
	}
	.r2t-copy-calendar-panel,
	.r2t-copy-session-panel,
	.r2t-copy-preferences {
		padding-left: 16px;
		padding-right: 16px;
	}
	.r2t-copy-conflict-policy {
		grid-template-columns: 1fr;
	}
	.r2t-copy-session-list {
		max-height: none;
	}
}


/* Ready2Teach visual-only lesson editor: hide WordPress mode tabs. */
.r2t-manual-lesson-editor .wp-editor-tabs {
	display: none !important;
}
.r2t-manual-lesson-editor .wp-editor-tools {
	min-height: 0;
	padding-top: 7px;
}

/* --------------------------------------------------------------------------
 * Ready2Teach editor popovers: table chooser and colour palettes
 * ----------------------------------------------------------------------- */

.r2t-table-grid-popover,
.r2t-colour-popover {
	position: fixed;
	z-index: 1000002;
	box-sizing: border-box;
	width: min(500px, calc(100vw - 24px));
	padding: 0;
	border: 1px solid rgba(15, 23, 42, .12);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 18px 46px rgba(15, 23, 42, .26);
	overflow: hidden;
}

.r2t-colour-popover {
	width: min(390px, calc(100vw - 24px));
}

.r2t-editor-popover-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 58px;
	padding: 12px 14px 12px 20px;
	border-bottom: 1px solid var(--r2t-editor-border, #d8dee8);
	background: #fff;
	color: #172033;
	font-size: 1rem;
}

.r2t-editor-popover-header strong {
	font-size: 1.02rem;
	font-weight: 850;
}

.r2t-editor-popover-close {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #f1f5f9;
	color: #172033;
	font-size: 1.55rem;
	line-height: 1;
	cursor: pointer;
}

.r2t-editor-popover-close:hover,
.r2t-editor-popover-close:focus-visible {
	background: #e2e8f0;
	outline: 3px solid rgba(37, 99, 235, .22);
}

.r2t-editor-popover-body {
	padding: 20px;
}

.r2t-editor-popover-footer {
	display: flex;
	justify-content: flex-end;
	padding: 12px 16px;
	border-top: 1px solid var(--r2t-editor-border, #d8dee8);
	background: #f8fafc;
}

.r2t-editor-popover-cancel,
.r2t-colour-clear {
	appearance: none;
	min-height: 40px;
	padding: 8px 15px;
	border: 1px solid #b8c4d3;
	border-radius: 999px;
	background: #fff;
	color: #172033;
	font-weight: 800;
	cursor: pointer;
}

.r2t-editor-popover-cancel:hover,
.r2t-colour-clear:hover {
	border-color: #64748b;
	background: #f8fafc;
}

.r2t-table-grid-size {
	margin: 0 0 14px;
	color: #111827;
	font-size: 27px;
	font-weight: 500;
	line-height: 1.15;
	text-align: center;
}

.r2t-table-grid {
	display: grid;
	grid-template-columns: repeat(10, minmax(20px, 1fr));
	gap: 6px;
	width: 100%;
}

.r2t-table-grid-cell {
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: 1 / 1;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid #d5d9df;
	border-radius: 3px;
	background: #fff;
	box-shadow: none;
	cursor: pointer;
	touch-action: manipulation;
}

.r2t-table-grid-cell:hover,
.r2t-table-grid-cell:focus,
.r2t-table-grid-cell.is-selected {
	border-color: #0284c7;
	outline: 0;
	background: #bae6fd;
}

.r2t-table-grid-cell:focus-visible,
.r2t-colour-swatch:focus-visible {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb;
}

.r2t-colour-palette {
	display: grid;
	grid-template-columns: repeat(5, minmax(42px, 1fr));
	gap: 10px;
}

.r2t-colour-swatch {
	appearance: none;
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	min-width: 42px;
	min-height: 42px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(15, 23, 42, .22);
	border-radius: 10px;
	background: var(--r2t-swatch-colour, #fff);
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .48);
	cursor: pointer;
}

.r2t-colour-swatch:hover {
	transform: translateY(-1px);
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .62), 0 5px 12px rgba(15, 23, 42, .16);
}

.r2t-colour-clear {
	width: 100%;
	margin-top: 16px;
}

/* Keep inserted lesson tables comfortable and visibly editable. */
.r2t-manual-lesson-editor .mce-content-body table.r2t-lesson-table,
.r2t-manual-lesson-editor .tox-edit-area table.r2t-lesson-table {
	width: 100%;
	border-collapse: collapse;
}

@media (max-width: 560px) {
	.r2t-table-grid-popover,
	.r2t-colour-popover {
		width: calc(100vw - 16px);
		border-radius: 14px;
	}

	.r2t-editor-popover-body {
		padding: 16px;
	}

	.r2t-table-grid {
		gap: 5px;
	}

	.r2t-table-grid-size {
		font-size: 24px;
	}

	.r2t-colour-palette {
		gap: 8px;
	}
}

@media (max-width: 400px) {
	.r2t-table-grid {
		gap: 4px;
	}

	.r2t-colour-palette {
		grid-template-columns: repeat(4, minmax(42px, 1fr));
	}
}

/* Ready2Teach 1.9.5: media is attached as a resource/file, not embedded in lesson prose. */
.r2t-manual-lesson-insert-tools {
	display: none !important;
}
