/**
 * AI Marketing Expert - Global Styles
 */

// Design tokens — Donezo-inspired green palette
:root {
	--aime-primary: #1B5E20;
	--aime-primary-hover: #145218;
	--aime-primary-dark: #0E3A12;
	--aime-primary-light: rgba(27, 94, 32, 0.07);
	--aime-primary-rgb: 27, 94, 32;
	--aime-accent: #2E7D32;
	--aime-accent-light: rgba(46, 125, 50, 0.10);
	--aime-brand-orange: #FF6B35;
	--aime-success: #2E7D32;
	--aime-success-light: rgba(46, 125, 50, 0.08);
	--aime-warning: #F9A825;
	--aime-warning-light: rgba(249, 168, 37, 0.08);
	// #F9A825 on a tinted background fails contrast at label sizes, so warning
	// *text* gets its own darker value rather than reusing the signal colour.
	--aime-warning-dark: #8A5A00;
	--aime-brand-orange-light: rgba(255, 107, 53, 0.10);
	--aime-error: #D32F2F;
	--aime-error-light: rgba(211, 47, 47, 0.08);
	--aime-error-dark: #9B1C1C;
	--aime-info: #1565C0;
	--aime-info-light: rgba(21, 101, 192, 0.08);
	--aime-info-dark: #0F4C93;
	--aime-text: #1a2e1a;
	--aime-text-light: #5f7562;
	--aime-text-muted: #8fa893;
	--aime-border: #d5e2d5;
	--aime-border-light: #e8f0e8;
	--aime-bg: #f4f8f4;
	--aime-bg-subtle: #eaf2ea;
	--aime-white: #ffffff;
	--aime-sidebar-width: 250px;
	--aime-sidebar-collapsed: 64px;
	--aime-header-height: 60px;
	--aime-radius: 12px;
	--aime-radius-sm: 5px;
	--aime-radius-lg: 16px;
	// Controls and buttons share one height so a filter select, a search box
	// and the button beside them line up on a single baseline.
	--aime-control-h: 36px;
	--aime-focus-ring: 0 0 0 3px rgba(var(--aime-primary-rgb), 0.14);
	--aime-focus-ring-error: 0 0 0 3px rgba(211, 47, 47, 0.14);
	--aime-shadow: 0 1px 3px rgba(27, 94, 32, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
	--aime-shadow-md: 0 4px 12px rgba(27, 94, 32, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
	--aime-shadow-lg: 0 12px 24px rgba(27, 94, 32, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
	--aime-shadow-xl: 0 20px 40px rgba(27, 94, 32, 0.10), 0 8px 16px rgba(0, 0, 0, 0.05);
	--aime-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	--aime-transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	// Motion vocabulary. Feedback is fast enough to read as the click itself;
	// only a layer that actually arrives from somewhere gets the entrance
	// duration, and it decelerates hard so it lands rather than drifts.
	--aime-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--aime-transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
	--aime-enter: 0.26s var(--aime-ease-out);
	--aime-enter-quick: 0.16s var(--aime-ease-out);
	// The dim behind a dialog is tinted with the house ink, not neutral black,
	// so the page reads as dimmed rather than as covered by a foreign sheet.
	--aime-overlay: rgba(16, 38, 18, 0.52);
	--aime-radius-pill: 50px;
	--aime-gradient: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #43A047 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(27, 94, 32, 0.05) 0%, rgba(46, 125, 50, 0.02) 100%);
}

// ============================================
// PER-MODULE ACCENT THEMES (warm-to-cool spectrum)
// Redefining the primary/accent tokens on the module wrapper cascades
// automatically to buttons, input focus rings, active tabs, the active
// sidebar item, gradients, and WP-native controls (toggles/checkboxes/sliders).
// Overview / Settings keep the brand green from :root above.
// ============================================
.aime-app-layout[data-module="content-generator"] {
	--aime-primary: #4338CA;
	--aime-primary-hover: #3730A3;
	--aime-primary-dark: #312E81;
	--aime-primary-light: rgba(67, 56, 202, 0.07);
	--aime-primary-rgb: 67, 56, 202;
	--aime-accent: #6366F1;
	--aime-accent-light: rgba(99, 102, 241, 0.10);
	--aime-gradient: linear-gradient(135deg, #4338CA 0%, #6366F1 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(67, 56, 202, 0.05) 0%, rgba(99, 102, 241, 0.02) 100%);
	--wp-admin-theme-color: #4338CA;
	--wp-admin-theme-color-darker-10: #3730A3;
	--wp-admin-theme-color-darker-20: #312E81;
	--wp-components-color-accent: #4338CA;
	--wp-components-color-accent-darker-10: #3730A3;
}

.aime-app-layout[data-module="social-media"] {
	--aime-primary: #0E7490;
	--aime-primary-hover: #155E75;
	--aime-primary-dark: #164E63;
	--aime-primary-light: rgba(14, 116, 144, 0.07);
	--aime-primary-rgb: 14, 116, 144;
	--aime-accent: #06B6D4;
	--aime-accent-light: rgba(6, 182, 212, 0.10);
	--aime-gradient: linear-gradient(135deg, #0E7490 0%, #06B6D4 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(14, 116, 144, 0.05) 0%, rgba(6, 182, 212, 0.02) 100%);
	--wp-admin-theme-color: #0E7490;
	--wp-admin-theme-color-darker-10: #155E75;
	--wp-admin-theme-color-darker-20: #164E63;
	--wp-components-color-accent: #0E7490;
	--wp-components-color-accent-darker-10: #155E75;
}

.aime-app-layout[data-module="email-marketing"] {
	--aime-primary: #BE123C;
	--aime-primary-hover: #9F1239;
	--aime-primary-dark: #881337;
	--aime-primary-light: rgba(190, 18, 60, 0.07);
	--aime-primary-rgb: 190, 18, 60;
	--aime-accent: #E11D48;
	--aime-accent-light: rgba(225, 29, 72, 0.10);
	--aime-gradient: linear-gradient(135deg, #BE123C 0%, #E11D48 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(190, 18, 60, 0.05) 0%, rgba(225, 29, 72, 0.02) 100%);
	--wp-admin-theme-color: #BE123C;
	--wp-admin-theme-color-darker-10: #9F1239;
	--wp-admin-theme-color-darker-20: #881337;
	--wp-components-color-accent: #BE123C;
	--wp-components-color-accent-darker-10: #9F1239;
}

.aime-app-layout[data-module="seo"] {
	--aime-primary: #B45309;
	--aime-primary-hover: #92400E;
	--aime-primary-dark: #78350F;
	--aime-primary-light: rgba(180, 83, 9, 0.07);
	--aime-primary-rgb: 180, 83, 9;
	--aime-accent: #D97706;
	--aime-accent-light: rgba(217, 119, 6, 0.10);
	--aime-gradient: linear-gradient(135deg, #B45309 0%, #D97706 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(180, 83, 9, 0.05) 0%, rgba(217, 119, 6, 0.02) 100%);
	--wp-admin-theme-color: #B45309;
	--wp-admin-theme-color-darker-10: #92400E;
	--wp-admin-theme-color-darker-20: #78350F;
	--wp-components-color-accent: #B45309;
	--wp-components-color-accent-darker-10: #92400E;
}

.aime-app-layout[data-module="chatbot"] {
	--aime-primary: #7C3AED;
	--aime-primary-hover: #6D28D9;
	--aime-primary-dark: #5B21B6;
	--aime-primary-light: rgba(124, 58, 237, 0.07);
	--aime-primary-rgb: 124, 58, 237;
	--aime-accent: #8B5CF6;
	--aime-accent-light: rgba(139, 92, 246, 0.10);
	--aime-gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 100%);
	--aime-gradient-soft: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
	--wp-admin-theme-color: #7C3AED;
	--wp-admin-theme-color-darker-10: #6D28D9;
	--wp-admin-theme-color-darker-20: #5B21B6;
	--wp-components-color-accent: #7C3AED;
	--wp-components-color-accent-darker-10: #6D28D9;
}

// ============================================
// ROOM WAYFINDING SCALE
// The same five accents as the per-module themes above, but exposed
// globally so cross-module surfaces (Overview charts, module summary
// cards, any future roll-up) can point at a room they are not currently
// standing in. A module's own chrome still reads --aime-primary; these
// tokens are only for *referring* to another room.
// Keep in sync with the [data-module] blocks above — these are the
// single source of truth for "what colour is Email?".
// ============================================
:root {
	--aime-room-email: #BE123C;
	--aime-room-content: #4338CA;
	--aime-room-seo: #B45309;
	--aime-room-chatbot: #7C3AED;
	--aime-room-social: #0E7490;

	// Muted counterpart for the second slice of a two-part chart,
	// so "the rest" never competes with the room's own colour.
	--aime-room-rest: #cbd8cc;
}

// Reset WP admin styles in our container
.aime-dashboard-wrap {
	margin: 0;
	padding: 0;
	overflow-x: hidden;
}

// Dashboard Layout
.aime-dashboard {
	display: flex;
	min-height: calc(100vh - 32px);
	background: var(--aime-bg);
	margin-left: -20px;
	margin-top: -20px;
}

// Sidebar
.aime-sidebar {
	width: var(--aime-sidebar-width);
	background: var(--aime-white);
	border-right: 1px solid var(--aime-border);
	display: flex;
	flex-direction: column;
	transition: width 0.2s ease;
	position: sticky;
	top: 32px;
	height: calc(100vh - 32px);
	overflow-y: auto;
	z-index: 10;

	.aime-sidebar-collapsed & {
		width: var(--aime-sidebar-collapsed);
	}
}

.aime-sidebar-header {
	padding: 16px;
	border-bottom: 1px solid var(--aime-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.aime-sidebar-title {
	font-size: 16px;
	font-weight: 600;
	margin: 0;
	color: var(--aime-text);
}

.aime-sidebar-toggle {
	background: none;
	border: 1px solid var(--aime-border);
	border-radius: 4px;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	color: var(--aime-text-light);

	&:hover {
		background: var(--aime-bg);
	}
}

// Navigation
.aime-sidebar-nav {
	flex: 1;
	padding: 8px 0;
}

.aime-nav-section {
	margin-bottom: 4px;
}

.aime-nav-section-label {
	display: block;
	padding: 8px 16px 4px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	color: var(--aime-text-light);
	letter-spacing: 0.5px;
}

.aime-nav-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 16px;
	color: var(--aime-text);
	text-decoration: none;
	font-size: 13px;
	transition: all 0.15s ease;

	&:hover {
		background: var(--aime-bg);
		color: var(--aime-primary);
	}

	&.aime-nav-active {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
		font-weight: 600;
		border-right: 3px solid var(--aime-primary);
		position: relative;
	}
}

.aime-sidebar-footer {
	padding: 12px 16px;
	border-top: 1px solid var(--aime-border);
}

.aime-version {
	font-size: 11px;
	color: var(--aime-text-light);
}

.aime-dashboard-hero-card {
	margin-bottom: 16px;
	max-width: 1040px;
	transition: opacity 0.2s ease;

	&.aime-dashboard-hero-card--loading {
		opacity: 0;
		pointer-events: none;
	}
}

.aime-dashboard-hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 8px 4px;

	// Title, not Headline. The page already has one 22px heading ("Dashboard")
	// and this sat at 22px too — two things the same size reading as two
	// different levels. The hero's weight comes from the ember eyebrow above it,
	// the card it sits in, and the two buttons beside it, so it does not need to
	// borrow the page title's size to be read first.
	h3 {
		margin: 4px 0 8px;
		font-size: 15px;
		font-weight: 600;
		line-height: 1.4;
		color: var(--aime-text);
	}

	// 720px at 14px is roughly 103 characters per line — a measure you re-find
	// the start of by hunting. 68ch keeps it inside the readable band without
	// shrinking the card.
	p {
		margin: 0;
		max-width: 68ch;
		color: var(--aime-text-light);
		font-size: 13px;
		line-height: 1.5;
	}
}

.aime-dashboard-hero__actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
	flex-shrink: 0;
	min-width: 260px;
}

.aime-module-quick-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 20px;

	a {
		display: inline-flex;
		align-items: center;
		min-height: 34px;
		padding: 6px 12px;
		border: 1px solid var(--aime-border);
		border-radius: 7px;
		background: var(--aime-white);
		color: var(--aime-text);
		font-size: 13px;
		font-weight: 600;
		text-decoration: none;
		box-shadow: var(--aime-shadow);

		&:hover {
			border-color: var(--aime-primary);
			color: var(--aime-primary);
		}
	}
}

.aime-feature-highlights-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	margin: 0 0 22px;
}

.aime-feature-highlight-card {
	display: block;
	padding: 16px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	box-shadow: var(--aime-shadow);
	text-decoration: none;
	color: var(--aime-text);
	transition: transform var(--aime-transition), box-shadow var(--aime-transition), border-color var(--aime-transition);

	&:hover {
		transform: translateY(-1px);
		box-shadow: var(--aime-shadow-md);
		border-color: rgba(27, 94, 32, 0.35);
		color: var(--aime-text);
	}

	span {
		display: inline-flex;
		margin-bottom: 10px;
		padding: 4px 8px;
		border-radius: 6px;
		background: var(--aime-primary-light);
		color: var(--aime-primary);
		font-size: 12px;
		font-weight: 700;
	}

	h3 {
		margin: 0 0 8px;
		font-size: 15px;
		line-height: 1.35;
	}

	p {
		margin: 0;
		color: var(--aime-text-light);
		font-size: 13px;
		line-height: 1.5;
	}
}

// Main Content
.aime-main {
	flex: 1;
	min-width: 0;
}

.aime-header {
	background: var(--aime-white);
	border-bottom: 1px solid var(--aime-border);
	padding: 12px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--aime-header-height);
	position: sticky;
	top: 32px;
	z-index: 5;
}

.aime-header-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0;
	color: var(--aime-text);
}

.aime-header-site {
	font-size: 13px;
	color: var(--aime-text-light);
}

.aime-content {
	padding: 24px;
	max-width: 1200px;
}

// Cards
.aime-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow);
	margin-bottom: 20px;
	transition: box-shadow var(--aime-transition);
}

.aime-card-header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--aime-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.aime-card-title-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aime-card-title {
	font-size: 15px;
	font-weight: 600;
	margin: 0;
	color: var(--aime-text);
}

.aime-card-body {
	padding: 20px;

	.components-base-control {
		margin-bottom: 0;
	}
}
.aime-card button.components-button {
    text-align: center;
    justify-content: center;
}
.aime-seo-audit button.components-button {
    margin-top: 20px;
}
// Stats Grid
.aime-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.aime-stat-card {
	text-align: center;

	.aime-card-body {
		padding: 24px 16px;
	}
}

.aime-stat-value {
	font-size: 32px;
	font-weight: 700;
	color: var(--aime-text);
	line-height: 1.2;
}

.aime-stat-label {
	font-size: 13px;
	color: var(--aime-text-light);
	margin-top: 4px;
}

// Quick Actions
.aime-quick-actions {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
}

.aime-quick-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 20px 16px;
	text-decoration: none;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	transition: all var(--aime-transition);
	color: var(--aime-text);

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow-md);
		color: var(--aime-primary);
		transform: translateY(-2px);
	}
}

.aime-quick-action-icon {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
}

.aime-quick-action-label {
	font-size: 13px;
	font-weight: 500;
}

// Quick Links Grid
.aime-quick-links-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.aime-quick-link-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	text-decoration: none;
	color: var(--aime-text);
	transition: all 0.15s ease;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow);
		color: var(--aime-text);
	}

	h3 {
		margin: 0 0 8px;
		font-size: 15px;
	}

	p {
		margin: 0;
		font-size: 13px;
		color: var(--aime-text-light);
	}
}

// Tables
//
// A table here is a ledger someone scans, not a grid they admire. The rules
// between rows are the quietest thing that still separates them, the head is a
// label strip rather than a second heading, and the only loud element in the
// row is the value the reader came for.
.aime-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	// Fades the right edge while the table is still scrollable, so a clipped
	// column reads as "more this way" instead of as a cut-off layout.
	background-image:
		linear-gradient(to right, var(--aime-white) 30%, rgba(255, 255, 255, 0)),
		linear-gradient(to left, var(--aime-white) 30%, rgba(255, 255, 255, 0));
	background-position: left center, right center;
	background-repeat: no-repeat;
	background-size: 28px 100%, 28px 100%;
	background-attachment: local, local;

	> .aime-table {
		border: 0;
	}
}

.aime-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	background: var(--aime-white);

	th {
		text-align: left;
		padding: 11px 14px;
		border-bottom: 1px solid var(--aime-border);
		background: var(--aime-bg);
		white-space: nowrap;
		font-size: 11px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: var(--aime-text-light);
	}

	td {
		padding: 12px 14px;
		border-bottom: 1px solid var(--aime-border-light);
		color: var(--aime-text);
		vertical-align: middle;
		line-height: 1.45;
	}

	// The last rule would draw on top of the wrapper's own border.
	tbody tr:last-child td {
		border-bottom: 0;
	}

	tbody tr {
		transition: background var(--aime-transition);
	}

	// A neutral wash, not an accent tint: the accent is reserved for selection
	// and for the row's own links, and a tinted hover competes with both.
	tbody tr:hover > td {
		background: var(--aime-bg);
	}

	tbody tr.is-selected > td {
		background: var(--aime-primary-light);
	}

	// Numbers are read by column, so they hang off a shared right edge and use
	// tabular figures — otherwise 1,204 and 15 wander against each other.
	.is-numeric,
	td.is-numeric,
	th.is-numeric {
		text-align: right;
		font-variant-numeric: tabular-nums;
	}

	// A muted cell is a fact the reader only needs if they are already looking
	// at the row: timestamps, counts, ids.
	.is-muted {
		color: var(--aime-text-light);
	}

	a,
	.aime-link-btn {
		color: var(--aime-primary);
		font-weight: 600;
		text-decoration: none;
		background: none;
		border: 0;
		padding: 0;
		font-size: inherit;
		font-family: inherit;
		cursor: pointer;
		text-align: left;

		&:hover {
			text-decoration: underline;
		}

		&:focus-visible {
			outline: 2px solid var(--aime-primary);
			outline-offset: 2px;
			border-radius: 2px;
		}
	}

	// Secondary line under a primary cell value (a description under a name).
	.aime-table-sub {
		display: block;
		margin-top: 2px;
		font-size: 12px;
		line-height: 1.4;
		color: var(--aime-text-light);
	}

	// WP's own .widefat/.striped rules paint rows from the admin palette and
	// would override the hover above. Neutralised where our class is present.
	&.widefat,
	&.striped {
		border: 0;
		box-shadow: none;

		> tbody > tr:nth-child(odd),
		> tbody > tr:nth-child(odd) > td {
			background-color: transparent;
		}

		> tbody > tr:hover > td {
			background-color: var(--aime-bg);
		}
	}
}

// Row actions: present but quiet. Hiding them until hover costs touch users
// the affordance entirely, so they stay visible and simply stop shouting.
.aime-table-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	flex-wrap: wrap;
}

// Status Badges
.aime-status-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	color: white;
	text-transform: capitalize;
}

.aime-status-scheduled {
	background: #059669;
}

.aime-status-overdue,
.aime-status-missing {
	background: #dc2626;
}

// Filters
.aime-filters {
	display: flex;
	gap: 12px;
	margin-bottom: 16px;
	align-items: flex-end;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-filters-left {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}

.aime-filters-right {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	margin-left: auto;
}

// Bulk actions bar
.aime-bulk-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	margin-bottom: 12px;
	background: var(--aime-primary-light);
	border: 1px solid rgba(var(--aime-primary-rgb), 0.2);
	border-radius: var(--aime-radius-sm);
	flex-wrap: wrap;
	animation: aime-slideDown 0.25s ease;

	.aime-bulk-count {
		font-weight: 600;
		font-size: 13px;
		color: var(--aime-primary);
	}

	.components-base-control {
		margin-bottom: 0;
	}
}

// Bulk inline picker (list/tag checkboxes)
.aime-bulk-picker {
	display: flex;
	gap: 8px 16px;
	flex-wrap: wrap;
	padding: 6px 12px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);

	.components-base-control {
		margin-bottom: 0;
	}
}

// Selected row highlight
.aime-row-selected {
	background: var(--aime-primary-light) !important;
}

// Subscriber view modal
.aime-view-subscriber-modal {
	.aime-modal-lists,
	.aime-modal-tags {
		margin: 16px 0;
		padding: 12px;
		background: var(--aime-bg);
		border-radius: var(--aime-radius-sm);
		border: 1px solid var(--aime-border);
	}

	.aime-modal-tags {
		border-left: 3px solid var(--aime-warning);
	}

	.aime-modal-lists {
		border-left: 3px solid var(--aime-primary);
	}

	.aime-subscriber-meta {
		margin: 16px 0 8px;
		padding: 12px;
		background: var(--aime-bg);
		border-radius: var(--aime-radius-sm);
		font-size: 13px;

		p {
			margin: 4px 0;
		}
	}
}

// Pagination
.aime-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
}

.aime-pagination-info {
	font-size: 13px;
	color: var(--aime-text-light);
}

// Limit Bar
.aime-limit-bar {
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.aime-limit-progress {
	flex: 1;
	height: 8px;
	background: var(--aime-bg);
	border-radius: 4px;
	overflow: hidden;
}

.aime-limit-fill {
	height: 100%;
	background: var(--aime-primary);
	border-radius: 4px;
	transition: width 0.3s ease;
}

.aime-limit-text {
	font-size: 12px;
	color: var(--aime-text-light);
	white-space: nowrap;
}

.aime-limit-info {
	font-size: 12px;
	color: var(--aime-text-light);
	margin-bottom: 12px;
	padding: 8px 12px;
	background: rgba(255, 107, 53, 0.08);
	border-radius: 4px;
}

// Smart Usage Meter (Progressive Disclosure UX)
.aime-smart-meter {
	margin-bottom: 16px;
	padding: 12px 16px;
	background: #ffffff;
	border: 1px solid var(--aime-border-light, #e2e8f0);
	border-radius: var(--aime-radius-sm, 6px);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);

	&__header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 8px;
		font-size: 13px;
	}

	&__label {
		font-weight: 600;
		color: var(--aime-text, #1e293b);
	}

	&__remaining {
		color: var(--aime-text-light, #64748b);
		font-size: 12px;
	}

	&__track {
		width: 100%;
		height: 6px;
		background: #f1f5f9;
		border-radius: 3px;
		overflow: hidden;
	}

	&__fill {
		height: 100%;
		border-radius: 3px;
		transition: width 0.4s ease;

		&.is-normal {
			background: #2563eb;
		}
		&.is-warning {
			background: #f59e0b;
		}
		&.is-danger {
			background: #ef4444;
		}
	}

	&__footer {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 10px;
		padding-top: 8px;
		border-top: 1px dashed var(--aime-border-light, #e2e8f0);
		font-size: 12px;
		gap: 12px;
		flex-wrap: wrap;
	}

	&__tip {
		color: var(--aime-text-light, #64748b);
		flex: 1;
	}

	&.is-warning {
		border-color: #fde68a;
		background: #fffdf5;
	}

	&.is-blocked {
		border-color: #fecaca;
		background: #fffbfb;
	}
}

// Notices
.aime-notice {
	padding: 12px 16px;
	border-radius: var(--aime-radius-sm);
	margin-bottom: 16px;
	margin-top:10px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	animation: aime-slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);

	p {
		margin: 0;
		font-size: 13px;
		line-height: 1.5;
	}

	&.aime-notice-success {
		background: var(--aime-success-light);
		border: 1px solid rgba(16, 185, 129, 0.3);
		color: #065f46;
	}

	&.aime-notice-error {
		background: var(--aime-error-light);
		border: 1px solid rgba(239, 68, 68, 0.3);
		color: #991b1b;
	}

	&.aime-notice-info {
		background: var(--aime-info-light);
		border: 1px solid rgba(59, 130, 246, 0.3);
		color: #1e40af;
	}

	&.aime-notice-warning {
		background: var(--aime-warning-light);
		border: 1px solid rgba(245, 158, 11, 0.3);
		color: #92400e;
	}
}

.aime-notice-actions {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.aime-notice-dismiss {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 18px;
	opacity: 0.5;
	padding: 0 4px;

	&:hover {
		opacity: 1;
	}
}

.aime-notice-action-link {
	background: none;
	border: none;
	padding: 0 2px;
	margin: 0;
	font-family: inherit;
	font-size: inherit;
	font-weight: 700;
	color: #2563eb;
	text-decoration: underline;
	cursor: pointer;
	display: inline;
	line-height: inherit;
	transition: color 0.15s ease, opacity 0.15s ease;

	&:hover {
		color: #1d4ed8;
		opacity: 0.85;
	}

	&:focus {
		outline: 1px dotted #2563eb;
		outline-offset: 1px;
	}

	&:disabled {
		opacity: 0.6;
		cursor: wait;
	}
}

// Loader
// `.aime-loader` / `.aime-loader-text` (centred spinner) removed with the
// spinner itself — waiting is now a skeleton. See `.aime-loading` below.

// Empty State
.aime-empty-state {
	text-align: center;
	padding: 32px 16px;
	color: var(--aime-text-light);
	font-size: 14px;

	a {
		color: var(--aime-primary);
	}
}

// Form Layout
.aime-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

// Editor Actions
.aime-editor-actions {
	display: flex;
	gap: 12px;
	margin-top: 20px;
	margin-bottom: 20px;
}

.aime-btn-send {
	background: var(--aime-success) !important;
	border-color: var(--aime-success) !important;
}

// Modal Actions
.aime-modal-actions {
	display: flex;
	gap: 12px;
	margin-top: 20px;
	justify-content: flex-end;
}

// Modules Grid
.aime-modules-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 16px;
}

.aime-module-card {
	padding: 20px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);

	h4 {
		margin: 12px 0 8px;
	}

	p {
		font-size: 13px;
		color: var(--aime-text-light);
		margin: 0 0 12px;
	}
}

.aime-module-active {
	border-color: var(--aime-primary);
	background: var(--aime-primary-light);
}

.aime-module-coming-soon {
	opacity: 0.6;
}

.aime-module-link {
	color: var(--aime-primary);
	text-decoration: none;
	font-weight: 500;
	font-size: 13px;
}

.aime-coming-soon-badge {
	display: inline-block;
	padding: 3px 10px;
	background: var(--aime-bg);
	border-radius: 12px;
	font-size: 11px;
	color: var(--aime-text-light);
}

// Settings page
// The module list sits inside a Card, so each row is a hairline ledger entry
// rather than its own bordered box — a box inside a box reads as two surfaces
// competing for the same job.
.aime-modules-list {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--aime-border-light);
}

.aime-module-toggle {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 14px 0;
	border-bottom: 1px solid var(--aime-border-light);

	&:last-child {
		border-bottom: 0;
		padding-bottom: 0;
	}

	.components-base-control,
	.components-base-control__field {
		margin-bottom: 0;
	}

	.aime-module-info {
		flex: 1;
		min-width: 0;

		strong {
			display: block;
			margin-bottom: 3px;
			font-size: 14px;
			color: var(--aime-text);
		}

		p {
			margin: 0;
			font-size: 13px;
			line-height: 1.5;
			color: var(--aime-text-light);
		}
	}
}

.aime-settings-actions {
	margin-top: 20px;
}
#aime-app svg {
    fill: #d3d3d3;
}
#aime-app .aime-compose-bar__left button svg {
    fill: #1a1a1a;
}
// Label role. Was 700/0.04em — 700 is reserved for numbers, and every other
// eyebrow and column header on the page tracks at 0.02em.
.aime-dashboard-hero__eyebrow {
	display: inline-flex;
	align-items: center;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--aime-brand-orange);
}

html body #aime-app .components-select-control__input{
	padding: 2px 10px!important;
	border-radius: 0 !important;
	min-width: 180px;
}
input.aime-premium-input[type=color]
{
    max-width: 50px;
}
.components-base-control {
    margin-bottom: 1rem;
}

// Welcome Banner
.aime-welcome-banner {
	background: var(--aime-gradient);
	color: white;
	padding: 28px 36px;
	border-radius: var(--aime-radius-lg);
	margin-bottom: 24px;
	box-shadow: 0 8px 24px rgba(27, 94, 32, 0.15);

	h2 {
		color: white;
		margin: 0 0 6px;
		display: flex;
		align-items: center;
		gap: 10px;
		font-size: 22px;
	}

	p {
		margin: 0;
		opacity: 0.9;
		font-size: 14px;
	}
}

// Templates Grid
.aime-templates-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
}

.aime-template-card {
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	transition: box-shadow 0.15s ease;

	&:hover {
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	}
}

.aime-template-locked {
	opacity: 0.7;
}

.aime-template-preview {
	height: 160px;
	background: var(--aime-bg);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
}

.aime-template-placeholder {
	width: 60px;
	height: 60px;
	background: var(--aime-primary);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	font-size: 24px;
	font-weight: 700;
}

.aime-template-lock-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
}

.aime-template-info {
	padding: 12px;

	h4 {
		margin: 0 0 4px;
		font-size: 13px;
	}
}

.aime-template-category {
	font-size: 11px;
	color: var(--aime-text-light);
	text-transform: capitalize;
}

.aime-template-actions {
	padding: 0 12px 12px;
}

// Responsive
@media (max-width: 782px) {
	.aime-dashboard {
		flex-direction: column;
	}

	.aime-sidebar {
		width: 100% !important;
		height: auto;
		position: relative;
		top: 0;
	}

	.aime-content {
		padding: 16px;
	}

	.aime-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.aime-form-row {
		grid-template-columns: 1fr;
	}

	.aime-filters {
		flex-wrap: wrap;
	}
}

// Link style
.aime-link {
	color: var(--aime-primary);
	text-decoration: none;
	font-weight: 500;
	font-size: 13px;

	&:hover {
		text-decoration: underline;
	}

	// Hover was the only state this had. A link that drops its underline and
	// relies on colour alone needs a focus ring, or tabbing through the module
	// cards moves an invisible cursor. Additive — there was no focus style to
	// override, so no other page changes visually.
	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
		border-radius: 2px;
	}
}

.aime-card-description {
	margin: 0 0 16px;
	font-size: 13px;
	color: var(--aime-text-light);
}

// Card action group
.aime-card-action-group {
	display: flex;
	gap: 8px;
}

// ─── AI Settings Page ────────────────────────────────────

.aime-ai-settings {
	max-width: 900px;
}

.aime-page-header {
	margin-bottom: 24px;

	h2 {
		margin: 0 0 6px;
		font-size: 22px;
		font-weight: 600;
	}
}

.aime-page-description {
	margin: 0;
	font-size: 14px;
	color: var(--aime-text-light);
	line-height: 1.5;
}

// AI Providers Grid
// AI Providers — stacked card list (matching SMTP connections UX)
.aime-ai-providers-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.aime-ai-provider-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 2px 8px rgba(var(--aime-primary-rgb), 0.08);
	}

	&.aime-ai-card-disabled {
		opacity: 0.6;
		background: var(--aime-primary-light);
	}
}

.aime-ai-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.aime-ai-card-provider {
	display: flex;
	align-items: center;
	gap: 12px;
}

.aime-ai-card-icon {
	width: 28px;
	height: 28px;
	object-fit: contain;
	font-size: 28px;
	line-height: 1;
}

.aime-ai-card-name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
}

.aime-ai-card-desc {
	display: block;
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 2px;
}

.aime-ai-card-badges {
	display: flex;
	gap: 6px;
}

.aime-ai-card-meta {
	display: flex;
	gap: 16px;
	padding: 8px 0;
	font-size: 12px;
	color: var(--aime-text-light);

	span {
		display: inline-flex;
		align-items: center;
		gap: 4px;
	}

	.aime-ai-key-set {
		color: var(--aime-success);
		font-weight: 500;
	}
}

.aime-ai-card-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);
}

.aime-ai-card-buttons {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

// AI Edit Modal
.aime-ai-modal {
	.components-modal__content {
		max-width: 640px;
		padding: 0;
	}
}

.aime-ai-modal-body {
	padding: 20px 24px;

	.components-base-control {
		margin-bottom: 16px;
	}

	h4 {
		margin: 20px 0 12px;
		font-size: 14px;
		font-weight: 600;
	}
}

.aime-ai-modal-models {
	margin-top: 8px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);

	.aime-form-row {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;

		@media (max-width: 480px) {
			grid-template-columns: 1fr;
		}
	}
}

.aime-ai-modal-model-col {
	.components-base-control {
		margin-bottom: 8px;
	}
}

.aime-ai-modal-primary {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
}

.aime-ai-modal-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	padding: 12px 24px;
	border-top: 1px solid var(--aime-border);
	background: var(--aime-bg);
	border-radius: 0 0 var(--aime-radius) var(--aime-radius);
}

// ─── AI Provider Picker Grid (in modal) ──────────────────

.aime-ai-provider-section {
	margin-bottom: 16px;

	.components-base-control__label {
		display: block;
		font-weight: 600;
		margin-bottom: 8px;
	}
}

.aime-ai-providers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.aime-ai-picker-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 16px 12px;
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	cursor: pointer;
	transition: all 0.15s ease;
	text-align: center;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 2px 8px rgba(var(--aime-primary-rgb), 0.12);
	}

	strong {
		font-size: 13px;
	}
}

.aime-ai-picker-selected {
	border-color: var(--aime-primary) !important;
	background: rgba(var(--aime-primary-rgb), 0.04);
	box-shadow: 0 0 0 1px var(--aime-primary);
}

.aime-ai-picker-icon {
	width: 28px;
	height: 28px;
	object-fit: contain;
	font-size: 28px;
	line-height: 1;
}

.aime-ai-picker-check {
	position: absolute;
	top: 6px;
	right: 6px;
	color: var(--aime-primary);
	font-size: 16px;
	font-weight: bold;
}

.aime-ai-picker-status {
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 10px;
	line-height: 1.4;
}

.aime-ai-picker-connected {
	color: #15803d;
	background: #dcfce7;
}

.aime-ai-picker-disconnected {
	color: #b91c1c;
	background: #fee2e2;
}

/* ── API Key status badge ──────────────── */
.aime-ai-key-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: 12px;
	margin-bottom: 8px;
}

.aime-ai-key-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
}

.aime-ai-key-connected {
	color: #15803d;
	background: #dcfce7;

	.aime-ai-key-dot {
		background: #22c55e;
	}
}

.aime-ai-key-missing {
	color: #b91c1c;
	background: #fee2e2;

	.aime-ai-key-dot {
		background: #ef4444;
	}
}

/* ── Connection status on cards ──────── */
.aime-ai-conn-status {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 10px;
	margin-left: 8px;
	white-space: nowrap;

	&::before {
		content: '';
		width: 7px;
		height: 7px;
		border-radius: 50%;
		display: inline-block;
	}
}

.aime-ai-conn-connected {
	color: #15803d;
	background: #dcfce7;

	&::before {
		background: #22c55e;
	}
}

.aime-ai-conn-configured {
	color: #1e40af;
	background: #dbeafe;

	&::before {
		background: #3b82f6;
	}
}

.aime-ai-conn-nokey {
	color: #92400e;
	background: #fef3c7;

	&::before {
		background: #f59e0b;
	}
}

.aime-ai-conn-invalid {
	color: #b91c1c;
	background: #fee2e2;

	&::before {
		background: #ef4444;
	}
}

.aime-ai-config {
	margin-top: 4px;

	.components-base-control {
		margin-bottom: 12px;
	}
}

// Fallback list
.aime-fallback-list {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;

	li {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 10px 14px;
		background: var(--aime-bg);
		border-radius: 6px;
		font-size: 13px;
	}
}

.aime-fallback-primary {
	background: rgba(var(--aime-primary-rgb), 0.06) !important;
	border: 1px solid rgba(var(--aime-primary-rgb), 0.2);
}

// Test connection button
.aime-btn-test {
	margin-top: 8px !important;
}

// Form actions
.aime-form-actions {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--aime-border);
}

.aime-btn-save {
	min-width: 160px;
}

.aime-field-label {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
}

// ─── App Layout (Magical Shop Builder style) ─────────────

.aime-app-layout {
	margin: -10px -20px 0 -2px;
	min-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	background: var(--aime-bg);
}

// ── Top Header Bar ───────────────────────────────────────

.aime-top-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 52px;
	padding: 0 20px;
	background: var(--aime-white);
	border-bottom: 1px solid var(--aime-border);
	flex-shrink: 0;
    padding: 30px 20px;
	max-width: 95%;
}

.aime-top-bar-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.aime-top-bar-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: var(--aime-primary);
	color: white;
	flex-shrink: 0;
}

.aime-top-bar-name {
	font-size: 16px;
	font-weight: 700;
	color: var(--aime-text);
}

.aime-top-bar-version {
	font-size: 12px;
	color: var(--aime-text-light);
	font-weight: 400;
}

.aime-top-bar-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.aime-top-bar-subheading {
	font-size: 13px;
	font-weight: 500;
	color: var(--aime-text-light);
	border-left: 1px solid #ddd;
	padding-left: 10px;
	margin-left: 2px;
}

.aime-top-bar-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aime-top-bar-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	font-size: 13px;
	color: var(--aime-text-light);
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.15s ease, color 0.15s ease;

	.dashicons {
		font-size: 16px;
		width: 16px;
		height: 16px;
		line-height: 16px;
	}

	&:hover {
		background: var(--aime-bg);
		color: var(--aime-primary);
	}
}

// ── Body (Sidebar + Content) ─────────────────────────────

.aime-body {
	flex: 1;
	display: flex;
	align-items: stretch;
}

// The rail owns its own width so it can shrink to icons without the shell
// needing to know it happened. It also sits above the content column: the
// collapsed tooltips reach across that boundary, and a stat card painted at
// the same level would swallow them.
.aime-internal-sidebar {
	position: relative;
	z-index: 20;
	width: auto;
	flex-shrink: 0;
	background: var(--aime-white);
	border-right: 1px solid var(--aime-border);
}

.aime-main-content {
	flex: 1;
	padding: 24px 40px 24px 28px;
	min-width: 0;
	max-width: 1200px;
	overflow-x: hidden;
}

.aime-footer-info {
	margin: 24px 24px 16px;
	padding: 14px 18px;
	background: #f6f7f7;
	border-left: 3px solid #c3c4c7;
	border-radius: 4px;

	ul {
		margin: 0;
		padding: 0;
		list-style: none;
		display: flex;
		flex-direction: column;
		gap: 6px;
	}

	li {
		font-size: 12px;
		color: #646970;
		line-height: 1.5;
		padding-left: 14px;

		&::before {
			content: '*';
			margin-right: 10px;
			color: #8c8f94;
			font-weight: 700;
		}
	}
}

// ── Internal Sidebar Navigation ──────────────────────────
//
// A rail, not a panel: hairline on the right, no card chrome, one accented
// item. It runs the full height of the shell so the content column never
// looks like it is floating next to a stub.

.aime-sidebar-nav {
	--aime-rail-width: 236px;

	position: sticky;
	top: 44px; // clears the fixed admin bar (32px)
	z-index: 21;
	display: flex;
	flex-direction: column;
	width: var(--aime-rail-width);
	// No scroll box of its own: an `overflow` here would clip the collapsed
	// tooltips against the rail edge, and no module has enough items to
	// outgrow the viewport.
	min-height: calc(100vh - 76px);
	padding: 10px 12px 16px;
	gap: 2px;
	transition: width var(--aime-transition);

	&.is-collapsed {
		--aime-rail-width: 68px;
		padding-inline: 10px;
	}
}

// Toggle sits above the list, aligned to the rail edge it pulls toward.
.aime-sidebar-rail-head {
	display: flex;
	justify-content: flex-end;
	padding: 0 2px 8px;
	margin-bottom: 6px;
	border-bottom: 1px solid var(--aime-border-light);

	.is-collapsed & {
		justify-content: center;
	}
}

.aime-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-white);
	color: var(--aime-text-light);
	cursor: pointer;
	transition: background var(--aime-transition), color var(--aime-transition),
		border-color var(--aime-transition);

	svg {
		fill: currentColor;
	}

	&:hover {
		background: var(--aime-primary-light);
		border-color: var(--aime-primary);
		color: var(--aime-primary);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}
}

.aime-sidebar-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;

	li {
		margin: 0;
	}
}

.aime-sidebar-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 40px;
	padding: 9px 12px;
	border: none;
	background: transparent;
	cursor: pointer;
	border-radius: var(--aime-radius-sm);
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--aime-text-light);
	text-align: left;
	transition: background var(--aime-transition), color var(--aime-transition);

	&:hover {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}

	.is-collapsed & {
		justify-content: center;
		gap: 0;
		padding-inline: 0;
	}
}

.aime-sidebar-item-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: inherit;

	svg {
		fill: currentColor;
	}
}

.aime-sidebar-item-label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;

	.is-collapsed & {
		display: none;
	}
}

.aime-sidebar-badge {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--aime-primary);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	flex-shrink: 0;

	// Collapsed, the count rides the icon rather than claiming a column
	// that no longer exists.
	.is-collapsed & {
		position: absolute;
		top: 4px;
		right: 8px;
		margin: 0;
		min-width: 16px;
		height: 16px;
		padding: 0 4px;
		font-size: 10px;
		box-shadow: 0 0 0 2px var(--aime-white);
	}
}

.aime-sidebar-active {
	background: var(--aime-primary);
	color: var(--aime-white);
	font-weight: 600;
	box-shadow: 0 6px 14px rgba(var(--aime-primary-rgb), 0.24);

	&:hover {
		background: var(--aime-primary-hover);
		color: var(--aime-white);
	}

	.aime-sidebar-badge {
		background: rgba(255, 255, 255, 0.24);
	}
}

// Collapsed labels are still readable — on hover and on keyboard focus.
.aime-sidebar-nav.is-collapsed {
	.aime-sidebar-item[data-tip],
	.aime-nav-toggle[data-tip] {
		&::after {
			content: attr(data-tip);
			position: absolute;
			left: calc(100% + 10px);
			top: 50%;
			transform: translateY(-50%);
			z-index: 30;
			padding: 5px 9px;
			border-radius: var(--aime-radius-sm);
			background: var(--aime-text);
			color: var(--aime-white);
			font-size: 12px;
			font-weight: 500;
			white-space: nowrap;
			pointer-events: none;
			opacity: 0;
			visibility: hidden;
			transition: opacity var(--aime-transition);
		}

		&:hover::after,
		&:focus-visible::after {
			opacity: 1;
			visibility: visible;
		}
	}

	.aime-nav-toggle {
		position: relative;
	}
}

.aime-sidebar-footer {
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border-light);
}

// ── Coming Soon Page ─────────────────────────────────────

.aime-coming-soon-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 400px;
	padding: 40px;
}

.aime-coming-soon-content {
	text-align: center;
	max-width: 420px;

	h2 {
		margin: 16px 0 8px;
		font-size: 22px;
	}
}

.aime-coming-soon-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: rgba(var(--aime-primary-rgb), 0.08);
	color: var(--aime-primary);
}

.aime-coming-soon-desc {
	color: var(--aime-text-light);
	font-size: 14px;
	margin-bottom: 20px;
}

.aime-coming-soon-badge-large {
	display: inline-block;
	padding: 6px 18px;
	border-radius: 16px;
	font-size: 13px;
	font-weight: 600;
	background: rgba(255, 152, 0, 0.1);
	color: var(--aime-warning);
	margin-bottom: 12px;
}

.aime-coming-soon-note {
	font-size: 13px;
	color: var(--aime-text-light);
	margin-bottom: 16px;
}

// ── Dashboard Heading ────────────────────────────────────

.aime-dashboard-heading {
	font-size: 22px;
	font-weight: 600;
	margin: 0 0 4px;
}

.aime-dashboard-welcome {
	color: var(--aime-text-light);
	font-size: 14px;
	margin: 0 0 20px;
}

// ── Quick Start Actions ──────────────────────────────────

.aime-quick-start-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aime-btn-quick-start {
	width: 100%;
	justify-content: center;
}

// ── Email Dashboard Sections ─────────────────────────────

.aime-section-title {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 15px;
}

.aime-section-desc {
	color: var(--aime-text-light);
	font-size: 14px;
	margin: 0 0 20px;
}

.aime-email-quick-start {
	margin-bottom: 0;
}

// ── Dashboard Grid (Quick Start + Recent Campaigns) ──────

.aime-dashboard-grid {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 20px;
	align-items: start;
}

// ── Link Button (looks like <a> but is <button>) ────────

.aime-link-button {
	background: none;
	border: none;
	padding: 0;
	color: var(--aime-primary);
	cursor: pointer;
	font: inherit;
	text-decoration: none;

	&:hover {
		text-decoration: underline;
		color: var(--aime-primary-hover);
	}
}

// ─── Modern Stat Cards ────────────────────────────────────

.aime-stat-card-modern {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	box-shadow: var(--aime-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;

	&:hover {
		transform: translateY(-2px);
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	}
}

.aime-stat-card-icon {
	width: 48px;
	height: 48px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	flex-shrink: 0;
}

.aime-stat-card-data {
	flex: 1;
	min-width: 0;
}

.aime-stat-card-value {
	font-size: 28px;
	font-weight: 700;
	color: var(--aime-text);
	line-height: 1.2;
}

.aime-stat-card-label {
	font-size: 13px;
	color: var(--aime-text-light);
	margin-top: 2px;
}

// ─── Welcome CTA ─────────────────────────────────────────

.aime-welcome-cta {
	background: linear-gradient(135deg, var(--aime-primary), #6c63ff);
	color: white;
	padding: 28px 32px;
	border-radius: var(--aime-radius);
	margin-bottom: 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;

	h2 {
		color: white;
		margin: 0 0 6px;
		font-size: 20px;
	}

	p {
		margin: 0;
		opacity: 0.9;
		font-size: 14px;
	}
}

.aime-welcome-cta-text {
	flex: 1;
}

.aime-badge-free {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	background: rgba(255, 255, 255, 0.2);
	color: white;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

// ─── SMTP Providers Grid ──────────────────────────────────

.aime-smtp-providers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.aime-smtp-provider-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 16px 12px;
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	cursor: pointer;
	transition: all 0.15s ease;
	text-align: center;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 2px 8px rgba(var(--aime-primary-rgb), 0.12);
	}

	strong {
		font-size: 13px;
	}
}

.aime-smtp-selected {
	border-color: var(--aime-primary) !important;
	background: rgba(var(--aime-primary-rgb), 0.04);
	box-shadow: 0 0 0 1px var(--aime-primary);
}

.aime-smtp-check {
	position: absolute;
	top: 6px;
	right: 6px;
	color: var(--aime-primary);
	font-size: 16px;
	font-weight: bold;
}

.aime-smtp-provider-desc {
	font-size: 11px;
	color: var(--aime-text-light);
	line-height: 1.3;
}

.aime-smtp-config {
	margin-top: 16px;
	padding: 20px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius);
	border: 1px solid var(--aime-border);

	h4 {
		margin: 0 0 16px;
		font-size: 14px;
	}

	.components-base-control {
		margin-bottom: 12px;
	}
}

.aime-smtp-test {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);

	.components-base-control {
		flex: 1;
		margin-bottom: 0;
	}
}

.aime-smtp-docs {
	margin-top: 12px;
	padding: 10px 14px;
	background: rgba(33, 150, 243, 0.06);
	border-radius: 6px;
	font-size: 12px;
	color: var(--aime-text-light);

	a {
		color: var(--aime-primary);
		text-decoration: none;

		&:hover {
			text-decoration: underline;
		}
	}
}

.aime-smtp-provider-help {
	display: grid;
	gap: 8px;
	margin-bottom: 14px;
	padding: 12px 14px;
	background: #fff8eb;
	border: 1px solid rgba(217, 119, 6, 0.24);
	border-radius: 6px;
	font-size: 12px;
	color: #7c4a03;

	p {
		margin: 0;
		line-height: 1.45;
	}
}

// ─── SMTP Connections Manager ─────────────────────────────

.aime-smtp-settings {
	max-width: 900px;
}

.aime-smtp-connections-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.aime-smtp-connection-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 2px 8px rgba(var(--aime-primary-rgb), 0.08);
	}

	&.aime-smtp-card-disabled {
		opacity: 0.6;
		background: var(--aime-bg);
	}
}

.aime-smtp-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.aime-smtp-card-provider {
	display: flex;
	align-items: center;
	gap: 12px;
}

.aime-smtp-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	line-height: 1;
	color: var(--aime-primary);
}

.aime-smtp-card-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.aime-smtp-empty-state-icon {
	width: 48px;
	height: 48px;
}

.aime-smtp-card-name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
}

.aime-smtp-card-provider-label {
	display: block;
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 2px;
}

.aime-smtp-card-badges {
	display: flex;
	gap: 6px;
}

.aime-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.aime-badge-primary {
	background: rgba(var(--aime-primary-rgb), 0.1);
	color: var(--aime-primary);
}

.aime-badge-fallback {
	background: rgba(255, 152, 0, 0.1);
	color: #e67e00;
}

.aime-badge-disabled {
	background: rgba(0, 0, 0, 0.06);
	color: var(--aime-text-light);
}

.aime-smtp-card-meta {
	display: flex;
	gap: 16px;
	padding: 8px 0;
	font-size: 12px;
	color: var(--aime-text-light);

	span {
		display: inline-flex;
		align-items: center;
		gap: 4px;
	}
}

.aime-smtp-default-warning {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	padding: 10px 12px;
	border: 1px solid rgba(217, 119, 6, 0.28);
	border-radius: 6px;
	background: #fff8eb;
	color: #7c4a03;
	font-size: 12px;
	line-height: 1.4;

	strong {
		font-weight: 600;
		color: #663c00;
	}

	span {
		color: #7c4a03;
	}
}

.aime-smtp-card-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);
}

.aime-smtp-card-buttons {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-smtp-inline-test {
	display: inline-flex;
	align-items: center;
	gap: 6px;

	.components-base-control {
		margin-bottom: 0;
	}

	.components-text-control__input {
		min-width: 180px;
		height: 30px;
		font-size: 12px;
	}
}

.aime-smtp-error-log-accordion {
	margin-top: 18px;
}

.aime-smtp-error-log-panel {
	border: 1px solid #f0c4c4;
	border-radius: var(--aime-radius);
	background: #fff;
	overflow: hidden;

	summary {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		padding: 16px 18px;
		background: #fff8f8;
		cursor: pointer;
		list-style: none;

		&::-webkit-details-marker {
			display: none;
		}

		&::after {
			content: '+';
			flex: 0 0 auto;
			width: 24px;
			height: 24px;
			border-radius: 50%;
			background: #f3d5d5;
			color: #8a2424;
			font-size: 18px;
			font-weight: 700;
			line-height: 22px;
			text-align: center;
		}

		> span:first-child {
			display: flex;
			flex-direction: column;
			gap: 3px;
			min-width: 0;
		}

		strong {
			font-size: 15px;
			color: var(--aime-text);
		}

		small {
			font-size: 12px;
			color: var(--aime-text-light);
		}
	}

	&[open] summary {
		border-bottom: 1px solid #f0c4c4;

		&::after {
			content: '-';
			line-height: 20px;
		}
	}
}

.aime-smtp-error-count {
	margin-left: auto;
	padding: 4px 9px;
	border-radius: 999px;
	background: #eef0f2;
	color: var(--aime-text-light);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;

	&.has-errors {
		background: #f7dddd;
		color: #8a2424;
	}
}

.aime-smtp-error-log-content {
	padding: 16px 18px 18px;
}

.aime-smtp-error-log-toolbar {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;

	p {
		margin: 0;
	}
}

.aime-smtp-error-log-empty {
	margin-top: 16px;
	padding: 16px;
	border: 1px dashed var(--aime-border);
	border-radius: var(--aime-radius);
	color: var(--aime-text-light);
	text-align: center;
}

.aime-smtp-error-log-table-wrap {
	margin-top: 16px;
	overflow-x: auto;
}

.aime-smtp-error-log-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;

	th,
	td {
		padding: 10px 12px;
		border-bottom: 1px solid var(--aime-border);
		text-align: left;
		vertical-align: top;
	}

	th {
		background: var(--aime-bg);
		font-size: 12px;
		font-weight: 600;
		color: var(--aime-text-light);
	}

	td:first-child {
		white-space: nowrap;
	}

	td:nth-child(2),
	td:nth-child(3) {
		max-width: 220px;
		word-break: break-word;
	}

	td:last-child {
		min-width: 240px;

		strong,
		span {
			display: block;
		}

		strong {
			margin-bottom: 3px;
			color: #b32d2e;
			font-size: 12px;
		}
	}
}

// SMTP Modal
.aime-smtp-modal {
	.components-modal__content {
		max-width: 640px;
		padding: 0;
	}
}

.aime-smtp-modal-body {
	padding: 20px 24px;

	.components-base-control {
		margin-bottom: 16px;
	}

	h4 {
		margin: 20px 0 12px;
		font-size: 14px;
		font-weight: 600;
	}
}

.aime-smtp-modal-field-error {
	margin: 0 0 8px;
}

.aime-smtp-provider-section {
	margin: 16px 0;

	> label {
		display: block;
		margin-bottom: 8px;
		font-weight: 500;
		font-size: 13px;
	}
}

.aime-smtp-from-override {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);

	h4 {
		margin: 0 0 4px !important;
	}
}

.aime-hint-muted {
	font-size: 12px;
	color: #646970;
}

.aime-hint-warn {
	font-size: 12px;
	color: #b26a00;
	font-weight: 500;
}

.aime-hint-autofill {
	margin-top: 4px;
	background: none;
	border: none;
	padding: 0;
	font-size: 12px;
	color: var(--aime-primary);
	cursor: pointer;
	text-decoration: underline;

	&:hover {
		color: #135e96;
	}

	&.aime-hint-autofill-block {
		display: block;
		width: 100%;
		margin-bottom: 12px;
		padding: 7px 12px;
		background: #f0f6fc;
		border: 1px dashed var(--aime-primary);
		border-radius: 4px;
		text-align: left;
		text-decoration: none;
		font-size: 12px;
		font-weight: 500;

		&:hover {
			background: #e0eef9;
			color: #135e96;
		}
	}
}

.aime-smtp-primary-toggle {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
}

.aime-smtp-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 16px 24px;
	border-top: 1px solid var(--aime-border);
	background: var(--aime-bg);
	border-radius: 0 0 var(--aime-radius) var(--aime-radius);
}

// ─── Import / Export ──────────────────────────────────────

.aime-import-export {
	max-width: 900px;

	.components-select-control {
		margin-bottom: 16px;

		.components-base-control__label {
			display: block;
			margin-bottom: 6px;
		}

		.components-select-control__input {
			width: 100%;
			min-height: 40px;
		}
	}

	.components-textarea-control {
		margin-bottom: 12px;
	}
}

.aime-import-section,
.aime-export-section {
	margin-bottom: 24px;
}

.aime-source-selector {
	display: flex;
	gap: 8px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.aime-source-btn {
	padding: 10px 18px;
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.15s ease;
	color: var(--aime-text);

	&:hover {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
	}
}

.aime-source-active {
	border-color: var(--aime-primary) !important;
	background: rgba(var(--aime-primary-rgb), 0.06);
	color: var(--aime-primary);
	font-weight: 600;
}

.aime-import-form {
	padding: 20px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius);
	border: 1px solid var(--aime-border);
}

.aime-file-upload {
	margin-bottom: 16px;
}

.aime-file-label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 6px;
}

.aime-file-input {
	display: block;
	width: 100%;
	padding: 10px 14px;
	border: 2px dashed var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	cursor: pointer;
	font-size: 13px;

	&:hover {
		border-color: var(--aime-primary);
	}

	&:focus {
		outline: none;
		border-color: var(--aime-primary);
		box-shadow: 0 0 0 1px var(--aime-primary);
	}
}

.aime-file-info {
	margin-top: 6px;
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-role-selection {
	margin-bottom: 16px;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-import-info {
	padding: 10px 14px;
	background: rgba(33, 150, 243, 0.06);
	border: 1px solid rgba(33, 150, 243, 0.15);
	border-radius: 6px;
	font-size: 13px;
	color: var(--aime-info);
	margin-bottom: 16px;
}

.aime-list-assignment {
	margin-bottom: 16px;

	h4 {
		margin: 0 0 8px;
		font-size: 13px;
		font-weight: 600;
	}
}

.aime-checkbox-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 8px;

	label {
		display: flex;
		align-items: center;
		gap: 6px;
		font-size: 13px;
		cursor: pointer;
		padding: 6px 10px;
		border-radius: 4px;

		&:hover {
			background: var(--aime-bg);
		}
	}
}

.aime-tags-input {
	margin-bottom: 16px;
}

.aime-field-label-inline {
	display: block;
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 6px;
}

.aime-import-actions {
	display: flex;
	gap: 12px;
	margin-top: 20px;
}

.aime-btn-import {
	min-width: 140px;
}

.aime-import-result {
	margin-top: 20px;
	padding: 20px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);

	h3 {
		margin: 0 0 16px;
		font-size: 15px;
	}
}

.aime-result-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
}

.aime-result-item {
	text-align: center;
	padding: 16px 12px;
	border-radius: var(--aime-radius);
	border: 1px solid var(--aime-border);
}

.aime-result-number {
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
}

.aime-result-label {
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 2px;
	text-transform: capitalize;
}

.aime-result-success {
	background: rgba(76, 175, 80, 0.06);
	border-color: rgba(76, 175, 80, 0.2);

	.aime-result-number {
		color: var(--aime-success);
	}
}

.aime-result-warning {
	background: rgba(255, 152, 0, 0.06);
	border-color: rgba(255, 152, 0, 0.2);

	.aime-result-number {
		color: var(--aime-warning);
	}
}

.aime-result-info {
	background: rgba(33, 150, 243, 0.06);
	border-color: rgba(33, 150, 243, 0.2);

	.aime-result-number {
		color: var(--aime-info);
	}
}

.aime-result-error {
	background: rgba(244, 67, 54, 0.06);
	border-color: rgba(244, 67, 54, 0.2);

	.aime-result-number {
		color: var(--aime-error);
	}
}

.aime-export-actions {
	display: flex;
	gap: 12px;
	margin-top: 16px;
}

// ─── Error Boundary ──────────────────────────────────────

.aime-error-boundary {
	padding: 32px;
	text-align: center;
}

.aime-error-boundary-content {
	max-width: 500px;
	margin: 0 auto;
	padding: 48px 24px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow);

	h2 {
		margin: 0 0 12px;
		font-size: 18px;
		color: var(--aime-error);
	}

	p {
		color: var(--aime-text-light);
		margin: 0 0 20px;
		font-size: 14px;
	}
}

.aime-error-details {
	margin-top: 16px;
	padding: 12px;
	background: var(--aime-bg);
	border-radius: 6px;
	font-family: monospace;
	font-size: 12px;
	color: var(--aime-error);
	text-align: left;
	max-height: 150px;
	overflow-y: auto;
	word-break: break-word;
}

// ─── Settings Tabs ───────────────────────────────────────

.aime-settings-tabs {
	max-width: 900px;

	.components-tab-panel__tabs {
		margin-bottom: 20px;
		border-bottom: 2px solid var(--aime-border);

		button {
			font-size: 14px;
			padding: 10px 18px;

			&.is-active {
				border-bottom: 2px solid var(--aime-primary);
				color: var(--aime-primary);
				font-weight: 600;
			}
		}
	}
}

.aime-tab-content {
	padding: 4px 0;
}

// ─── Campaign Editor (legacy grid — replaced by multi-step) ─────────────────

.aime-editor-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 20px;
}

.aime-back-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--aime-primary);
	cursor: pointer;
	background: none;
	border: none;
	font-size: 14px;
	padding: 6px 12px;
	border-radius: var(--aime-radius);
	transition: background 0.15s ease;

	&:hover {
		background: rgba(var(--aime-primary-rgb), 0.08);
		text-decoration: none;
	}
}

.aime-editor-grid {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 24px;
	align-items: start;
}

.aime-editor-main {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

// ── Field with AI Button ─────────────────────────────────

.aime-field-with-ai {
	position: relative;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-ai-btn {
	position: absolute;
	top: 0;
	right: 0;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff !important;
	border: none !important;
	border-radius: 6px !important;
	font-size: 12px !important;
	padding: 4px 10px !important;
	min-height: 28px !important;
	height: 28px !important;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	transition: opacity 0.15s ease;

	&:hover {
		opacity: 0.9;
	}

	&:focus {
		box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.4) !important;
	}
}

// ── AI Generation Modal ──────────────────────────────────

.aime-ai-modal {
	.components-modal__content {
		max-width: 560px;
	}
}

.aime-ai-generator {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.aime-ai-result {
	padding: 16px;
	background: #f8f9fa;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
}

.aime-ai-result h4 {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--aime-text-light);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.aime-ai-preview {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: 6px;
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.6;
	max-height: 200px;
	overflow-y: auto;
}

.aime-ai-actions {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

// ── Template Picker ──────────────────────────────────────

.aime-template-picker-modal {
	.components-modal__content {
		max-width: 820px;
		padding-bottom: 20px;
	}

	.components-modal__header {
		border-bottom: 1px solid #e0e0e0;
		margin-bottom: 16px;
	}
}

.aime-template-picker-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	margin-top: 4px;

	@media (max-width: 782px) {
		grid-template-columns: repeat(2, 1fr);
	}

	@media (max-width: 480px) {
		grid-template-columns: 1fr;
	}
}

// ── Template card ──
.aime-tpl-card {
	display: flex;
	flex-direction: column;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 4px 16px rgba(var(--aime-primary-rgb), 0.15);
		transform: translateY(-2px);

		.aime-tpl-card__btn {
			opacity: 1;
		}
	}

	&__preview {
		position: relative;
		background: #f9f9f9;
		border-bottom: 1px solid #eee;
		padding: 8px;
		display: flex;
		align-items: center;
		justify-content: center;

		svg {
			width: 100%;
			height: auto;
			display: block;
			border-radius: 3px;
		}

		img {
			width: 100%;
			height: auto;
			display: block;
			border-radius: 3px;
			object-fit: cover;
		}
	}

	&__info {
		padding: 10px 12px 4px;
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	&__name {
		font-size: 13px;
		font-weight: 600;
		color: #1e1e1e;
	}

	&__cat {
		font-size: 11px;
		color: #888;
	}

	&__btn {
		margin: 6px 12px 12px;
		opacity: 0.7;
		transition: opacity 0.15s ease;
		font-size: 12px !important;
		height: 32px !important;
		border-radius: 6px !important;
	}
}

// ── Import Modal ─────────────────────────────────────────

.aime-import-modal {
	.components-modal__content {
		max-width: 540px;
	}
}

.aime-import-sources {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 16px;
}

.aime-import-source-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 16px 12px !important;
	border: 2px solid var(--aime-border) !important;
	border-radius: var(--aime-radius) !important;
	background: var(--aime-white) !important;
	cursor: pointer;
	transition: border-color 0.15s ease;
	min-height: auto !important;
	height: auto !important;

	&:hover,
	&.is-active {
		border-color: var(--aime-primary) !important;
		background: rgba(var(--aime-primary-rgb), 0.04) !important;
	}

	.aime-import-icon {
		font-size: 24px;
	}

	span:last-child {
		font-size: 13px;
		font-weight: 500;
	}
}

.aime-import-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.aime-import-result {
	padding: 16px;
	background: #f0f8f0;
	border: 1px solid var(--aime-success);
	border-radius: var(--aime-radius);
	text-align: center;

	h4 {
		margin: 0 0 8px;
		color: var(--aime-success);
	}

	p {
		margin: 4px 0;
		font-size: 14px;
	}
}

.aime-btn-import-trigger {
	margin-left: 8px;
}

// ── Action Buttons ───────────────────────────────────────

.aime-action-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aime-btn-full {
	width: 100%;
	justify-content: center !important;
}

// ── Empty State Actions ──────────────────────────────────

.aime-empty-actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

// ── Automations ──────────────────────────────────────────

.aime-automations-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.aime-automation-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	transition: box-shadow 0.15s ease;

	&:hover {
		box-shadow: var(--aime-shadow);
	}
}

.aime-automation-info {
	flex: 1;
	min-width: 0;
}

.aime-automation-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;

	h4 {
		margin: 0;
		font-size: 15px;
	}
}

.aime-automation-status {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;

	&.aime-status-active {
		background: #e8f5e9;
		color: #2e7d32;
	}

	&.aime-status-inactive {
		background: #f5f5f5;
		color: #757575;
	}
}

.aime-automation-desc {
	margin: 0 0 6px;
	font-size: 13px;
	color: var(--aime-text-light);
}

.aime-automation-meta {
	display: flex;
	gap: 16px;
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-automation-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

// ── Automation Create Modal ──────────────────────────────

.aime-create-automation-modal {
	.components-modal__content {
		max-width: 640px;
	}
}

.aime-modal-subtitle {
	color: var(--aime-text-light);
	margin: 0 0 16px;
}

// `.aime-preset-grid` / `.aime-preset-card` (icon-tile picker) lived here and no
// longer has any markup. It was still winning `text-align: center` and a 2px
// border on the real preset and brand-voice cards further down, which is why
// their paragraphs were centred. Removed rather than scoped — nothing renders it.

.aime-preset-divider {
	text-align: center;
	margin: 16px 0;
	position: relative;

	&::before {
		content: '';
		position: absolute;
		top: 50%;
		left: 0;
		right: 0;
		height: 1px;
		background: var(--aime-border);
	}

	span {
		position: relative;
		background: var(--aime-white);
		padding: 0 16px;
		color: var(--aime-text-light);
		font-size: 13px;
	}
}

// ── Automation Editor Modal ──────────────────────────────

.aime-automation-editor-modal {
	.components-modal__content {
		max-width: 680px;
	}
}

.aime-automation-editor {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.aime-workflow-steps {
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 16px;
	background: #fafafa;

	> h4 {
		margin: 0 0 12px;
		font-size: 14px;
		font-weight: 600;
	}
}

.aime-steps-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}

.aime-step-item {
	position: relative;
}

.aime-step-content {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border: 1px solid var(--aime-border);
	border-radius: 6px;
	background: var(--aime-white);
	margin-left: 36px;
}

.aime-step-number {
	position: absolute;
	left: 0;
	top: 12px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--aime-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 600;
}

.aime-step-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;

	.components-select-control {
		flex: 1;
	}
}

.aime-step-delay,
.aime-step-tag {
	display: flex;
	gap: 8px;
	align-items: flex-end;

	> * {
		flex: 1;
	}
}

.aime-step-connector {
	text-align: center;
	color: var(--aime-text-light);
	font-size: 16px;
	padding: 2px 0;
	margin-left: 12px;
}

.aime-add-step {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding-top: 8px;
	border-top: 1px dashed var(--aime-border);

	> span {
		font-size: 13px;
		font-weight: 500;
		color: var(--aime-text-light);
	}
}

.aime-add-step-buttons {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.aime-empty-notice {
	color: var(--aime-text-light);
	font-size: 13px;
	text-align: center;
	padding: 16px;
	margin: 0 0 12px;
}

.aime-modal-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
}

// ── Empty State ──────────────────────────────────────────

.aime-empty-state {
	text-align: center;
	padding: 32px 16px;
	color: var(--aime-text-light);

	p {
		margin: 0 0 16px;
		font-size: 14px;
		max-width: 400px;
		margin-left: auto;
		margin-right: auto;
	}
}

// ─── Animation Helpers ────────────────────────────────────

.animate__animated {
	animation-fill-mode: both;
}

// delay utilities for staggered animations
.animate__delay-100ms { animation-delay: 0.1s; }
.animate__delay-200ms { animation-delay: 0.2s; }
.animate__delay-300ms { animation-delay: 0.3s; }
.animate__delay-400ms { animation-delay: 0.4s; }
.animate__delay-500ms { animation-delay: 0.5s; }
.animate__delay-600ms { animation-delay: 0.6s; }

// ─── Responsive Additions ─────────────────────────────────

@media (max-width: 782px) {
	.aime-top-bar {
		flex-direction: column;
		height: auto;
		padding: 10px 16px;
		gap: 8px;
	}

	.aime-top-bar-right {
		width: 100%;
		justify-content: flex-end;
	}

	.aime-body-with-sidebar {
		flex-direction: column;
	}

	.aime-internal-sidebar {
		width: 100%;
		border-right: none;
		border-bottom: 1px solid var(--aime-border);
	}

	// Stacked, the rail becomes a scrolling strip. Collapsing to icons buys
	// nothing here, so the toggle stands down and the labels come back.
	.aime-sidebar-nav,
	.aime-sidebar-nav.is-collapsed {
		--aime-rail-width: 100%;

		position: static;
		min-height: 0;
		padding: 8px 12px;
	}

	.aime-sidebar-rail-head {
		display: none;
	}

	.aime-sidebar-list {
		flex-direction: row;
		overflow-x: auto;
		gap: 4px;
		padding-bottom: 2px;
	}

	.aime-sidebar-nav.is-collapsed .aime-sidebar-item-label {
		display: inline;
	}

	.aime-sidebar-item,
	.is-collapsed .aime-sidebar-item {
		width: auto;
		min-height: 36px;
		padding: 8px 12px;
		gap: 8px;
		white-space: nowrap;
		font-size: 13px;
	}

	.aime-sidebar-nav.is-collapsed .aime-sidebar-badge {
		position: static;
		box-shadow: none;
		height: 20px;
		min-width: 20px;
		padding: 0 6px;
		font-size: 11px;
	}

	.aime-sidebar-nav.is-collapsed .aime-sidebar-item[data-tip]::after {
		content: none;
	}

	.aime-main-content {
		padding: 16px;
	}

	.aime-smtp-providers-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.aime-source-selector {
		flex-direction: column;

		.aime-source-btn {
			width: 100%;
		}
	}

	.aime-result-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.aime-stat-card-modern {
		padding: 14px;
	}

	.aime-stat-card-value {
		font-size: 22px;
	}

	.aime-editor-grid {
		grid-template-columns: 1fr;
	}

	.aime-dashboard-grid {
		grid-template-columns: 1fr;
	}

	.aime-editor-sidebar {
		order: -1;
	}

	.aime-import-sources {
		grid-template-columns: 1fr;
	}

	.aime-automation-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.aime-automation-actions {
		width: 100%;
		justify-content: flex-end;
	}
}

// ═══════════════════════════════════════════════════════════
// Campaign Editor — Multi-step Flow
// ═══════════════════════════════════════════════════════════

.aime-campaign-editor {
	max-width: 1280px;
	margin: 0 auto;
}

// ── Breadcrumb ──
.aime-campaign-breadcrumb {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;

	&__label {
		color: var(--aime-primary);
		cursor: pointer;
		font-size: 14px;

		&:hover {
			text-decoration: underline;
		}
	}

	&__sep {
		color: #999;
	}

	&__name {
		flex: 1;

		.components-text-control__input {
			border: none;
			background: transparent;
			font-size: 16px;
			font-weight: 600;
			padding: 4px 8px;

			&:focus {
				border-bottom: 2px solid var(--aime-primary);
				box-shadow: none;
			}
		}
	}
}

// ── Steps Navigation ──
.aime-steps {
	display: flex;
	align-items: center;
	gap: 0;
	padding: 16px 20px;
	background: #fff;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	margin-bottom: 20px;

	&__item {
		display: flex;
		align-items: center;
		gap: 0;

		&--active .aime-steps__circle {
			background: var(--aime-primary);
			border-color: var(--aime-primary);
		}

		&--active .aime-steps__label {
			color: var(--aime-primary);
			font-weight: 600;
		}

		&--done .aime-steps__circle {
			background: #4caf50;
			border-color: #4caf50;
		}

		&--done .aime-steps__label {
			color: #4caf50;
		}
	}

	&__btn {
		display: flex;
		align-items: center;
		gap: 8px;
		background: none;
		border: none;
		cursor: pointer;
		padding: 6px 12px;
		border-radius: 6px;
		transition: background 0.15s;

		&:hover {
			background: rgba(0, 0, 0, 0.04);
		}
	}

	&__circle {
		width: 10px;
		height: 10px;
		border-radius: 50%;
		border: 2px solid #ccc;
		background: transparent;
		flex-shrink: 0;
	}

	&__label {
		font-size: 13px;
		color: #666;
		white-space: nowrap;
	}

	&__arrow {
		margin: 0 4px;
		color: #ccc;
		font-size: 18px;
	}
}

// ── Unified Compose Toolbar Bar ──
.aime-compose-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid var(--aime-border);
	border-bottom: none;
	border-radius: var(--aime-radius) var(--aime-radius) 0 0;
	gap: 10px;
	flex-wrap: wrap;

	&__left {
		display: flex;
		align-items: center;
		gap: 8px;
	}

	&__right {
		display: flex;
		align-items: center;
		gap: 6px;
	}

	&__separator {
		width: 1px;
		height: 28px;
		background: var(--aime-border, #e3e8ed);
		flex-shrink: 0;
	}

	// ── Editor mode tab-like buttons (Block / Classic / Plain HTML) ──
	&__modes {
		display: flex;
		align-items: center;
		gap: 4px;
	}

	&__mode-btn {
		display: inline-flex !important;
		align-items: center !important;
		gap: 6px !important;
		padding: 6px 14px !important;
		height: 36px !important;
		font-size: 13px !important;
		font-weight: 500 !important;
		border: 1px solid #ccc !important;
		border-radius: 6px !important;
		background: #f8f8f8 !important;
		color: #50575e !important;
		cursor: pointer !important;
		white-space: nowrap !important;
		transition: all 0.15s ease !important;

		svg {
			width: 20px;
			height: 20px;
			fill: currentColor !important;
			flex-shrink: 0;
		}

		&:hover {
			background: #eaeaea !important;
			border-color: #999 !important;
			color: #1e1e1e !important;
		}

		&.is-active {
			background: var(--aime-primary) !important;
			border-color: var(--aime-primary) !important;
			color: #fff !important;
			box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;

			svg {
				fill: #fff !important;
			}
		}
	}

	// ── Small icon-only buttons (Desktop / Mobile toggle) ──
	&__icon-btn {
		width: 36px !important;
		height: 36px !important;
		min-width: 36px !important;
		padding: 0 !important;
		border: 1px solid #ccc !important;
		border-radius: 6px !important;
		background: #f8f8f8 !important;
		color: #50575e !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		cursor: pointer !important;
		transition: all 0.15s ease !important;

		svg {
			width: 20px;
			height: 20px;
			fill: currentColor;
		}

		&:hover {
			background: #eaeaea !important;
			border-color: #999 !important;
		}

		&.is-active {
			border-color: var(--aime-primary) !important;
			background: rgba(var(--aime-primary-rgb), 0.1) !important;
			color: var(--aime-primary) !important;
		}
	}

	// ── Right-side action buttons (Import, Preview, AI Writer) ──
	&__action-btn {
		display: inline-flex !important;
		align-items: center !important;
		font-size: 12px !important;
		height: 34px !important;
		padding: 0 14px !important;
		gap: 6px !important;
		border-radius: 6px !important;
		white-space: nowrap !important;
		font-weight: 600 !important;
		cursor: pointer !important;
		border: none !important;
		background: #50575e !important;
		color: #fff !important;
		transition: background 0.15s ease !important;

		svg {
			width: 16px;
			height: 16px;
			fill: #fff;
		}

		&:hover {
			background: #3c4043 !important;
		}

		&.aime-ai-btn {
			background: var(--aime-primary) !important;
			color: #fff !important;

			&:hover {
				background: #135e96 !important;
			}
		}
	}
}

.aime-compose-body {
	border: 1px solid var(--aime-border);
	border-radius: 0 0 var(--aime-radius) var(--aime-radius);
	overflow: hidden;
	min-height: 420px;
	background: #fff;
}

.aime-merge-tags-help {
	font-size: 12px;
	color: #888;
	margin-top: 8px;
}

// ── Step Action Buttons ──
.aime-step-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
	flex-wrap: wrap;
}

// ── Inline Step Validation Error ──
.aime-step-error {
	padding: 10px 16px;
	margin-top: 16px;
	background: var(--aime-error-light);
	border: 1px solid rgba(239, 68, 68, 0.25);
	border-radius: var(--aime-radius-sm);
	color: #991b1b;
	font-size: 13px;
	font-weight: 500;
	animation: aime-shake 0.4s ease;
}

.aime-btn-send {
	background: var(--aime-success) !important;
	border-color: var(--aime-success) !important;

	&:hover {
		background: #059669 !important;
		border-color: #059669 !important;
	}
}

// ── Sending Done / Success View ──
.aime-sending-done {
	text-align: center;
	padding: 40px 20px;
	animation: aime-fadeIn 0.5s ease;

	&__icon {
		font-size: 56px;
		margin-bottom: 16px;
		animation: aime-bounce 0.6s ease;
	}

	h3 {
		font-size: 22px;
		font-weight: 700;
		color: var(--aime-text);
		margin: 0 0 8px;
	}

	p {
		color: var(--aime-text-light);
		font-size: 14px;
		max-width: 420px;
		margin: 0 auto 24px;
		line-height: 1.6;
	}

	&__actions {
		display: flex;
		justify-content: center;
		gap: 12px;
	}
}

// ── Settings Step ──
.aime-settings-step {
	.aime-settings-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 20px;
	}

	@media (max-width: 782px) {
		.aime-settings-grid {
			grid-template-columns: 1fr;
		}
	}
}

.aime-field-with-ai {
	position: relative;

	.aime-ai-btn {
		position: absolute;
		right: 0;
		top: 0;
		font-size: 11px !important;
	}
}

// ── Recipients Step ──
.aime-list-checkboxes {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aime-empty-notice {
	color: #888;
	font-style: italic;
}

// ── Review Step ──
.aime-review-table {
	width: 100%;
	border-collapse: collapse;

	th,
	td {
		padding: 12px 16px;
		border-bottom: 1px solid var(--aime-border);
		text-align: left;
	}

	th {
		width: 140px;
		font-weight: 600;
		font-size: 12px;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: var(--aime-text-light);
		background: var(--aime-bg);
	}

	td {
		color: var(--aime-text);
	}
}

// ═══════════════════════════════════════════════════════════
// Gutenberg Email Editor — Standalone block editor
// ═══════════════════════════════════════════════════════════

// ── Scoped reset: prevent InterfaceSkeleton from full-page layout ──
.aime-visual-editor .interface-interface-skeleton {
	position: static !important;
	min-height: auto !important;
	height: auto !important;
}

// ── Visual editor root ──
.aime-visual-editor {
	position: relative;
	background: #fff;
	overflow: visible;
	min-height: 420px;
	box-sizing: border-box;

	*,
	*::before,
	*::after {
		box-sizing: inherit;
	}
}

// ── Layout: flex row (content + sidebar) — NO float, NO absolute ──
.aime-editor-layout {
	display: flex;
	flex-direction: row;
	min-height: 500px;
}

.aime-editor-layout__content {
	flex: 1;
	min-width: 0;
	position: relative;
	overflow: visible;
}

// ── Editor styles wrapper (writing surface) ──
.aime-visual-editor .editor-styles-wrapper {
	color: #1e1e1e;
	font-size: 16px;
	line-height: 1.8;
	min-height: 400px;
	padding: 16px;
	box-sizing: border-box;
}

// ── WritingFlow — must have height so blocks are clickable ──
.aime-visual-editor .block-editor-writing-flow {
	min-height: 350px;
	position: relative;
	cursor: text;
}

// ── Block list max-width ──
.aime-visual-editor .block-editor-block-list__layout {
	max-width: 600px;
	margin: 0 auto;
}

// ── Inserter (+) inside the writing area (FluentCRM pattern) ──
.aime-inserter {
	padding: 8px 16px 0;

	.block-editor-inserter__toggle {
		background: #1e1e1e;
		color: #fff;
		border-radius: 3px;
		padding: 0;
		min-width: 28px;
		height: 28px;
		display: flex;
		align-items: center;
		justify-content: center;
		border: none;
		cursor: pointer;

		svg {
			fill: #fff;
		}

		&:hover {
			background: #007cba;
			color: #fff;
		}
	}
}

// ── Block list ──
.aime-block-editor__block-list {
	margin-left: auto;
	margin-right: auto;
	padding-bottom: 48px;
	padding-top: 12px;
	max-width: 600px;

	.block-editor-block-list__block {
		margin: 7px auto;
	}

	.wp-block {
		max-width: 100%;
	}
}

// ── Sidebar — now a flex child, NOT position:absolute ──
.aime-editor-sidebar {
	width: 280px;
	flex-shrink: 0;
	border-left: 1px solid var(--aime-border, #e3e8ed);
	background: var(--aime-bg, #f9fafb);
	overflow-y: auto;
	max-height: 90vh;
	color: #1e1e1e;
	z-index: 1;

	.components-panel {
		border-left: 0;
		border-right: 0;
		margin-bottom: -1px;
		margin-top: -1px;
	}

	.aime-sidebar-header {
		background: #e0e0e0;
		padding: 8px 16px;

		h2 {
			margin: 0;
			font-size: 13px;
			text-transform: uppercase;
			letter-spacing: 0.5px;
			color: #555;
		}
	}

	.block-editor-block-inspector__card {
		margin: 0;
	}

	// Hide description text
	.block-editor-block-card__description {
		display: none !important;
	}

	// Hide advanced section to keep email-focused
	.components-panel__body.block-editor-block-inspector__advanced {
		display: none !important;
	}

	@media (max-width: 782px) {
		display: none;
	}
}

// ── Floating toolbar visibility fixes ──
.aime-visual-editor {

	.block-editor-block-contextual-toolbar-wrapper {
		z-index: 99;
		position: sticky;
		top: 0;
	}

	.block-editor-block-toolbar,
	.block-editor-block-contextual-toolbar {
		background: #fff !important;
		border: 1px solid #ccc !important;
		border-radius: 2px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
	}

	.block-editor-block-toolbar .components-toolbar-group,
	.block-editor-block-toolbar .components-toolbar {
		border-right-color: #ddd;
	}

	.block-editor-block-toolbar .components-button,
	.block-editor-block-contextual-toolbar .components-button {
		color: #1e1e1e !important;
		fill: currentColor !important;
		justify-content: center !important;

		svg {
			fill: currentColor !important;
		}

		&:hover {
			color: #007cba !important;
		}

		&.is-pressed {
			background: #1e1e1e !important;
			color: #fff !important;

			svg {
				fill: #fff !important;
			}
		}
	}

	.block-editor-block-mover-button {
		color: #1e1e1e !important;

		svg {
			fill: currentColor !important;
		}
	}

	.components-popover {
		z-index: 100;
	}

	// ── Buttons block fixes for email ──
	.wp-block-buttons {
		justify-content: flex-start;

		.wp-block-button {
			margin: 0;
		}
	}

	.wp-block-button__link {
		border-radius: 0;
		display: block;
		font-size: 16px;
		padding: 12px 18px;
		text-align: center;
		text-decoration: none;
	}

	.wp-block-button:not(.is-style-outline) .wp-block-button__link {
		background-color: #32373c;
		color: #fff;
	}

	// ── Drop zone ──
	.components-drop-zone__provider {
		min-height: 400px;
	}
}

// ═══════════════════════════════════════════════════════════
// GLOBAL: Block icon + Inserter tab fixes
// These MUST be outside .aime-visual-editor because the
// Inserter popover may render via portal at body level.
// Our stylesheet only loads on the plugin page, so this
// won't affect other WordPress editors.
// ═══════════════════════════════════════════════════════════

// ── Ensure block icons display in the Inserter panel ──
.block-editor-block-types-list__item-icon {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #1e1e1e !important;

	.block-editor-block-icon {
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		color: inherit !important;
		width: 24px !important;
		height: 24px !important;
	}

	svg {
		width: 24px !important;
		height: 24px !important;
		fill: currentColor !important;
		visibility: visible !important;
		opacity: 1 !important;
	}
}

// Also fix block icons within the block-editor-block-icon wrapper globally
.block-editor-block-icon {
	color: #1e1e1e;

	svg {
		fill: currentColor;
	}
}

// ── Hide Patterns & Media tabs in the Inserter ──
// Multiple selectors for maximum compat across WP versions.
.block-editor-inserter__tabs {
	.components-tab-panel__tabs {
		button[id*="patterns"],
		button[id*="media"],
		button[id*="reusable"] {
			display: none !important;
		}
	}

	[role="tab"]:not(:first-child) {
		display: none !important;
	}

	.components-tab-panel__tabs {
		border-bottom: 1px solid #e0e0e0;
	}
}

// Fallback: Inserter uses different wrapper in some WP versions
.block-editor-inserter__content {
	.components-tab-panel__tabs {
		button:not(:first-child) {
			display: none !important;
		}
	}
}

// Broader fallback targeting Inserter popover portal
.components-popover .block-editor-inserter__tabs,
.components-popover__content .block-editor-inserter__tabs {
	[role="tab"]:not(:first-child) {
		display: none !important;
	}
}

// ── View modes ──
.aime-skin-mobile {
	.editor-styles-wrapper {
		max-width: 375px;
		margin: 0 auto;
		border-left: 1px solid #ddd;
		border-right: 1px solid #ddd;
	}
}

// ── Loading state ──
.aime-gutenberg-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 300px;
	color: #999;
}

// ── HTML editor wrap (Classic/TinyMCE) ──
.aime-html-editor-wrap {
	min-height: 400px;

	.aime-editor-textarea {
		width: 100%;
		min-height: 400px;
	}
}

// ── Plain HTML textarea ──
.aime-plain-html-wrap {
	padding: 0;

	.aime-plain-textarea {
		width: 100%;
		min-height: 480px;
		padding: 16px;
		border: none;
		outline: none;
		resize: vertical;
		font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
		font-size: 13px;
		line-height: 1.6;
		color: #1e1e1e;
		background: #f9f9f9;
		box-sizing: border-box;
		tab-size: 2;

		&:focus {
			background: #fff;
			box-shadow: inset 0 0 0 1px var(--aime-primary);
		}
	}
}

// ── Editor Mode Toggle ──────────────────────────────────

.aime-editor-mode-toggle {
	display: inline-flex;
	gap: 2px;
	background: var(--aime-bg);
	border-radius: 6px;
	padding: 2px;

	.components-button {
		font-size: 12px !important;
		min-height: 28px !important;
		padding: 4px 12px !important;
		border-radius: 4px !important;
	}
}

.aime-view-mode-toggle {
	display: inline-flex;
	gap: 2px;

	.components-button {
		min-width: 30px !important;
		padding: 4px !important;
	}
}
#aime-app .aime-compose-bar__modes svg {
    fill: #000;
}

// ── Email Preview Modal ─────────────────────────────────

.aime-email-preview-modal {
	.components-modal__content {
		padding: 0;
	}

	.aime-preview-container {
		padding: 20px;
	}

	.aime-preview-toolbar {
		display: flex;
		gap: 8px;
		justify-content: center;
		margin-bottom: 16px;
		padding-bottom: 16px;
		border-bottom: 1px solid var(--aime-border);
	}

	.aime-preview-frame {
		transition: max-width 0.3s ease;

		iframe {
			display: block;
		}
	}

	.aime-preview-loading {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		min-height: 400px;
		gap: 16px;
		color: #999;
	}
}

// ── Card Action Group ───────────────────────────────────

.aime-card-action-group {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

// ═══════════════════════════════════════════════════════════
// Pill Badges (Lists & Tags in subscriber table)
// ═══════════════════════════════════════════════════════════

.aime-pill-group {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.aime-pill {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.4;
	white-space: nowrap;
}

.aime-pill--list {
	background: var(--aime-primary-light);
	color: var(--aime-primary);
	border: 1px solid rgba(56, 88, 233, 0.15);
}

.aime-pill--tag {
	background: var(--aime-warning-light);
	color: #92400e;
	border: 1px solid rgba(245, 158, 11, 0.2);
}

.aime-text-muted {
	color: var(--aime-text-light);
	font-size: 12px;
}

// ═══════════════════════════════════════════════════════════
// Column Toggle Dropdown
// ═══════════════════════════════════════════════════════════

.aime-column-toggle {
	.components-popover__content {
		min-width: 200px;
	}
}

.aime-btn-columns {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: var(--aime-text-light) !important;

	&:hover {
		color: var(--aime-primary) !important;
	}
}

// ═══════════════════════════════════════════════════════════
// Quick Action buttons — modern hover
// ═══════════════════════════════════════════════════════════

.aime-quick-action:hover {
	border-color: var(--aime-primary);
	box-shadow: var(--aime-shadow-md);
	transform: translateY(-2px);
}

// ═══════════════════════════════════════════════════════════
// Stat cards — subtle gradient
// ═══════════════════════════════════════════════════════════

.aime-stat-card {
	transition: transform var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		transform: translateY(-2px);
		box-shadow: var(--aime-shadow-md);
	}
}

// ═══════════════════════════════════════════════════════════
// Animations / Keyframes
// ═══════════════════════════════════════════════════════════

@keyframes aime-slideDown {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes aime-fadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes aime-shake {
	0%, 100% { transform: translateX(0); }
	20%      { transform: translateX(-6px); }
	40%      { transform: translateX(6px); }
	60%      { transform: translateX(-4px); }
	80%      { transform: translateX(4px); }
}

@keyframes aime-bounce {
	0%   { transform: scale(0.3); opacity: 0; }
	50%  { transform: scale(1.1); }
	70%  { transform: scale(0.95); }
	100% { transform: scale(1); opacity: 1; }
}

// ═══════════════════════════════════════════════════════════
// Steps bar — modern look
// ═══════════════════════════════════════════════════════════

.aime-steps {
	.aime-step {
		transition: all var(--aime-transition);
	}
}

// ═══════════════════════════════════════════════════════════
// Sidebar nav — modern transitions
// ═══════════════════════════════════════════════════════════

.aime-nav-item {
	transition: all var(--aime-transition) !important;
}

// ═══════════════════════════════════════════════════════════
// Skeleton / Shimmer Loading
// ═══════════════════════════════════════════════════════════

@keyframes aime-shimmer {
	0%   { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

// Button spinner
@keyframes aime-spin {
	to { transform: rotate(360deg); }
}

.aime-btn-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: aime-spin 0.6s linear infinite;
	flex-shrink: 0;

	&--light {
		border-color: rgba(255, 255, 255, 0.3);
		border-top-color: #fff;
	}
}

// The waiting material. Tinted from the house tokens, not neutral gray — a
// gray sweep on a green-tinted app reads as a different product loading.
.aime-skeleton {
	display: block;
	background: linear-gradient(
		90deg,
		var(--aime-bg-subtle) 25%,
		var(--aime-border) 50%,
		var(--aime-bg-subtle) 75%
	);
	background-size: 200% 100%;
	animation: aime-shimmer 1.6s ease-in-out infinite;
	border-radius: var(--aime-radius-sm);
}

// A shimmer is decoration, not information — the reserved space already says
// "loading". Anyone who asked for less motion keeps the space and loses the sweep.
@media (prefers-reduced-motion: reduce) {
	.aime-skeleton {
		animation: none;
	}
}

.aime-skeleton-row {
	display: flex;
	gap: 12px;
	margin-bottom: 12px;

	.aime-skeleton {
		flex: 1;
	}
}

// ── Loading states ────────────────────────────────────────
// One component (`Loader`) renders all of these; the variant names what is
// arriving, so the wait has the shape of the thing it is waiting for.
.aime-loading {
	.aime-skeleton + .aime-skeleton {
		margin-top: 10px;
	}
}

.aime-loading__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.aime-loading__card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow);
	padding: 20px;
}

// A Loader dropped inside a panel must not draw a second panel. Cards are never
// nested in this system, so the chrome comes off and only the bars remain.
.aime-card .aime-loading__card,
.aime-panel .aime-loading__card,
.aime-premium-modal .aime-loading__card {
	background: none;
	border: 0;
	box-shadow: none;
	padding: 0;
}

.aime-loading__table {
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	background: var(--aime-white);
}

.aime-card .aime-loading__table {
	border: 0;
	border-radius: 0;
}

.aime-loading__tr {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
	align-items: center;
	padding: 14px 16px;
	border-bottom: 1px solid var(--aime-border-light);

	&:last-child {
		border-bottom: 0;
	}

	// Bars are laid out by the grid here, so the stacking margin does not apply.
	.aime-skeleton + .aime-skeleton {
		margin-top: 0;
	}
}

.aime-loading__tr--head {
	background: var(--aime-bg);
	border-bottom-color: var(--aime-border);
}

.aime-loading__field {
	margin-bottom: 20px;

	&:last-child {
		margin-bottom: 0;
	}
}

.aime-skeleton--control {
	border-radius: var(--aime-radius-sm);
	margin-top: 8px;
}

// ── Dashboard wait ────────────────────────────────────────
.aime-loading__stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 1px;
	background: var(--aime-border-light);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	margin-bottom: 16px;
}

.aime-loading__stat {
	background: var(--aime-white);
	padding: 20px;

	.aime-skeleton + .aime-skeleton {
		margin-top: 12px;
	}
}

.aime-loading__panels {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 16px;
}

.aime-skeleton--plot {
	margin-top: 16px;
}

// ── Calendar wait ─────────────────────────────────────────
.aime-loading__calendar {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 1px;
	background: var(--aime-border-light);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
}

.aime-loading__day-head {
	background-color: var(--aime-bg);
	margin: 14px 12px;
}

.aime-loading__day {
	background: var(--aime-white);
	min-height: 92px;
	padding: 10px;

	.aime-skeleton + .aime-skeleton {
		margin-top: 10px;
	}
}

@media (max-width: 782px) {
	.aime-loading__tr {
		grid-template-columns: repeat(3, 1fr);

		.aime-skeleton:nth-child(n + 4) {
			display: none;
		}
	}

	// A seven-column month does not survive a phone. The calendar wait falls
	// back to the agenda list those views switch to at this width.
	.aime-loading__calendar {
		grid-template-columns: 1fr;
	}

	.aime-loading__day-head {
		display: none;
	}

	.aime-loading__day {
		min-height: 0;
	}
}

// ═══════════════════════════════════════════════════════════
// Toast Notifications
// ═══════════════════════════════════════════════════════════

.aime-toast-container {
	position: fixed;
	top: 48px;
	right: 20px;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: none;
}

.aime-toast {
	padding: 12px 20px;
	border-radius: var(--aime-radius-sm);
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	box-shadow: var(--aime-shadow-lg);
	animation: aime-toast-in 0.3s ease-out;
	pointer-events: auto;
	max-width: 360px;
	display: flex;
	align-items: center;
	gap: 12px;

	&--success { background: var(--aime-success); }
	&--error   { background: var(--aime-error); }
	&--warning { background: var(--aime-warning); color: #1a1a1a; }
	&--info    { background: var(--aime-info); }
}

.aime-toast-dismiss {
	background: none;
	border: none;
	color: inherit;
	font-size: 18px;
	cursor: pointer;
	padding: 0 0 0 4px;
	line-height: 1;
	opacity: 0.8;
	flex-shrink: 0;

	&:hover { opacity: 1; }
}

@keyframes aime-toast-in {
	from { opacity: 0; transform: translateX(40px); }
	to   { opacity: 1; transform: translateX(0); }
}

// ═══════════════════════════════════════════════════════════
// Confirm Modal
// The standalone `.aime-confirm-overlay` / `.aime-confirm-modal` /
// `.aime-confirm-actions` rules that used to live here were dead: ConfirmModal
// renders the shared `.aime-premium-modal` shell. They carried the last
// neutral-black overlay and the last bounce entrance in the plugin, so
// deleting them is what makes the dialog language single-sourced.
// ═══════════════════════════════════════════════════════════

// ═══════════════════════════════════════════════════════════
// Time Range Selector
// ═══════════════════════════════════════════════════════════

.aime-time-range-selector {
	.components-base-control {
		margin-bottom: 0;
	}

	.components-select-control__input {
		min-height: 32px;
		font-size: 13px;
	}
}

// ═══════════════════════════════════════════════════════════
// Analytics Charts
// ═══════════════════════════════════════════════════════════

.aime-analytics-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;

	h2 {
		margin: 0;
		font-size: 20px;
		color: var(--aime-text);
	}
}

.aime-stat-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.aime-stat-card {
	background: var(--aime-white);
	border-radius: var(--aime-radius);
	padding: 16px;
	box-shadow: var(--aime-shadow);
	border-left: 3px solid var(--aime-primary);
	transition: transform var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		transform: translateY(-2px);
		box-shadow: var(--aime-shadow-md);
	}

	&__label {
		font-size: 12px;
		color: var(--aime-text-light);
		text-transform: uppercase;
		letter-spacing: 0.5px;
		margin-bottom: 4px;
		display: block;
	}

	&__value {
		font-size: 24px;
		font-weight: 700;
		display: block;
	}
}

.aime-analytics-charts {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-bottom: 24px;

	@media (max-width: 900px) {
		grid-template-columns: 1fr;
	}
}

.aime-chart-card {
	background: var(--aime-white);
	border-radius: var(--aime-radius);
	padding: 20px;
	box-shadow: var(--aime-shadow);

	h3 {
		margin: 0 0 16px;
		font-size: 14px;
		color: var(--aime-text);
		font-weight: 600;
	}

	&--full {
		grid-column: 1 / -1;
	}
}

// ═══════════════════════════════════════════════════════════
// Sparkline inside dashboard stat cards
// ═══════════════════════════════════════════════════════════

.aime-sparkline-wrap {
	margin-top: 8px;
	opacity: 0.75;
}

// ═══════════════════════════════════════════════════════════
// Visual Automation Builder (React Flow)
// ═══════════════════════════════════════════════════════════

.aime-automation-editor-full {
	position: relative;
}

.aime-automation-settings-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px;
	padding: 16px;
	background: var(--aime-white);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow);
	margin-bottom: 16px;

	.components-base-control {
		margin-bottom: 0;
		flex: 1;
		min-width: 180px;
	}
}

.aime-flow-canvas {
	height: 500px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-bg);
	overflow: hidden;

	.react-flow__background {
		background: var(--aime-bg);
	}
}

.aime-flow-node {
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	min-width: 160px;
	text-align: center;
	box-shadow: var(--aime-shadow);
	border: 2px solid;
	cursor: pointer;
	transition: box-shadow 0.2s ease;

	&:hover {
		box-shadow: var(--aime-shadow-md);
	}

	.aime-flow-node__icon {
		font-size: 16px;
		margin-right: 4px;
	}
}

.aime-flow-fab {
	position: absolute;
	bottom: 20px;
	right: 20px;
	z-index: 5;
}

.aime-step-type-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 10px;
	padding: 12px 0;
}

.aime-step-type-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 14px 8px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-white);
	cursor: pointer;
	transition: all var(--aime-transition);
	font-size: 12px;

	&:hover {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
	}

	span:first-child {
		font-size: 20px;
	}
}

// ═══════════════════════════════════════════════════════════
// AI Subject Optimizer
// ═══════════════════════════════════════════════════════════

.aime-ai-optimizer {
	padding: 16px 0;
}

.aime-ai-suggestion-card {
	padding: 12px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	margin-bottom: 10px;
	transition: background var(--aime-transition);

	&:hover {
		background: var(--aime-primary-light);
	}

	&__subject {
		font-weight: 600;
		font-size: 14px;
		margin-bottom: 4px;
		color: var(--aime-text);
	}

	&__meta {
		font-size: 12px;
		color: var(--aime-text-light);
		margin-bottom: 8px;
		display: flex;
		gap: 12px;
	}

	&__actions {
		display: flex;
		gap: 8px;
	}
}

// ═══════════════════════════════════════════════════════════
// AI Content Scorer
// ═══════════════════════════════════════════════════════════

.aime-content-scorer {
	padding: 4px 0;
}

.aime-score-overall {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
}

.aime-score-circle {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	font-weight: 700;
	color: #fff;
	flex-shrink: 0;
}

.aime-score-bar {
	margin-bottom: 10px;

	&__header {
		display: flex;
		justify-content: space-between;
		font-size: 12px;
		margin-bottom: 4px;
		color: var(--aime-text-light);
	}

	&__track {
		height: 6px;
		background: #e5e7eb;
		border-radius: 3px;
		overflow: hidden;
	}

	&__fill {
		height: 100%;
		border-radius: 3px;
		transition: width 0.5s ease;
	}
}

.aime-spam-level {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 12px;

	&--low    { background: var(--aime-success-light); color: var(--aime-success); }
	&--medium { background: var(--aime-warning-light); color: var(--aime-warning); }
	&--high   { background: var(--aime-error-light); color: var(--aime-error); }
}

.aime-score-tips {
	list-style: none;
	padding: 0;
	margin: 8px 0;

	li {
		font-size: 12px;
		padding: 4px 0;
		color: var(--aime-text-light);
		display: flex;
		align-items: flex-start;
		gap: 6px;

		&::before {
			content: '💡';
			flex-shrink: 0;
		}
	}
}

.aime-score-stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);

	span {
		font-size: 12px;
		color: var(--aime-text-light);

		strong {
			color: var(--aime-text);
		}
	}
}

// ═══════════════════════════════════════════════════════════
// AI Send Time Optimizer
// ═══════════════════════════════════════════════════════════

.aime-send-time-opt {
	margin-top: 8px;
}

.aime-send-time-result {
	padding: 12px;
	background: var(--aime-primary-light);
	border-radius: var(--aime-radius-sm);
}

.aime-send-time-rec {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.aime-send-time-icon {
	font-size: 18px;
}

.aime-confidence {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 10px;
	font-weight: 600;
	text-transform: capitalize;

	&--high   { background: var(--aime-success-light); color: var(--aime-success); }
	&--medium { background: var(--aime-warning-light); color: var(--aime-warning); }
	&--low    { background: var(--aime-error-light); color: var(--aime-error); }
}

.aime-send-time-reason,
.aime-send-time-alts {
	font-size: 12px;
	color: var(--aime-text-light);
	margin: 4px 0 0;
}

// ═══════════════════════════════════════════════════════════
// Campaign Progress
// ═══════════════════════════════════════════════════════════

.aime-campaign-progress {
	.aime-page-header {
		margin-bottom: 28px;

		> div {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			gap: 8px 12px;
		}

		.components-button.is-link {
			display: block;
			width: 100%;
			text-align: left;
			margin-bottom: 4px;
			padding: 6px 12px;
			border-radius: var(--aime-radius-sm);
			font-size: 13px;
			color: var(--aime-primary);
			text-decoration: none;
			background: var(--aime-bg);
			border: 1px solid var(--aime-border);
			transition: all var(--aime-transition);

			&:hover {
				background: var(--aime-primary);
				color: #fff;
				border-color: var(--aime-primary);
			}
		}

		h2 {
			margin: 0;
			font-size: 20px;
			font-weight: 600;
			color: var(--aime-text);
		}

		.aime-badge {
			margin-left: 4px;
		}
	}
}

.aime-overall-progress {
	display: flex;
	align-items: center;
	gap: 32px;

	&__ring {
		position: relative;
		width: 100px;
		height: 100px;
		flex-shrink: 0;
	}

	&__stats {
		display: flex;
		gap: 24px;
		flex-wrap: wrap;
	}
}

.aime-progress-ring {
	width: 100%;
	height: 100%;
}

.aime-progress-ring__text {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	font-weight: 700;
	color: var(--aime-text);
}

.aime-progress-stat {
	text-align: center;

	&__num {
		display: block;
		font-size: 24px;
		font-weight: 700;
	}

	&__label {
		font-size: 12px;
		color: var(--aime-text-light);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}
}

.aime-progress-bar-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}

.aime-progress-bar-label {
	width: 60px;
	font-size: 12px;
	color: var(--aime-text-light);
	flex-shrink: 0;
}

.aime-progress-bar-track {
	flex: 1;
	height: 8px;
	background: #e5e7eb;
	border-radius: 4px;
	overflow: hidden;
}

.aime-progress-bar-fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.5s ease;
}

.aime-progress-bar-value {
	width: 100px;
	font-size: 12px;
	color: var(--aime-text);
	text-align: right;
	flex-shrink: 0;
}

.aime-progress-rates {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 20px;

	@media (max-width: 600px) {
		grid-template-columns: 1fr;
	}
}

.aime-rate-card {
	text-align: center;
	padding: 8px 0;

	&__value {
		display: block;
		font-size: 28px;
		font-weight: 700;
	}

	&__label {
		font-size: 12px;
		color: var(--aime-text-light);
		text-transform: uppercase;
	}
}

.aime-progress-auto-refresh {
	text-align: center;
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 16px;
}

.aime-ai-loading {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--aime-text-light);
	font-size: 13px;
}

.aime-ai-summary-text {
	p {
		line-height: 1.6;
		color: var(--aime-text);
	}
}

// ═══════════════════════════════════════════════════════════
// Subscriber Profile
// ═══════════════════════════════════════════════════════════

.aime-subscriber-profile {
	.aime-profile-header {
		margin-bottom: 16px;
	}
}

.aime-profile-info {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.aime-profile-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--aime-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;

	span {
		font-size: 24px;
		font-weight: 700;
		color: #fff;
	}
}

.aime-profile-details {
	flex: 1;
}

.aime-profile-name {
	margin: 0 0 2px;
	font-size: 18px;
	color: var(--aime-text);
}

.aime-profile-email {
	margin: 0 0 12px;
	color: var(--aime-text-light);
	font-size: 14px;
}

.aime-profile-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 16px;
}

.aime-profile-stats-row {
	display: flex;
	gap: 24px;
	flex-wrap: wrap;
}

.aime-profile-stat-mini {
	text-align: center;

	strong {
		display: block;
		font-size: 18px;
		color: var(--aime-text);
	}

	span {
		font-size: 11px;
		color: var(--aime-text-light);
		text-transform: uppercase;
	}
}

.aime-profile-columns {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 20px;
	margin-top: 20px;

	@media (max-width: 768px) {
		grid-template-columns: 1fr;
	}
}

// Activity Timeline
.aime-activity-filter {
	margin-bottom: 12px;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-activity-timeline {
	position: relative;
	padding-left: 32px;

	&::before {
		content: '';
		position: absolute;
		left: 14px;
		top: 0;
		bottom: 0;
		width: 2px;
		background: var(--aime-border);
	}
}

.aime-timeline-item {
	position: relative;
	padding-bottom: 16px;

	&:last-child {
		padding-bottom: 0;
	}
}

.aime-timeline-dot {
	position: absolute;
	left: -26px;
	top: 2px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	border: 2px solid var(--aime-white);
	box-shadow: 0 0 0 2px var(--aime-border);
}

.aime-timeline-content {
	padding: 0;
}

.aime-timeline-title {
	font-size: 13px;
	font-weight: 500;
	color: var(--aime-text);
	margin-bottom: 2px;
}

.aime-timeline-meta {
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-timeline-time {
	font-size: 11px;
	color: var(--aime-text-light);
}

// Notes
.aime-note-form {
	margin-bottom: 16px;

	.components-base-control {
		margin-bottom: 8px;
	}
}

.aime-notes-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aime-note-item {
	padding: 10px 12px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius-sm);
	border: 1px solid var(--aime-border);
}

.aime-note-content {
	font-size: 13px;
	color: var(--aime-text);
	line-height: 1.5;
	white-space: pre-wrap;
}

.aime-note-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 6px;

	time {
		font-size: 11px;
		color: var(--aime-text-light);
	}
}

// ═══════════════════════════════════════════════════════════
// Toolbar (search + filter) across list pages
// ═══════════════════════════════════════════════════════════

.aime-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;

	&__search {
		flex: 1;
		min-width: 200px;

		.components-base-control {
			margin-bottom: 0;
		}
	}

	&__filter {
		min-width: 160px;

		.components-base-control {
			margin-bottom: 0;
		}
	}

	&__count {
		font-size: 12px;
		color: var(--aime-text-light);
		white-space: nowrap;
	}
}

// ═══════════════════════════════════════════════════════════
// Actions group for table cells
// ═══════════════════════════════════════════════════════════

.aime-actions-group {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: nowrap;
}

// ═══════════════════════════════════════════════════════════
// Schedule Options in Campaign Editor
// ═══════════════════════════════════════════════════════════

.aime-schedule-options {
	display: flex;
	gap: 12px;
	margin-bottom: 16px;
}

.aime-schedule-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	cursor: pointer;
	flex: 1;
	transition: all var(--aime-transition);

	input[type="radio"] {
		display: none;
	}

	&.is-active {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
	}

	&:hover {
		border-color: var(--aime-primary);
	}

	&__icon {
		font-size: 24px;
	}

	strong {
		display: block;
		font-size: 14px;
		color: var(--aime-text);
	}

	small {
		color: var(--aime-text-light);
		font-size: 12px;
	}
}

.aime-schedule-datetime {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	flex-wrap: wrap;

	.components-base-control {
		margin-bottom: 0;
		min-width: 160px;
	}
}

// ═══════════════════════════════════════════════════════════
// A/B Testing Info
// ═══════════════════════════════════════════════════════════

.aime-ab-info {
	font-size: 12px;
	color: var(--aime-text-light);
	padding: 8px 12px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius-sm);
	margin-top: 8px;
	line-height: 1.5;

	strong {
		color: var(--aime-text);
	}
}

// ═══════════════════════════════════════════════════════════
// Template modal content area
// ═══════════════════════════════════════════════════════════

.aime-template-content-textarea textarea {
	font-family: monospace;
	font-size: 12px;
}

.aime-template-desc {
	font-size: 12px;
	color: var(--aime-text-light);
	margin: 2px 0 0;
}

// ═══════════════════════════════════════════════════════════
// Profile & Progress loading state
// ═══════════════════════════════════════════════════════════

.aime-profile-loading,
.aime-progress-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	gap: 12px;
	color: var(--aime-text-light);
}

// ═══════════════════════════════════════════════════════════
// Email Marketing v2 — New Component Styles
// ═══════════════════════════════════════════════════════════

// Page header
.aime-page-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;

	h2 {
		margin: 4px 0 0;
		font-size: 20px;
		font-weight: 600;
		color: var(--aime-text);
	}
}

.aime-header-left {
	flex-wrap: wrap;
	min-width: 0;
}

.aime-header-actions,
.aime-page-header-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	min-width: 0;
	max-width: 100%;
}

// KPI Grid
.aime-kpi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.aime-kpi-grid-4 {
	grid-template-columns: repeat(4, 1fr);

	@media (max-width: 900px) {
		grid-template-columns: repeat(2, 1fr);
	}
	@media (max-width: 480px) {
		grid-template-columns: 1fr;
	}
}

.aime-kpi-grid-5 {
	grid-template-columns: repeat(5, 1fr);

	@media (max-width: 900px) {
		grid-template-columns: repeat(3, 1fr);
	}
	@media (max-width: 600px) {
		grid-template-columns: repeat(2, 1fr);
	}
}

.aime-kpi-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	text-align: center;
	transition: box-shadow var(--aime-transition);

	&:hover {
		box-shadow: var(--aime-shadow-md);
	}
}

.aime-kpi-compact {
	padding: 14px 16px;
}

.aime-kpi-value {
	display: block;
	font-size: 28px;
	font-weight: 700;
	color: var(--aime-text);
	line-height: 1.2;
}

.aime-kpi-label {
	display: block;
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

// ── Overview page rhythm ─────────────────────────────────
// One vertical scale for the dashboard: 8px inside a group, 24px between
// siblings, 40px between sections. Scoped to .aime-overview rather than
// changing .aime-section-title globally, because that selector is shared with
// every other module page and their rhythm is not this page's problem.
.aime-overview {
	// A section heading belongs to what comes after it, so it sits closer to
	// its own content than to the block it follows.
	//
	// 15px, not the global 20px: the page title renders at 20px too, so a
	// section heading at the same size claimed to be the same level as the page
	// it lives on. The 40px above it is what marks it as a new section — size
	// was doing a job space already does better. Scoped, because every other
	// module page uses this selector and their hierarchy is not this pass's
	// business.
	.aime-section-title {
		margin: 40px 0 12px;
		font-size: 15px;
		font-weight: 600;
		line-height: 1.4;
	}

	// The first heading has nothing above it to separate from.
	> .aime-section-title:first-child {
		margin-top: 0;
	}

	// Grids end a section; the heading below supplies the gap.
	.aime-charts-grid,
	.aime-module-cards-grid {
		margin-bottom: 0;
	}

	// Chart chrome is all one role. The axis ticks are set to 11px in the JSX,
	// but Recharts legends carry no size of their own and inherit the 13px body,
	// so the same class of label rendered at two sizes inside one chart.
	.recharts-legend-item-text {
		font-size: 11px;
	}
}

// Charts grid
.aime-charts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
	gap: 20px;
	margin-bottom: 24px;
}

// `.aime-chart-pro-gate` lived here: a blur + upgrade scrim over the dashboard
// activity chart. Removed with the gate itself — the activity endpoint never
// had a Pro check, so the blur was hiding the site's own data behind a wall
// that was never load-bearing.

// Quick actions
// Centred: every current use sits under a centred EmptyState or card title, so
// a left-flushed row read as debris hanging off the edge of centred copy.
.aime-quick-actions {
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

// ── Dashboard Module Summary Cards ───────────────────────
.aime-module-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 20px;
	margin-bottom: 24px;
}

.aime-module-summary-card {
	position: relative;
	overflow: hidden;

	.aime-card-body {
		padding-top: 0;
	}
}

.aime-module-summary-stripe {
	height: 4px;
	margin: 0 -20px 16px;
	border-radius: 0;
}

// The lead number answers "is this module OK?" on its own. Everything under it
// is supporting detail, so the size gap between the two has to be obvious at a
// glance — 32px against 15px, not a polite nudge. Deliberately NOT tinted with
// the module colour: the 4px stripe above already carries the room's identity,
// and a coloured hero number plus an accent stripe is the same signal twice.
.aime-module-summary-lead {
	margin-bottom: 16px;
}

.aime-module-summary-lead__value {
	display: block;
	font-size: 32px;
	font-weight: 700;
	color: var(--aime-text);
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.aime-module-summary-lead__label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	color: var(--aime-text-light);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	margin-top: 4px;
}

// Supporting stats. Left-aligned like the lead so every number in the card
// shares one scan edge instead of drifting to its own column centre.
.aime-module-summary-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
	gap: 12px 16px;
}

.aime-module-summary-stat {
	text-align: left;
}

.aime-module-summary-value {
	display: block;
	font-size: 15px;
	font-weight: 700;
	color: var(--aime-text);
	line-height: 1.4;
}

.aime-module-summary-label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	color: var(--aime-text-light);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	margin-top: 2px;
}

// ── Email / SEO Performance panels ───────────────────────
// Removed. The dashboard's two performance cards became arc gauges in the
// summary band (see DASHBOARD — SUMMARY BAND at the end of this file), and
// their supporting numbers moved into the module cards. The old
// .aime-performance-metric was a bordered, shadowed box inside a card — a card
// nested in a card, which the inset floor (--aime-bg-subtle) exists to avoid.

// Table toolbar
.aime-table-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);

	.aime-pagination-info {
		font-size: 13px;
		color: var(--aime-text-light);
	}
}

.aime-table-toolbar {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
	justify-content: flex-end;

	.components-search-control {
		min-width: 200px;
		max-width: 320px;
		flex: 0 1 320px;

		.components-search-control__input-wrapper {
			height: 40px;
		}

		input[type="search"].components-search-control__input {
			height: 40px;
			box-sizing: border-box;
		}
	}

	.components-base-control {
		margin-bottom: 0;
	}

	.components-select-control__input {
		min-width: 160px;
		height: 40px;
		border: 1.5px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		padding: 0 32px 0 12px;
		font-size: 13px;
		color: var(--aime-text);
		background: var(--aime-white);
		appearance: none;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%235f7562'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: right 8px center;
		background-size: 16px;
		cursor: pointer;
		transition: all var(--aime-transition);
		box-sizing: border-box;

		&:focus {
			border-color: var(--aime-primary);
			box-shadow: 0 0 0 3px rgba(var(--aime-primary-rgb), 0.1);
			outline: none;
		}
	}
}

// Bulk actions bar
.aime-bulk-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--aime-primary-light);
	border-radius: var(--aime-radius-sm);
	margin-bottom: 12px;
	flex-wrap: wrap;
	font-size: 13px;
}

// Table actions cell
.aime-actions {
	display: flex;
	gap: 4px;
	align-items: center;

	.components-button.is-small {
		padding: 2px 6px;
		font-size: 12px;
	}
}

// Link button (looks like a link, no border)
.aime-link-btn {
	background: none;
	border: none;
	padding: 0;
	color: var(--aime-primary);
	font-weight: 600;
	cursor: pointer;
	font-size: inherit;

	&:hover {
		text-decoration: underline;
	}
}

// Empty message
// ── Empty state block ────────────────────────────────────
// Used by <EmptyState>. Replaces the bare "No data yet." paragraph in surfaces
// that would otherwise dead-end. Text-only by design: several of these render
// at once inside the dashboard chart grid, and an icon on each would turn the
// gaps into the page's structure.
//
// The action is a bordered ghost link, not a filled button. Five filled
// primaries firing at once would each be shouting the same volume as the
// single real setup CTA in the hero above them.
.aime-empty-block {
	text-align: center;
	padding: 32px 16px;
}

.aime-empty-block__title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--aime-text);
}

// 46ch, not 40: below about 45 characters the eye returns to the left edge
// often enough that short copy starts to feel like a list of fragments.
.aime-empty-block__desc {
	margin: 6px auto 0;
	max-width: 46ch;
	font-size: 13px;
	line-height: 1.5;
	color: var(--aime-text-light);
}

.aime-empty-block__action {
	display: inline-block;
	margin-top: 16px;
	padding: 6px 14px;
	border: 1px solid var(--aime-border);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	color: var(--aime-primary);
	background: transparent;
	transition: border-color 0.15s ease, background-color 0.15s ease;

	&:hover,
	&:focus {
		border-color: var(--aime-primary);
		background: rgba(var(--aime-primary-rgb, 27, 94, 32), 0.06);
		color: var(--aime-primary);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}
}

.aime-empty-msg {
	text-align: center;
	color: var(--aime-text-light);
	padding: 32px 16px;
	font-size: 14px;
}

// Chat message rendered content (admin conversation view)
.aime-message-content {
	word-break: break-word;

	.aime-msg-link {
		display: inline-block;
		margin: 2px 2px 2px 0;
		padding: 5px 12px;
		background: var(--aime-primary);
		color: #fff;
		border-radius: 6px;
		text-decoration: none;
		font-weight: 600;

		&:hover {
			background: var(--aime-primary-hover);
			color: #fff;
		}
	}

	ul {
		margin: 6px 0;
		padding-left: 20px;
	}

	strong {
		font-weight: 600;
	}

	code {
		background: rgba(0, 0, 0, 0.06);
		padding: 1px 4px;
		border-radius: 4px;
		font-size: 12px;
	}
}

// Muted text
.aime-muted {
	color: var(--aime-text-light);
	font-size: 12px;
}

// Tag / list pills
.aime-tag-pill,
.aime-list-pill {
	display: inline-block;
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 10px;
	font-weight: 500;
}

.aime-tag-pill {
	background: var(--aime-primary-light);
	color: var(--aime-primary);
}

.aime-list-pill {
	background: var(--aime-success-light);
	color: var(--aime-success);
}

.aime-pills-group {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

// Badge variants
.aime-badge-info {
	background: var(--aime-info-light);
	color: var(--aime-info);
}

.aime-badge-warning {
	background: var(--aime-warning-light);
	color: var(--aime-warning);
}

.aime-badge-error {
	background: var(--aime-error-light);
	color: var(--aime-error);
}

.aime-badge-default {
	background: var(--aime-bg);
	color: var(--aime-text-light);
}

// Form grid
.aime-form-grid {
	display: grid;
	gap: 16px;
	margin-bottom: 16px;
	align-items: start;

	// Top-aligned variant: rows with mixed help-text heights keep their
	// labels and inputs on the same line.
	&--top {
		align-items: start;
	}
}

.aime-automation-editor .aime-form-grid > div,
.aime-automation-editor .aime-card .aime-step-row .aime-step-row-delay> div,
.aime-seo-keyword-research .aime-settings-form .aime-form-grid> div {
	margin-bottom: 0 !important;
}

#aime-app .aime-chatbot-settings .aime-settings-form .components-base-control,
#aime-app .aime-seo-automation .aime-settings-form .components-base-control,
#aime-app .aime-settings-form .components-base-control {
    margin-bottom: 12px;
}
.aime-seo-topic-map .aime-form-grid{
	align-items: end;
}
.aime-form-grid-2 {
	grid-template-columns: 1fr 1fr;

	@media (max-width: 640px) {
		grid-template-columns: 1fr;
	}
}

.aime-form-grid-3 {
	grid-template-columns: 1fr 1fr 1fr;

	@media (max-width: 768px) {
		grid-template-columns: 1fr 1fr;
	}
	@media (max-width: 480px) {
		grid-template-columns: 1fr;
	}
}

// Detail grid (key-value pairs)
.aime-detail-grid {
	display: grid;
	gap: 0;
}

.aime-detail-row {
	display: flex;
	justify-content: space-between;
	padding: 10px 0;
	border-bottom: 1px solid var(--aime-border);
	font-size: 13px;

	> span:first-child {
		color: var(--aime-text-light);
		font-weight: 500;
		min-width: 120px;
	}

	> span:last-child {
		color: var(--aime-text);
		text-align: right;
	}
}

// Profile layout
.aime-profile-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;

	@media (max-width: 768px) {
		grid-template-columns: 1fr;
	}
}

// Pills section (non-editing view for Tags & Lists)
.aime-pills-section {
	display: flex;
	flex-direction: column;
	gap: 8px;

	.aime-pills {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}
}

// Notes
.aime-notes-add {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 20px;

	.components-button {
		align-self: flex-start;
	}
}

.aime-notes-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aime-note-item {
	padding: 12px 14px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius-sm);
	border-left: 3px solid var(--aime-primary);

	p {
		margin: 0 0 8px;
		font-size: 13px;
		line-height: 1.5;
	}
}

.aime-note-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

// Activity timeline
.aime-activity-timeline {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.aime-activity-item {
	display: flex;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--aime-border);
	align-items: flex-start;
	font-size: 13px;

	> div {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}
}

.aime-activity-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--aime-primary);
	margin-top: 6px;
	flex-shrink: 0;
}

// Subject row (inline with AI button)
.aime-subject-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;

	.components-base-control {
		flex: 1;
	}
}

// AI button
.aime-ai-btn {
	white-space: nowrap;
}

// AI suggestions list
.aime-ai-suggestions {
	list-style: none;
	padding: 0;
	margin: 8px 0 0;
	display: flex;
	flex-direction: column;
	gap: 4px;

	li {
		padding: 8px 12px;
		background: var(--aime-bg);
		border-radius: var(--aime-radius-sm);
		cursor: pointer;
		font-size: 13px;
		transition: background var(--aime-transition);

		&:hover {
			background: var(--aime-primary-light);
		}
	}
}

// AI result block
.aime-ai-result {
	margin-top: 12px;
	padding: 12px;
	background: var(--aime-bg);
	border-radius: var(--aime-radius-sm);
	border-left: 3px solid var(--aime-primary);
	font-size: 13px;
	line-height: 1.5;

	ul {
		margin: 8px 0;
		padding-left: 20px;
	}

	details {
		margin-top: 8px;
	}

	summary {
		cursor: pointer;
		color: var(--aime-primary);
		font-weight: 500;
	}
}

// Code block
.aime-code-block {
	background: #1e293b;
	color: #e2e8f0;
	padding: 12px;
	border-radius: var(--aime-radius-sm);
	font-family: monospace;
	font-size: 12px;
	overflow-x: auto;
	max-height: 300px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-all;
}

// Help text
.aime-help-text {
	font-size: 11px;
	color: var(--aime-text-light);
	margin-top: 4px;
}

// Progress bar
.aime-progress-bar-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.aime-progress-bar {
	flex: 1;
	height: 8px;
	background: var(--aime-border);
	border-radius: 4px;
	overflow: hidden;
}

.aime-progress-fill {
	height: 100%;
	background: var(--aime-primary);
	border-radius: 4px;
	transition: width 0.5s ease;
}

.aime-campaign-progress-meta,
.aime-campaign-countdown {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
}

.aime-campaign-progress-meta {
	margin-top: 12px;
	color: var(--aime-text-light);

	strong {
		color: var(--aime-text);
	}
}

.aime-schedule-edit {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	flex-wrap: wrap;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-countdown-rings {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
}

.aime-countdown-ring {
	position: relative;
	width: 86px;
	height: 86px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: var(--aime-text);

	svg {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		transform: rotate(-90deg);
	}
}

.aime-countdown-ring-bg,
.aime-countdown-ring-fg {
	fill: none;
	stroke-width: 2.5;
}

.aime-countdown-ring-bg {
	stroke: #d7d7d7;
}

.aime-countdown-ring-fg {
	stroke: var(--aime-countdown-color, var(--aime-primary));
	stroke-linecap: round;
	stroke-dasharray: 82 226;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08));
}

.aime-countdown-ring-label {
	position: relative;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	color: var(--aime-text-light);
	text-transform: uppercase;
	margin-top: 5px;
}

.aime-countdown-ring-value {
	position: relative;
	font-size: 22px;
	line-height: 1;
	font-weight: 700;
}

.aime-send-progress-panel {
	display: flex;
	flex-direction: column;
	gap: 22px;
}

.aime-send-progress-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;

	h3 {
		margin: 0;
		font-size: 20px;
		line-height: 1.3;
		color: var(--aime-text);
	}

	p {
		margin: 4px 0 0;
		color: var(--aime-text-light);
	}
}

.aime-send-status-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 12px;
	border-radius: 999px;
	background: #eaf3ff;
	color: #1768b8;
	font-weight: 700;

	&::before {
		content: '';
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: currentColor;
		box-shadow: 0 0 0 5px rgba(23, 104, 184, 0.14);
		animation: aime-send-pulse 1.15s ease-in-out infinite;
	}
}

.aime-send-progress-actions {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.aime-send-progress-track {
	position: relative;
	height: 34px;
	border-radius: 999px;
	background: #e9edf5;
	overflow: hidden;

	&.is-animating::after {
		content: '';
		position: absolute;
		inset: 0;
		background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
		transform: translateX(-100%);
		animation: aime-send-sweep 1.4s ease-in-out infinite;
	}

	span {
		position: absolute;
		left: 14px;
		top: 50%;
		transform: translateY(-50%);
		font-weight: 700;
		color: var(--aime-text);
	}
}

.aime-send-progress-fill {
	height: 100%;
	min-width: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--aime-primary), #22c55e);
	transition: width 0.5s ease;
}

@keyframes aime-send-pulse {
	0%, 100% {
		transform: scale(1);
		box-shadow: 0 0 0 5px rgba(23, 104, 184, 0.14);
	}

	50% {
		transform: scale(0.85);
		box-shadow: 0 0 0 9px rgba(23, 104, 184, 0.08);
	}
}

@keyframes aime-send-sweep {
	100% {
		transform: translateX(100%);
	}
}

.aime-send-stats-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(130px, 1fr));
	gap: 14px;
}

.aime-send-stat-card {
	min-height: 110px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 18px 14px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	box-shadow: var(--aime-shadow-sm);

	strong {
		font-size: 30px;
		line-height: 1;
		color: var(--aime-text);
	}

	span {
		font-weight: 700;
		color: var(--aime-text-light);
		text-align: center;
	}

	&.is-active {
		border-color: #60a5fa;
		background: #f4f9ff;
	}

	&.is-success {
		border-color: #86efac;
		background: #f3fbf6;
	}

	&.is-danger {
		border-color: #fecaca;
		background: #fff7f7;
	}
}

@media (max-width: 1200px) {
	.aime-send-stats-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 640px) {
	.aime-send-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

// Template grid
.aime-template-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
}

.aime-template-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	transition: box-shadow var(--aime-transition);

	&:hover {
		box-shadow: var(--aime-shadow-md);
	}
}

.aime-template-preview {
	height: 160px;
	overflow: hidden;
	cursor: pointer;
	background: var(--aime-bg);
	border-bottom: 1px solid var(--aime-border);
}

.aime-template-thumb {
	transform: scale(0.4);
	transform-origin: top left;
	width: 250%;
	pointer-events: none;
}

.aime-template-info {
	padding: 10px 12px;

	strong {
		display: block;
		font-size: 13px;
	}
}

.aime-template-actions {
	padding: 6px 12px 10px;
	display: flex;
	gap: 4px;
}

.aime-template-full-preview {
	max-width: 600px;
	margin: 0 auto;
	padding: 16px;
}

// Tag grid (used for tags, labels)
.aime-tag-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
}

.aime-tag-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-left: 4px solid var(--aime-primary);
	border-radius: var(--aime-radius-sm);
	padding: 12px 14px;
}

.aime-tag-card-header {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-tag-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.aime-tag-card-actions {
	margin-top: 8px;
	display: flex;
	gap: 4px;
}

// Import/Export grid
.aime-import-export-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 20px;

	@media (max-width: 768px) {
		grid-template-columns: 1fr;
	}
}

// AI tools grid
.aime-ai-tools-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 20px;
	margin-top: 20px;
}

// Modal actions
.aime-modal-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 16px;
}

// Automation visual builder
.aime-automation-editor {
	.aime-flow-canvas {
		position: relative;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius);
		overflow: hidden;
		background: var(--aime-bg);

		.react-flow {
			width: 100%;
			height: 100%;
		}
	}
}

.aime-auto-node {
	padding: 10px 14px;
	background: var(--aime-white);
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	display: flex;
	gap: 10px;
	align-items: center;
	min-width: 180px;
	cursor: pointer;
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow);
	}
}

.aime-auto-node-trigger {
	border-color: var(--aime-success);
	background: var(--aime-success-light);
}

.aime-auto-node-condition {
	border-color: var(--aime-warning);
	background: var(--aime-warning-light);
}

.aime-auto-node-icon {
	font-size: 20px;
	line-height: 1;
}

.aime-auto-node-body {
	display: flex;
	flex-direction: column;
	gap: 2px;

	strong {
		font-size: 13px;
	}
}

// Action palette (add step chips)
.aime-action-palette {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-action-chip {
	font-size: 12px !important;
}

// Step row (linear automation list)
.aime-step-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--aime-border);

	&:last-child {
		border-bottom: none;
	}
}

.aime-step-num {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--aime-primary);
	color: var(--aime-white);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 12px;
	flex-shrink: 0;
}

.aime-step-row-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.aime-step-row-delay {
	display: flex;
	align-items: center;
	gap: 6px;

	.components-base-control {
		margin-bottom: 0;
	}

	.components-text-control__input {
		width: 60px;
	}

	.components-select-control__input {
		width: 90px;
	}
}

// Campaign progress page
.aime-campaign-progress {
	.aime-kpi-grid {
		margin-top: 16px;
	}
}


// Subscriber email (monospace in table)
.aime-sub-email {
	font-family: monospace;
	font-size: 12px;
	color: var(--aime-text-light);
}

// Contact cell — name + email stacked
.aime-contact-cell {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	text-align: left;
}

.aime-contact-name {
	font-size: 13px;
	font-weight: 600;
	color: var(--aime-primary);
	text-decoration: none;
	cursor: pointer;

	&:hover {
		text-decoration: underline;
	}
}

.aime-clickable-row {
	cursor: pointer;

	&:hover {
		.aime-contact-name,
		.aime-link-btn,
		strong {
			color: var(--aime-primary);
			text-decoration: underline;
		}
	}
}

// Responsive table wrapper
@media (max-width: 768px) {
	// An unwrapped table becomes its own scroller. One already inside
	// .aime-table-wrap must not — two nested scrollers on the same axis trap
	// the gesture in the inner one and the outer never moves.
	.aime-table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.aime-table-wrap > .aime-table {
		display: table;
		overflow: visible;
	}

	// Tighter gutters: on a 360px screen the 14px side padding costs a column.
	.aime-table th,
	.aime-table td {
		padding: 10px;
	}

	.aime-kpi-grid-4 {
		grid-template-columns: repeat(2, 1fr);
	}

	.aime-kpi-grid-5 {
		grid-template-columns: repeat(2, 1fr);
	}

	.aime-charts-grid {
		grid-template-columns: 1fr;
	}

	.aime-module-cards-grid {
		grid-template-columns: 1fr;
	}
}

// ============================================
// PREMIUM ADD CONTACT MODAL
// ============================================
.aime-premium-modal-overlay {
	position: fixed;
	inset: 0;
	background: var(--aime-overlay);
	backdrop-filter: blur(4px);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	animation: aime-overlay-in 0.18s ease-out;
}

// The dialog is the only thing in this product that interrupts, so it is the
// one place motion is authored: the page dims, then the panel arrives from
// 10px below at 98% and decelerates into place. Nothing else in the plugin
// moves this far or this long.
@keyframes aime-overlay-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes aime-modal-in {
	from { opacity: 0; transform: translateY(10px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aime-premium-modal {
	display: flex;
	flex-direction: column;
	background: var(--aime-white);
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-lg);
	box-shadow: var(--aime-shadow-xl);
	width: 540px;
	max-width: 94vw;
	max-height: 90vh;
	overflow-y: auto;
	animation: aime-modal-in var(--aime-enter) both;
}

.aime-premium-modal-header {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-shrink: 0;
	padding: 20px 24px;
	background: var(--aime-white);
	border-bottom: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-lg) var(--aime-radius-lg) 0 0;

	h3 {
		margin: 0;
		font-size: 18px;
		font-weight: 700;
		color: var(--aime-text);
		display: flex;
		align-items: center;
		gap: 10px;
	}
}

.aime-premium-modal-icon {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--aime-gradient);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;

	svg {
		fill: white;
		width: 20px;
		height: 20px;
	}
}

// The dismiss control. A round 50px-radius button so it reads as an object to
// hit rather than a glyph floating in the header, and the `×` is centred by
// flex + line-height instead of the padding nudge that used to fake it.
.aime-modal-close,
.aime-premium-modal-close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	border-radius: var(--aime-radius-pill);
	border: 1px solid var(--aime-border);
	background: var(--aime-white);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--aime-text-light);
	font-size: 20px;
	line-height: 1;
	// Colour and the 1px press only. A close button that grows on hover moves
	// the target the visitor is already aiming at.
	transition: background-color var(--aime-transition-fast),
		border-color var(--aime-transition-fast), color var(--aime-transition-fast),
		transform var(--aime-transition-fast);

	svg {
		fill: currentColor;
	}

	&:hover:not(:disabled) {
		background: var(--aime-error-light);
		border-color: var(--aime-error);
		color: var(--aime-error);
	}

	&:active:not(:disabled) {
		transform: scale(0.92);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}

	&:disabled {
		opacity: 0.45;
		cursor: not-allowed;
	}
}

.aime-premium-modal-body {
	padding: 24px;

	.aime-csv-options-grid {
		display: flex;
		flex-flow: row wrap;
		gap: 20px;
		margin: 10px 0;
	}
}

.aime-premium-form-group {
	margin-bottom: 20px;

	.aime-field-hint {
		display: block;
		margin: 4px 0 0;
		color: var(--aime-text-muted);
		font-size: 12px;
		font-style: italic;
	}
}

.aime-premium-form-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--aime-text-light);
	margin-bottom: 6px;
}

.aime-premium-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.aime-premium-input {
	width: 100%;
	height: var(--aime-control-h);
	padding: 0 12px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	font-size: 13.5px;
	color: var(--aime-text);
	background: var(--aime-white);
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition),
		background-color var(--aime-transition);
	outline: none;
	box-sizing: border-box;

	&::placeholder {
		color: var(--aime-text-muted);
		opacity: 1;
	}

	&:hover:not(:disabled):not([readonly]) {
		border-color: var(--aime-text-muted);
	}

	&:focus {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-focus-ring);
	}

	&:disabled,
	&[readonly] {
		background: var(--aime-bg);
		color: var(--aime-text-light);
		border-color: var(--aime-border-light);
		cursor: not-allowed;
	}

	&[aria-invalid="true"],
	&.is-invalid {
		border-color: var(--aime-error);

		&:focus {
			box-shadow: var(--aime-focus-ring-error);
		}
	}
}

.aime-premium-select {
	width: 100%;
	height: var(--aime-control-h);
	padding: 0 30px 0 12px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	font-size: 13.5px;
	color: var(--aime-text);
	background-color: var(--aime-white);
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition),
		background-color var(--aime-transition);
	outline: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%235f7562'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	box-sizing: border-box;
	cursor: pointer;

	&:hover:not(:disabled) {
		border-color: var(--aime-text-muted);
	}

	&:focus {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-focus-ring);
	}

	&:disabled {
		background-color: var(--aime-bg);
		color: var(--aime-text-light);
		border-color: var(--aime-border-light);
		cursor: not-allowed;
	}
}

.aime-premium-textarea {
	width: 100%;
	min-height: 88px;
	padding: 9px 12px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	font-size: 13.5px;
	font-family: inherit;
	line-height: 1.5;
	color: var(--aime-text);
	background: var(--aime-white);
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition),
		background-color var(--aime-transition);
	outline: none;
	resize: vertical;
	box-sizing: border-box;

	&::placeholder {
		color: var(--aime-text-muted);
		opacity: 1;
	}

	&:hover:not(:disabled):not([readonly]) {
		border-color: var(--aime-text-muted);
	}

	&:focus {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-focus-ring);
	}

	&:disabled,
	&[readonly] {
		background: var(--aime-bg);
		color: var(--aime-text-light);
		border-color: var(--aime-border-light);
		cursor: not-allowed;
	}

	&[aria-invalid="true"],
	&.is-invalid {
		border-color: var(--aime-error);

		&:focus {
			box-shadow: var(--aime-focus-ring-error);
		}
	}
}

// Container, token, and remove-button styling now lives in the shared token
// field block further down. This variant only drops the label, because the
// surrounding form already supplies one.
.aime-premium-token-field {
	.components-base-control__label {
		display: none !important;
	}
}

/* Toggle buttons — multiselect for lists/tags */
.aime-premium-fieldset-label {
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	padding: 12px 14px;
	background: var(--aime-white);
	margin: 0;
}

.aime-premium-fieldset-legend {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--aime-text-light);
	padding: 0 4px;
}

.aime-toggle-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.aime-toggle-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 14px;
	border: 1.5px solid var(--aime-border);
	border-radius: 20px;
	background: var(--aime-white);
	color: var(--aime-text);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all var(--aime-transition);
	line-height: 1.3;

	&:hover {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
		background: var(--aime-primary-light);
	}

	&.is-selected {
		border-color: var(--aime-primary);
		background: var(--aime-primary);
		color: #fff;

		&:hover {
			background: var(--aime-primary-dark, #14471a);
			color: #fff;
		}
	}
}

.aime-toggle-btn-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.aime-premium-modal-footer {
	position: sticky;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	flex-shrink: 0;
	padding: 16px 24px;
	border-top: 1px solid var(--aime-border-light);
	background: var(--aime-bg);
	border-radius: 0 0 var(--aime-radius-lg) var(--aime-radius-lg);
}

.aime-btn-cancel {
	padding: 10px 20px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-white);
	color: var(--aime-text);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all var(--aime-transition);

	&:hover {
		background: var(--aime-bg);
		border-color: var(--aime-text-light);
	}
}

// .aime-btn-primary / .aime-btn-secondary are defined once, further down in
// the shared button system. The duplicates that used to sit here carried a
// hardcoded green shadow that ignored the per-module accent.

.aime-btn-danger {
	padding: 10px 24px;
	border: none;
	border-radius: var(--aime-radius-sm);
	background: linear-gradient(135deg, #c62828, #e53935);
	color: white;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--aime-transition);
	box-shadow: 0 2px 8px rgba(198, 40, 40, 0.25);

	&:hover {
		box-shadow: 0 4px 16px rgba(198, 40, 40, 0.35);
		transform: translateY(-1px);
	}

	&:disabled {
		opacity: 0.5;
		cursor: not-allowed;
		transform: none;
		box-shadow: none;
	}
}

.aime-premium-form-help {
	display: block;
	font-size: 12px;
	color: var(--aime-text-muted);
	margin-top: 4px;
	line-height: 1.4;
}

// ============================================
// PREMIUM CAMPAIGN EDITOR
// ============================================
.aime-campaign-editor {
	.aime-page-header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 24px;

		h2 {
			font-size: 22px;
			font-weight: 700;
			color: var(--aime-text);
			margin: 4px 0 0;
		}
	}

	.aime-header-actions {
		display: flex;
		gap: 10px;
	}

	// `.aime-step-content` is shared with the workflow builder, where it is a
	// step body indented 36px under a numbered bullet. The wizard reuses the
	// class for the panel under the stepper and inherited that indent, so the
	// panel sat 36px right of the stepper band and stopped short of its right
	// edge — two boxes that read as one control, misaligned. The panel is the
	// stepper's continuation, so it takes the stepper's exact box.
	.aime-step-content {
		margin-left: 0;
		padding: 24px;
		border-radius: var(--aime-radius);
		gap: 20px;
	}
}

.aime-editor-compose {
	display: flex;
	flex-direction: column;
	gap: 20px;

	// Constrain number inputs (e.g. throttle) so they don't stretch full-width
	input[type="number"].aime-premium-input {
		max-width: 200px;
	}

	&--narrow {
		max-width: 780px;
		margin-left: auto;
		margin-right: auto;
	}
}

// Checkbox row for toggleable sections (UTM etc.)
.aime-checkbox-row {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);

	input[type="checkbox"] {
		width: 18px;
		height: 18px;
		accent-color: var(--aime-primary);
		cursor: pointer;
		margin: 0;
	}
}

.aime-checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 500;
	color: var(--aime-text);
	cursor: pointer;
	user-select: none;

	input[type="checkbox"] {
		width: 16px;
		height: 16px;
		accent-color: var(--aime-primary);
		cursor: pointer;
		margin: 0;
	}
}

.aime-import-validation-options {
	display: grid;
	gap: 8px;
	margin-top: 16px;
	padding: 14px;
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-bg);

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-import-skip-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin: -8px 0 16px;
	font-size: 12px;
	color: var(--aime-text-light);

	strong {
		color: var(--aime-text);
	}

	span {
		padding: 4px 8px;
		border-radius: 999px;
		background: var(--aime-white);
		border: 1px solid var(--aime-border-light);
	}
}

.aime-utm-fields {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border);
}

// Subject row with AI btn
.aime-subject-row {
	display: flex;
	gap: 10px;
	align-items: flex-end;

	.components-base-control {
		flex: 1;
	}
}

.aime-ai-btn {
	white-space: nowrap;
}

.aime-ai-suggestions {
	padding: 14px;
	background: var(--aime-bg-subtle);
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	margin-top: 8px;

	h4 {
		margin: 0 0 10px;
		font-size: 13px;
		color: var(--aime-text-light);
	}
}

// Email editor mode tabs
.aime-editor-mode-tabs {
	display: flex;
	gap: 0;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	overflow: hidden;
	margin-bottom: 16px;
	width: fit-content;
}

.aime-editor-mode-tab {
	padding: 8px 20px;
	font-size: 13px;
	font-weight: 500;
	border: none;
	background: var(--aime-white);
	color: var(--aime-text-light);
	cursor: pointer;
	transition: all var(--aime-transition);
	border-right: 1px solid var(--aime-border);
	display: flex;
	align-items: center;
	gap: 6px;

	&:last-child {
		border-right: none;
	}

	&:hover {
		background: var(--aime-bg);
		color: var(--aime-text);
	}

	&.active {
		background: var(--aime-primary);
		color: white;
	}
}

// Rich text toolbar
.aime-rich-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	padding: 8px 12px;
	background: var(--aime-bg);
	border: 1.5px solid var(--aime-border);
	border-bottom: none;
	border-radius: var(--aime-radius-sm) var(--aime-radius-sm) 0 0;
}

.aime-toolbar-btn {
	width: 34px;
	height: 34px;
	border: none;
	background: transparent;
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--aime-text);
	font-size: 14px;
	transition: all var(--aime-transition);

	&:hover {
		background: var(--aime-white);
		color: var(--aime-primary);
	}

	&.active {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
	}
}

.aime-toolbar-divider {
	width: 1px;
	height: 24px;
	background: var(--aime-border);
	margin: 5px 6px;
}

.aime-visual-editor {
	border: 1.5px solid var(--aime-border);
	border-top: none;
	border-radius: 0 0 var(--aime-radius-sm) var(--aime-radius-sm);
	min-height: 400px;
	padding: 20px;
	background: var(--aime-white);
	outline: none;
	font-size: 14px;
	line-height: 1.7;
	color: var(--aime-text);

	&:focus {
		box-shadow: inset 0 0 0 1px var(--aime-primary);
	}

	h1, h2, h3, h4 {
		color: var(--aime-text);
		margin: 16px 0 8px;
	}

	p {
		margin: 0 0 12px;
	}

	a {
		color: var(--aime-primary);
	}

	img {
		max-width: 100%;
		height: auto;
		border-radius: var(--aime-radius-sm);
	}

	blockquote {
		border-left: 3px solid var(--aime-primary);
		margin: 12px 0;
		padding: 8px 16px;
		background: var(--aime-bg);
		border-radius: 0 var(--aime-radius-sm) var(--aime-radius-sm) 0;
	}

	ul, ol {
		padding-left: 24px;
		margin: 8px 0;
	}

	table {
		width: 100%;
		border-collapse: collapse;

		td, th {
			border: 1px solid var(--aime-border);
			padding: 8px 12px;
		}
	}
}

.aime-html-editor {
	width: 100%;
	min-height: 400px;
	padding: 16px;
	font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
	font-size: 13px;
	line-height: 1.6;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	background: #1e1e2e;
	color: #cdd6f4;
	resize: vertical;
	outline: none;
	box-sizing: border-box;
	tab-size: 2;

	&:focus {
		border-color: var(--aime-primary);
		box-shadow: 0 0 0 3px rgba(var(--aime-primary-rgb), 0.1);
	}
}

.aime-merge-tags-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 12px 0;
	align-items: center;
}

.aime-merge-tag-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--aime-text-light);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.aime-merge-tag-chip {
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 500;
	border: 1px solid var(--aime-border);
	border-radius: 20px;
	background: var(--aime-white);
	color: var(--aime-text);
	cursor: pointer;
	transition: all var(--aime-transition);
	font-family: 'SF Mono', 'Consolas', monospace;

	&:hover {
		background: var(--aime-primary-light);
		border-color: var(--aime-primary);
		color: var(--aime-primary);
	}
}

// ============================================
// AI EMAIL WRITER PANEL
// ============================================
.aime-ai-writer-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 14px 16px;
	background: linear-gradient(135deg, #f0f0ff 0%, #f7f0ff 100%);
	border: none;
	border-radius: var(--aime-radius);
	cursor: pointer;
	transition: all var(--aime-transition);
	text-align: left;

	&:hover {
		background: linear-gradient(135deg, #e6e6ff 0%, #f0e6ff 100%);
	}
}

.aime-ai-writer-icon {
	font-size: 20px;
	flex-shrink: 0;
}

.aime-ai-writer-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
	white-space: nowrap;
}

.aime-ai-writer-desc {
	font-size: 12px;
	color: var(--aime-text-light);
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aime-ai-writer-arrow {
	font-size: 16px;
	color: var(--aime-text-light);
	transition: transform 0.2s ease;
	flex-shrink: 0;

	&.is-open {
		transform: rotate(180deg);
	}
}

.aime-ai-writer-body {
	padding: 16px;
	border-top: 1px solid var(--aime-border);

	.aime-premium-form-row {
		display: flex;
		gap: 12px;
		align-items: flex-end;
	}

	.aime-premium-input {
		resize: vertical;
		min-height: 60px;
	}

	.aime-muted {
		color: var(--aime-text-light);
	}
}

// ============================================
// STEPPER (multi-step wizard)
// ============================================
.aime-stepper {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: 0;
	padding: 20px 24px;
	margin-bottom: 8px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
}

.aime-stepper-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px 32px;
	position: relative;
	flex: 1;
	max-width: 200px;

	&:not(:last-child)::after {
		content: '';
		position: absolute;
		top: 18px;
		left: calc(50% + 22px);
		width: calc(100% - 44px);
		height: 2px;
		background: var(--aime-border);
		z-index: 0;
	}

	&.is-done:not(:last-child)::after {
		background: var(--aime-primary);
	}

	.aime-stepper-circle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		border-radius: 50%;
		font-size: 14px;
		font-weight: 700;
		border: 2px solid var(--aime-border);
		background: var(--aime-white);
		color: var(--aime-text-light);
		transition: all var(--aime-transition);
		position: relative;
		z-index: 1;
	}

	.aime-stepper-label {
		font-size: 12px;
		font-weight: 600;
		color: var(--aime-text-light);
		transition: color var(--aime-transition);
		white-space: nowrap;
	}

	&.is-active {
		.aime-stepper-circle {
			border-color: var(--aime-primary);
			background: var(--aime-primary);
			color: var(--aime-white);
			box-shadow: 0 0 0 4px var(--aime-primary-light);
		}
		.aime-stepper-label {
			color: var(--aime-primary);
		}
	}

	&.is-done {
		.aime-stepper-circle {
			border-color: var(--aime-primary);
			background: var(--aime-primary-light);
			color: var(--aime-primary);
		}
		.aime-stepper-label {
			color: var(--aime-text);
		}
	}

	&:hover:not(.is-active) {
		.aime-stepper-circle {
			border-color: var(--aime-primary);
		}
		.aime-stepper-label {
			color: var(--aime-primary);
		}
	}
}

// ============================================
// STEP NAV (bottom navigation)
// ============================================
.aime-step-nav {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 0;
	margin-top: 8px;
}

// ============================================
// SHARED BUTTON SYSTEM
// One rhythm for every action in the plugin: 36px tall, 8px radius, the
// module accent for intent, a 1px press on activation. Colour comes from the
// accent tokens so a button in SEO is amber and the same button in Email is
// crimson without either being written twice.
// ============================================
.aime-btn-primary,
.aime-btn-secondary,
.aime-btn-ghost {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 36px;
	padding: 8px 18px;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.2;
	border-radius: var(--aime-radius-sm);
	cursor: pointer;
	transition: background var(--aime-transition), color var(--aime-transition),
		border-color var(--aime-transition), box-shadow var(--aime-transition),
		transform 0.08s ease;
	border: 1px solid transparent;
	white-space: nowrap;

	svg {
		fill: currentColor;
		flex-shrink: 0;
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}

	&:active:not(:disabled) {
		transform: translateY(1px);
	}

	&:disabled,
	&[aria-disabled='true'] {
		opacity: 0.5;
		cursor: not-allowed;
		box-shadow: none;
		transform: none;
	}
}

.aime-btn-primary {
	background: var(--aime-primary);
	color: var(--aime-white);
	box-shadow: 0 2px 5px rgba(var(--aime-primary-rgb), 0.22);

	&:hover:not(:disabled) {
		background: var(--aime-primary-hover);
		box-shadow: 0 5px 14px rgba(var(--aime-primary-rgb), 0.28);
	}
}

.aime-btn-secondary {
	background: var(--aime-white);
	color: var(--aime-text);
	border-color: var(--aime-border);

	&:hover:not(:disabled) {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
		background: var(--aime-primary-light);
	}
}

// Ghost: toolbar-weight actions that should not compete with the primary.
.aime-btn-ghost {
	background: transparent;
	color: var(--aime-text-light);

	&:hover:not(:disabled) {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
	}
}

// ============================================
// AI OPTIMIZE BUTTON + INPUT WITH ACTION
// ============================================
.aime-input-with-action {
	display: flex;
	gap: 8px;
	align-items: stretch;

	.aime-premium-input {
		flex: 1;
	}
}

.aime-btn-ai {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	border: 1px solid #e9d8fd;
	border-radius: var(--aime-radius-sm);
	background: linear-gradient(135deg, #f3e8ff, #ede9fe);
	color: #7c3aed;
	cursor: pointer;
	transition: all var(--aime-transition);
	white-space: nowrap;

	&:hover:not(:disabled) {
		background: linear-gradient(135deg, #ede9fe, #ddd6fe);
		border-color: #c4b5fd;
		box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
	}

	&:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}
}

.aime-ai-suggestion-chip {
	display: inline-block;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	border: 1px solid #e9d8fd;
	border-radius: 20px;
	background: #faf5ff;
	color: #7c3aed;
	cursor: pointer;
	margin: 0 6px 6px 0;
	transition: all var(--aime-transition);

	&:hover {
		background: #ede9fe;
		border-color: #c4b5fd;
	}
}

// ============================================
// RECIPIENT TYPE TOGGLE
// ============================================
.aime-recipient-type-toggle {
	display: flex;
	gap: 8px;
}

.aime-selected-summary {
	padding: 12px 16px;
	background: var(--aime-primary-light);
	border-radius: var(--aime-radius-sm);
	font-size: 13px;
	color: var(--aime-primary);
	margin-top: 8px;
}

/* ── Contact Count Bar ── */
.aime-contact-count-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 500;
	color: var(--aime-text);
}

.aime-contact-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	padding: 4px 14px;
	background: var(--aime-primary, #1B5E20);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	border-radius: 6px;
}

/* ── Audience Range Slider ── */
.aime-range-slider-wrap {
	position: relative;
	height: 32px;
	margin: 8px 0;
}

.aime-range-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 32px;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	pointer-events: none;
	z-index: 2;

	&::-webkit-slider-runnable-track {
		height: 6px;
		background: #e0e0e0;
		border-radius: 3px;
	}

	&::-webkit-slider-thumb {
		-webkit-appearance: none;
		width: 20px;
		height: 20px;
		border-radius: 50%;
		background: var(--aime-primary, #1B5E20);
		border: 3px solid #fff;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
		cursor: pointer;
		pointer-events: auto;
		margin-top: -7px;
		position: relative;
		z-index: 3;
	}

	&::-moz-range-track {
		height: 6px;
		background: transparent;
		border: none;
	}

	&::-moz-range-thumb {
		width: 20px;
		height: 20px;
		border-radius: 50%;
		background: var(--aime-primary, #1B5E20);
		border: 3px solid #fff;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
		cursor: pointer;
		pointer-events: auto;
	}
}

.aime-range-start::-webkit-slider-runnable-track {
	background: #e0e0e0;
}

.aime-range-end::-webkit-slider-runnable-track {
	background: transparent;
}

.aime-range-track-fill {
	position: absolute;
	top: 13px;
	height: 6px;
	background: var(--aime-primary, #1B5E20);
	border-radius: 3px;
	pointer-events: none;
	z-index: 1;
}

.aime-range-labels {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: var(--aime-text-muted, #888);
	margin-top: 4px;
	padding: 0 2px;
}

.aime-range-selection-info {
	display: flex;
	gap: 24px;
	flex-wrap: wrap;
	margin-top: 12px;
	font-size: 13px;
	color: var(--aime-text);

	strong {
		color: var(--aime-primary, #1B5E20);
	}
}

// ============================================
// REVIEW SECTION
// ============================================
.aime-review-grid {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.aime-review-item {
	display: flex;
	align-items: flex-start;
	padding: 14px 0;
	border-bottom: 1px solid var(--aime-border);

	&:last-child {
		border-bottom: none;
	}
}

.aime-review-label {
	width: 160px;
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--aime-text-light);
}

.aime-review-value {
	flex: 1;
	font-size: 14px;
	color: var(--aime-text);
}

.aime-review-actions {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
}

/* ── Review warnings ── */
.aime-review-warnings {
	background: #fff8f0;
	border: 1px solid #f59e0b;
	border-left: 4px solid #f59e0b;
	border-radius: 8px;
	padding: 16px 20px;
	margin-bottom: 16px;
}
.aime-review-warnings-header {
	font-weight: 600;
	font-size: 14px;
	color: #92400e;
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}
.aime-review-warnings-list {
	margin: 0;
	padding: 0 0 0 20px;
	li {
		color: #78350f;
		font-size: 13px;
		line-height: 1.7;
	}
}

/* ── A/B Testing ── */
.aime-ab-test-panel {
	background: #f0f4ff;
	border: 1px solid #c7d2fe;
	border-radius: 8px;
	padding: 16px;
	margin-top: 8px;
}
.aime-ab-variant-row {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.aime-ab-variant {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}
.aime-ab-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	min-width: 32px;
	border-radius: 50%;
	font-weight: 700;
	font-size: 14px;
	color: #fff;
	margin-top: 24px;
}
.aime-ab-label--a { background: #4f46e5; }
.aime-ab-label--b { background: #f59e0b; }
.aime-ab-variant-field {
	flex: 1;
}

// Automation template picker
.aime-automation-templates {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.aime-automation-tpl-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	background: var(--aime-bg);
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	cursor: pointer;
	text-align: left;
	transition: border-color .15s, box-shadow .15s;
	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 0 0 2px rgba(var(--aime-primary-rgb), .08);
	}
}
.aime-automation-tpl-icon {
	font-size: 26px;
	line-height: 1;
	flex-shrink: 0;
}
.aime-automation-tpl-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
	strong {
		font-size: 14px;
		color: var(--aime-text);
	}
	span {
		font-size: 12px;
		color: var(--aime-text-light);
	}
}
.aime-automation-tpl-steps {
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 600;
	color: var(--aime-text-muted);
	background: var(--aime-bg-subtle);
	padding: 3px 8px;
	border-radius: 10px;
}

.aime-badge {
	display: inline-block;
	padding: 3px 10px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 12px;
}

.aime-badge-success {
	background: #ecfdf5;
	color: #059669;
}

.aime-badge-warning {
	background: #fffbeb;
	color: #d97706;
}

// ============================================
// EMAIL PREVIEW FRAME
// ============================================
.aime-email-preview-frame {
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	overflow: hidden;
	background: #f5f5f5;
}

.aime-email-preview-bar {
	background: var(--aime-bg);
	padding: 10px 16px;
	border-bottom: 1px solid var(--aime-border);
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-email-preview-body {
	padding: 24px;
	background: white;
	max-width: 600px;
	margin: 0 auto;
	min-height: 300px;
}

.aime-editor-preview-frame {
	width: 100%;
	min-height: 500px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-white);
}

// ============================================
// TEMPLATE IMPORT ACCORDION (Campaign Editor)
// ============================================
.aime-template-accordion {
	margin-bottom: 16px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
}

.aime-template-accordion-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 14px 16px;
	background: linear-gradient(135deg, #f0f8f0 0%, #f7faf7 100%);
	border: none;
	cursor: pointer;
	transition: all var(--aime-transition);
	text-align: left;

	&:hover {
		background: linear-gradient(135deg, #e6f2e6 0%, #f0f5f0 100%);
	}
}

.aime-template-accordion-icon {
	font-size: 20px;
	flex-shrink: 0;
}

.aime-template-accordion-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
	white-space: nowrap;
}

.aime-template-accordion-desc {
	font-size: 12px;
	color: var(--aime-text-light);
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aime-template-accordion-arrow {
	font-size: 16px;
	color: var(--aime-text-light);
	transition: transform 0.2s ease;
	flex-shrink: 0;

	&.is-open {
		transform: rotate(180deg);
	}
}

.aime-template-accordion-body {
	padding: 16px;
	border-top: 1px solid var(--aime-border);
	background: #fff;
}

// ============================================
// TEMPLATE PICKER CARDS (Campaign Editor)
// ============================================
.aime-template-picker-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 12px;
	margin-bottom: 0;
}

.aime-template-picker-card {
	position: relative;
	background: var(--aime-white);
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	cursor: pointer;
	transition: all var(--aime-transition);
	text-align: left;
	padding: 0;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: 0 4px 12px rgba(27, 94, 32, 0.12);
		transform: translateY(-2px);
	}

	&.is-active {
		border-color: var(--aime-primary);
		box-shadow: 0 0 0 2px rgba(27, 94, 32, 0.2);
	}
}

.aime-template-picker-thumb {
	height: 110px;
	background: #f8faf8;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-bottom: 1px solid var(--aime-border-light, #eee);

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}

	svg {
		width: 100%;
		height: 100%;
	}
}

.aime-template-picker-name {
	padding: 8px 10px;
	font-size: 12px;
	font-weight: 600;
	color: var(--aime-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aime-template-picker-check {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--aime-primary);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

// ============================================
// VALIDATION ERRORS
// ============================================
.aime-field-error {
	color: #d32f2f;
	font-size: 13px;
	font-weight: 500;
	margin: 6px 0 0;
	display: flex;
	align-items: center;
	gap: 4px;
	word-break: break-word;

	&::before {
		content: '⚠';
		font-size: 14px;
	}
}

.aime-input-error {
	border-color: #d32f2f !important;
	box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.12) !important;
}

// ============================================
// EXCLUDE SECTION
// ============================================
.aime-exclude-section {
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);
	margin-top: 12px;
}

.aime-toggle-btn--exclude.is-selected {
	background: #ffebee !important;
	border-color: #ef5350 !important;
	color: #c62828 !important;
}

.aime-selected-summary--exclude {
	color: #c62828;
	background: #ffebee;
	border: 1px solid #ef9a9a;
	padding: 8px 14px;
	border-radius: var(--aime-radius-sm);
	font-size: 13px;
	margin-top: 8px;
}

.aime-tag-pill--exclude {
	background: #ffebee !important;
	color: #c62828 !important;
	border: 1px solid #ef9a9a !important;
}

.aime-article-preview .aime-preview-meta-bar {
	display: flex;
	flex-flow: row wrap;
	gap: 10px;
	align-items: center;
	margin: 10px 0;
}

// ============================================
// PREVIEW EDIT BAR
// ============================================
.aime-preview-edit-bar {
	display: flex;
	justify-content: flex-end;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--aime-border);
}

// ============================================
// CUSTOM MODALS (Send Test, Schedule)
// ============================================
.aime-custom-modal {
	.components-modal__content {
		padding: 24px;
	}

	.aime-premium-form-group {
		margin-bottom: 16px;
	}

	.aime-premium-form-label {
		display: block;
		margin-bottom: 6px;
		font-size: 13px;
		font-weight: 600;
		color: var(--aime-text);
	}

	.aime-premium-input {
		width: 100%;
		padding: 10px 12px;
		border: 1.5px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		font-size: 14px;
		box-sizing: border-box;
		transition: border-color var(--aime-transition),
			box-shadow var(--aime-transition);

		&:focus {
			outline: none;
			border-color: var(--aime-primary);
			// Was a hardcoded forest-green ring, which stayed green inside the
			// crimson and amber rooms. The token follows the module accent.
			box-shadow: var(--aime-focus-ring);
		}
	}

	.aime-modal-actions {
		display: flex;
		gap: 10px;
		justify-content: flex-end;
		margin-top: 20px;
	}
}

// ============================================
// TEMPLATE LIBRARY WITH SVG CARDS
// ============================================
.aime-template-library {
	.aime-page-header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 24px;

		h2 {
			font-size: 22px;
			font-weight: 700;
			color: var(--aime-text);
			margin: 0;
		}
	}
}

.aime-template-filters {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.aime-template-search {
	flex: 1;
	min-width: 200px;

	.components-search-control {
		width: 100%;
	}
}

.aime-template-category-pills {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.aime-category-pill {
	padding: 6px 16px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	border: 1.5px solid var(--aime-border);
	background: var(--aime-white);
	color: var(--aime-text-light);
	cursor: pointer;
	transition: all var(--aime-transition);

	&:hover {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
	}

	&.active {
		background: var(--aime-primary);
		color: white;
		border-color: var(--aime-primary);
	}
}

.aime-template-svg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 20px;
}

.aime-template-svg-card {
	background: var(--aime-white);
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius);
	overflow: hidden;
	transition: all var(--aime-transition-slow);
	cursor: pointer;
	position: relative;

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow-lg);
		transform: translateY(-4px);

		.aime-svg-card-overlay {
			opacity: 1;
		}
	}
}

.aime-svg-card-preview {
	height: 200px;
	background: #f8faf8;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	border-bottom: 1px solid var(--aime-border-light);

	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}

	svg {
		width: 120px;
		height: 120px;
		fill: var(--aime-primary);
		opacity: 0.15;
	}
}

.aime-campaign-report-grid {
	display: grid;
	grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr) minmax(280px, 1fr);
	gap: 20px;
	margin-bottom: 24px;
}

.aime-campaign-kpi-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.aime-kpi-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	transition: transform 0.15s ease, box-shadow 0.15s ease;

	&:hover {
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
	}

	.aime-kpi-label {
		font-size: 12px;
		font-weight: 700;
		color: var(--aime-text-light);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	.aime-kpi-value {
		font-size: 26px;
		font-weight: 800;
		color: var(--aime-text);
		line-height: 1.15;
	}

	.aime-kpi-subtext {
		font-size: 12px;
		color: var(--aime-text-light);
		display: flex;
		align-items: center;
		gap: 6px;
	}
}

.aime-campaign-dual-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
	gap: 20px;
	margin-bottom: 24px;
}

.aime-locations-list {
	min-height: 240px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 14px;
	padding: 12px 4px;
}

.aime-location-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.aime-location-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.aime-location-country {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.aime-location-flag {
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
}

.aime-location-name {
	font-size: 13px;
	font-weight: 700;
	color: var(--aime-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aime-location-stats {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.aime-location-opens {
	font-size: 14px;
	font-weight: 700;
	color: var(--aime-text);
}

.aime-location-pct {
	font-size: 12px;
	font-weight: 600;
	color: var(--aime-text-light);
	min-width: 44px;
	text-align: right;
}

.aime-location-bar {
	height: 8px;
	border-radius: 999px;
	background: #edf2f7;
	overflow: hidden;

	span {
		display: block;
		height: 100%;
		border-radius: inherit;
		background: #3858e9;
		transition: width 0.3s ease;
	}
}

.aime-report-metric-list {
	display: flex;
	flex-direction: column;
}

.aime-report-metric-list > div {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid var(--aime-border-light);
}

.aime-report-metric-list > div:last-child {
	border-bottom: 0;
}

.aime-report-metric-list span {
	color: var(--aime-text-light);
	font-weight: 600;
}

.aime-report-metric-list strong {
	color: var(--aime-text);
	font-size: 16px;
}

.aime-report-empty {
	min-height: 240px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--aime-text-light);
	padding: 24px;

	strong {
		color: var(--aime-text);
		font-size: 16px;
	}

	p {
		max-width: 320px;
		margin: 8px 0 0;
		line-height: 1.5;
	}
}

.aime-link-activity-list {
	min-height: 240px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 16px;
	padding: 18px 4px;
}

.aime-link-activity-item {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

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

.aime-link-activity-rank {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 28px;
	border-radius: 6px;
	background: var(--aime-primary-light);
	color: var(--aime-primary);
	font-size: 12px;
	font-weight: 800;
}

.aime-link-activity-url {
	min-width: 0;
	color: var(--aime-text);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.35;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-decoration: none;

	&:hover {
		color: var(--aime-primary);
		text-decoration: underline;
	}
}

.aime-link-activity-clicks {
	min-width: 34px;
	text-align: right;
	color: var(--aime-primary);
	font-size: 16px;
}

.aime-link-activity-bar {
	height: 9px;
	border-radius: 999px;
	background: #e8f1e9;
	overflow: hidden;

	span {
		display: block;
		height: 100%;
		border-radius: inherit;
		background: linear-gradient(90deg, var(--aime-primary), #22c55e);
	}
}

.aime-recipient-tabs {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.aime-recipient-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 8px 12px;
	border: 1px solid var(--aime-border);
	border-radius: 6px;
	background: var(--aime-white);
	color: var(--aime-text-light);
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;

	strong {
		min-width: 24px;
		padding: 2px 7px;
		border-radius: 999px;
		background: var(--aime-bg);
		color: var(--aime-text);
		font-size: 12px;
		text-align: center;
	}

	&:hover,
	&.is-active {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
		background: var(--aime-primary-light);
	}
}

.aime-recipient-list {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--aime-border-light);
	border-radius: 8px;
	overflow: hidden;
}

.aime-recipient-list-head,
.aime-recipient-row {
	display: grid;
	grid-template-columns: minmax(220px, 1fr) 90px 90px 110px;
	align-items: center;
	gap: 12px;
}

.aime-recipient-list-head {
	padding: 10px 14px;
	background: var(--aime-bg);
	color: var(--aime-text-light);
	font-size: 12px;
	font-weight: 800;
	text-transform: uppercase;
}

.aime-recipient-row {
	padding: 12px 14px;
	border-top: 1px solid var(--aime-border-light);

	> div {
		min-width: 0;
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	> div > strong,
	> div > span,
	> div > small {
		min-width: 0;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	> div > span,
	> div > small {
		color: var(--aime-text-light);
	}

	> strong {
		font-size: 16px;
		color: var(--aime-text);
	}
}

.aime-recipient-pagination {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	padding: 12px 14px;
	border-top: 1px solid var(--aime-border-light);
	background: var(--aime-white);

	span {
		min-width: 64px;
		text-align: center;
		font-weight: 700;
		color: var(--aime-text-light);
	}
}

.aime-card-toolbar {
	display: flex;
	justify-content: flex-end;
	margin: -4px 0 12px;

	.components-base-control {
		margin-bottom: 0;
	}

	.components-base-control__field {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-bottom: 0;
	}

	.components-base-control__label {
		margin-bottom: 0;
		font-size: 12px;
		font-weight: 700;
		color: var(--aime-text-light);
	}

	select.components-select-control__input {
		min-width: 76px;
	}
}

@media (max-width: 1200px) {
	.aime-campaign-report-grid,
	.aime-campaign-dual-grid {
		grid-template-columns: 1fr;
	}

	.aime-recipient-list-head {
		display: none;
	}

	.aime-recipient-row {
		grid-template-columns: 1fr auto auto;

		> .aime-badge {
			grid-column: 1 / -1;
			justify-self: flex-start;
		}
	}
}

.aime-svg-card-thumb {
	position: absolute;
	inset: 12px;
	border-radius: var(--aime-radius-sm);
	overflow: hidden;
	background: var(--aime-white);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

	iframe {
		width: 400%;
		height: 400%;
		transform: scale(0.25);
		transform-origin: top left;
		border: none;
		pointer-events: none;
	}
}
.aime-svg-card-overlay {
	position: absolute;
	inset: 0;
	background: rgba(27, 94, 32, 0.85);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	opacity: 0;
	transition: opacity var(--aime-transition);
	pointer-events: none;

	button,
	.aime-svg-overlay-btn--disabled {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		padding: 8px 20px;
		border-radius: var(--aime-radius-sm);
		font-size: 13px;
		font-weight: 600;
		border: none;
		transition: all var(--aime-transition);
	}

	button {
		cursor: pointer;
		pointer-events: auto;

		&.aime-overlay-primary {
			background: white;
			color: var(--aime-primary);

			&:hover {
				transform: scale(1.05);
			}
		}

		&.aime-overlay-secondary {
			background: rgba(255, 255, 255, 0.2);
			color: white;
			border: 1px solid rgba(255, 255, 255, 0.4);

			&:hover {
				background: rgba(255, 255, 255, 0.3);
			}
		}
	}

	.aime-svg-overlay-btn--disabled {
		background: rgba(255, 255, 255, 0.92);
		color: var(--aime-text);
	}
}

.aime-template-svg-card .aime-svg-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-svg-card-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 600;
	background: white;
	color: var(--aime-primary);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	z-index: 2;
}

// ═══════════════════════════════════════════════════════════
// SEO Module — Styles
// ═══════════════════════════════════════════════════════════

// ── SEO Dashboard (SEMrush-style) ─────────────────────────
.aime-seo-kpi-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 24px;

	@media (max-width: 900px) { grid-template-columns: repeat(2, 1fr); }
	@media (max-width: 480px) { grid-template-columns: 1fr; }
}

.aime-seo-kpi-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border-light, #e8e8e8);
	border-radius: 10px;
	padding: 20px 16px;
	text-align: center;
	transition: box-shadow var(--aime-transition), transform var(--aime-transition);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;

	&:hover {
		box-shadow: 0 4px 16px rgba(0,0,0,.08);
		transform: translateY(-2px);
	}
}

.aime-seo-kpi-icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
}

.aime-seo-kpi-val {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.1;
}

.aime-seo-kpi-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--aime-text-light);
	font-weight: 500;
}

.aime-seo-quick-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}

.aime-seo-quick-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid var(--aime-border);
	border-radius: 8px;
	background: var(--aime-white);
	font-size: 13px;
	font-weight: 500;
	color: var(--aime-text);
	cursor: pointer;
	transition: all 0.2s;

	&:hover {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
		background: var(--aime-primary-light, #f0f4ff);
		box-shadow: 0 2px 8px rgba(0,0,0,.06);
	}
}

.aime-seo-quick-icon {
	font-size: 16px;
}

.aime-seo-quick-btn--cta {
	background: var(--aime-primary);
	color: #fff;
	border-color: var(--aime-primary);

	&:hover {
		background: var(--aime-primary-dark, #2e59d9);
		color: #fff;
	}
}

// ── Usage bar (global, shared by Content Generator & SEO) ─
.aime-usage-bar-wrap {
	max-width: 600px;
	margin-bottom: 8px;
}

.aime-usage-labels {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	color: var(--aime-text-light);
	margin-bottom: 6px;
}

.aime-usage-bar {
	height: 10px;
	background: var(--aime-border);
	border-radius: 5px;
	overflow: hidden;
}

.aime-usage-bar-fill {
	height: 100%;
	background: var(--aime-primary);
	border-radius: 5px;
	transition: width 0.4s ease;
}

// ── Topic Map ─────────────────────────────────────────────
.aime-topic-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.aime-topic-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 16px;
	transition: box-shadow var(--aime-transition);

	&:hover {
		box-shadow: var(--aime-shadow-md);
	}
}

.aime-topic-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;

	h4 {
		margin: 0;
		font-size: 14px;
		font-weight: 600;
		color: var(--aime-text);
	}
}

.aime-topic-desc {
	font-size: 13px;
	color: var(--aime-text-light);
	margin: 0 0 8px;
	line-height: 1.5;
}

.aime-topic-parent {
	color: var(--aime-text-muted);
	font-size: 12px;
}

// ── On-Page Audit ─────────────────────────────────────────
.aime-audit-score {
	margin-bottom: 24px;

	h1 {
		font-size: 64px;
		font-weight: 700;
		line-height: 1;
		margin: 0 0 4px;
	}
}

.aime-audit-checks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 10px;
	margin-bottom: 20px;
}

.aime-audit-check {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-radius: var(--aime-radius-sm);
	font-size: 13px;
	border: 1px solid var(--aime-border);
	background: var(--aime-white);
}

.aime-check-pass {
	border-left: 3px solid var(--aime-success);
	background: var(--aime-success-light);
}

.aime-check-fail {
	border-left: 3px solid var(--aime-error);
	background: var(--aime-error-light);
}

.aime-check-icon {
	font-weight: 700;
	font-size: 16px;

	.aime-check-pass & {
		color: var(--aime-success);
	}

	.aime-check-fail & {
		color: var(--aime-error);
	}
}

.aime-check-label {
	font-weight: 500;
	flex: 1;
}

.aime-check-detail {
	font-size: 12px;
	color: var(--aime-text-light);
}

// ── Tags & Lists ──────────────────────────────────────────
.aime-tag {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 500;
	background: var(--aime-bg);
	color: var(--aime-text-light);
	border: 1px solid var(--aime-border);
}

.aime-tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.aime-list {
	margin: 0;
	padding-left: 20px;
	font-size: 13px;
	color: var(--aime-text);
	line-height: 1.8;
}

// ── Settings Form ─────────────────────────────────────────
.aime-settings-form {
	max-width: 95%;
	padding: 16px 0;

	.components-base-control {
		margin-bottom: 16px;
	}
	.components-text-control__input,.aim-competitor-domains {
		max-width: 400px;
	}

}

.aime-settings-subgroup {
	margin: -6px 0 18px 28px;
	padding: 12px 14px;
	max-width: 420px;
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-bg);

	> strong {
		display: block;
		margin-bottom: 8px;
		font-size: 12px;
		text-transform: uppercase;
		color: var(--aime-text-light);
	}

	.components-base-control {
		margin-bottom: 8px;
	}
}

.aime-table-toolbar--between {
	justify-content: space-between;
	align-items: center;
}

.aime-toolbar-copy {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-right: auto;
	color: var(--aime-text-light);
	font-size: 13px;

	strong {
		color: var(--aime-text);
		font-size: 18px;
	}
}
.aime-seo-automation .aime-card .aime-table-toolbar button.components-button.is-secondary {
    margin-top: 1.3rem;
}
.aime-link-suggestions-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.aime-link-suggestion-group {
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	background: var(--aime-white);
	overflow: hidden;
}

.aime-link-suggestion-post {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	background: var(--aime-bg);
	border-bottom: 1px solid var(--aime-border-light);

	strong {
		display: block;
		color: var(--aime-text);
	}

	span {
		display: inline-block;
		margin-top: 3px;
		font-size: 12px;
		color: var(--aime-text-light);
	}
}

.aime-link-suggestion-post-actions,
.aime-link-suggestion-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-link-suggestion {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 14px;
	border-bottom: 1px solid var(--aime-border-light);

	&:last-child {
		border-bottom: 0;
	}
}

.aime-link-suggestion-main {
	min-width: 0;
	flex: 1;

	p {
		margin: 8px 0 0;
		color: var(--aime-text-light);
		font-size: 13px;
		line-height: 1.5;
	}
}

.aime-link-suggestion-route {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 13px;
	line-height: 1.5;

	a {
		max-width: 360px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

.aime-link-anchor {
	padding: 3px 7px;
	border-radius: var(--aime-radius-sm);
	background: #eef6ef;
	color: var(--aime-primary-dark);
	font-weight: 600;
}

.aime-link-arrow {
	color: var(--aime-text-light);
}

.aime-link-suggestion-status {
	display: inline-flex;
	align-items: center;
	height: 24px;
	padding: 0 8px;
	border-radius: var(--aime-radius-sm);
	font-size: 12px;
	font-weight: 600;
	text-transform: capitalize;
	background: var(--aime-bg);
	color: var(--aime-text-light);

	&.is-pending {
		background: #fff7e6;
		color: #8a5a00;
	}

	&.is-applied {
		background: #e8f5e9;
		color: #256029;
	}

	&.is-dismissed {
		background: #f1f1f1;
		color: #5f6368;
	}
}

@media (max-width: 782px) {
	.aime-link-suggestion-post,
	.aime-link-suggestion {
		flex-direction: column;
	}

	.aime-link-suggestion-route a {
		max-width: 100%;
	}
}

.aime-seo-rank-settings-form {
	.components-base-control {
		max-width: 400px;
		margin-bottom: 18px;
	}

	.components-select-control__input,
	.components-text-control__input {
		max-width: 400px;
	}
}

// ── Page description ──────────────────────────────────────
.aime-page-desc {
	margin: 0;
	font-size: 14px;
	color: var(--aime-text-light);
	line-height: 1.5;
}

// ── Empty text ────────────────────────────────────────────
.aime-empty-text {
	text-align: center;
	padding: 24px 16px;
	color: var(--aime-text-light);
	font-size: 14px;

	a,
	.components-button.is-link {
		color: var(--aime-primary);
	}
}

.aime-svg-card-info {
	padding: 14px 16px;

	h4 {
		margin: 0 0 4px;
		font-size: 14px;
		font-weight: 600;
		color: var(--aime-text);
	}
}

.aime-svg-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.aime-svg-card-category {
	font-size: 12px;
	color: var(--aime-text-muted);
	text-transform: capitalize;
}

.aime-svg-card-actions {
	display: flex;
	gap: 4px;
}

.aime-svg-action-btn {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid var(--aime-border);
	background: var(--aime-white);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--aime-text-light);
	font-size: 14px;
	transition: all var(--aime-transition);

	&:hover {
		background: var(--aime-primary-light);
		border-color: var(--aime-primary);
		color: var(--aime-primary);
	}

	&.aime-action-delete:hover {
		background: var(--aime-error-light);
		border-color: var(--aime-error);
		color: var(--aime-error);
	}
}

.aime-template-empty-state {
	text-align: center;
	padding: 60px 24px;
	color: var(--aime-text-light);

	svg {
		width: 80px;
		height: 80px;
		fill: var(--aime-border);
		margin-bottom: 16px;
	}

	h3 {
		margin: 0 0 8px;
		font-size: 16px;
		color: var(--aime-text);
	}

	p {
		margin: 0 0 20px;
		font-size: 14px;
	}
}

// ============================================
// PREMIUM BUTTON OVERRIDES FOR WP COMPONENTS
// Matched to the shared button system above so a <Button> from @wordpress
// and an .aime-btn- sit on the same baseline in the same toolbar.
// ============================================
#aime-app .components-button.is-primary,
#aime-app .components-button.is-secondary,
#aime-app .components-button.is-tertiary,
#aime-app .components-button.is-destructive {
	min-height: 36px;
	border-radius: var(--aime-radius-sm);
	font-size: 13.5px;
	font-weight: 600;
	transition: background var(--aime-transition), color var(--aime-transition),
		border-color var(--aime-transition), box-shadow var(--aime-transition),
		transform 0.08s ease;

	&:active:not(:disabled):not([aria-disabled='true']) {
		transform: translateY(1px);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
		box-shadow: none;
	}
}

#aime-app .components-button.is-primary {
	background: var(--aime-primary) !important;
	border-color: var(--aime-primary) !important;
	box-shadow: 0 2px 5px rgba(var(--aime-primary-rgb), 0.22);

	&:hover, &:focus {
		background: var(--aime-primary-hover) !important;
		box-shadow: 0 5px 14px rgba(var(--aime-primary-rgb), 0.28);
	}

	&:disabled,
	&[aria-disabled="true"],
	&.is-busy:disabled {
		background: var(--aime-text-muted) !important;
		border-color: var(--aime-text-muted) !important;
		box-shadow: none !important;
		opacity: 0.55;
		cursor: not-allowed;
	}
}

#aime-app .components-button.is-secondary {
	border-color: var(--aime-border);
	background: var(--aime-white);
	color: var(--aime-text);
	box-shadow: none;

	&:hover:not(:disabled):not([aria-disabled='true']) {
		border-color: var(--aime-primary);
		color: var(--aime-primary);
		background: var(--aime-primary-light);
	}
}

#aime-app .components-button.is-tertiary {
	color: var(--aime-text-light);

	&:hover:not(:disabled):not([aria-disabled='true']) {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
	}
}

#aime-app .components-button.is-destructive {
	border-radius: var(--aime-radius-sm);
	color: var(--aime-error);

	&:hover:not(:disabled):not([aria-disabled='true']) {
		background: var(--aime-error-light);
		color: var(--aime-error-dark);
	}
}

#aime-app .components-tab-panel__tabs {
	border-bottom: 2px solid var(--aime-border-light);
	margin-bottom: 20px;
}

#aime-app .components-tab-panel__tabs-item {
	font-weight: 500;
	color: var(--aime-text-light);
	padding: 10px 20px;

	&.is-active {
		color: var(--aime-primary);
		box-shadow: inset 0 -2px 0 0 var(--aime-primary);
		font-weight: 600;
	}
}

#aime-app .components-base-control {
	margin-bottom: 16px;
}
#aime-app .components-base-control:last-child {
	margin-bottom: 0;
}
#aime-app .aime-table-toolbar .components-base-control {
	margin-bottom: 0;
}

// ============================================
// FORM CONTROL SYSTEM
// Every field in the plugin resolves to one shape: the button height, the
// button radius, a 1.5px hairline that warms on hover, and a focus ring in
// the module accent. Focus is the only state that grows — the ring animates
// out from the border rather than the box changing size, so a form does not
// twitch as the visitor tabs through it.
// ============================================
#aime-app {
	.components-text-control__input,
	.components-select-control__input,
	.components-textarea-control__input,
	input[type="text"],
	input[type="search"],
	input[type="password"],
	input[type="date"],
	input[type="datetime-local"],
	input[type="time"],
	input[type="number"],
	input[type="url"],
	input[type="email"],
	input[type="tel"],
	textarea,
	select {
		box-sizing: border-box;
		border-radius: var(--aime-radius-sm) !important;
		border: 1.5px solid var(--aime-border) !important;
		background-color: var(--aime-white);
		color: var(--aime-text);
		font-size: 13.5px;
		line-height: 1.4;
		box-shadow: none;
		// Only the two properties that actually change — animating `all` here
		// would drag layout metrics along with the colour.
		transition: border-color var(--aime-transition),
			box-shadow var(--aime-transition), background-color var(--aime-transition);

		&::placeholder {
			color: var(--aime-text-muted);
			opacity: 1;
		}

		&:hover:not(:disabled):not([readonly]) {
			border-color: var(--aime-text-muted) !important;
		}

		&:focus,
		&:focus-visible {
			border-color: var(--aime-primary) !important;
			box-shadow: var(--aime-focus-ring) !important;
			outline: none !important;
		}

		&:disabled,
		&[readonly] {
			background-color: var(--aime-bg);
			color: var(--aime-text-light);
			border-color: var(--aime-border-light) !important;
			box-shadow: none !important;
			cursor: not-allowed;
		}

		&[aria-invalid="true"],
		&.is-invalid {
			border-color: var(--aime-error) !important;

			&:focus {
				box-shadow: var(--aime-focus-ring-error) !important;
			}
		}
	}

	// Single-line controls share the button baseline; textareas grow instead.
	.components-text-control__input,
	.components-select-control__input,
	input[type="text"],
	input[type="search"],
	input[type="password"],
	input[type="date"],
	input[type="datetime-local"],
	input[type="time"],
	input[type="number"],
	input[type="url"],
	input[type="email"],
	input[type="tel"],
	select {
		height: var(--aime-control-h);
		min-height: var(--aime-control-h);
		padding: 0 12px !important;
	}

	.components-textarea-control__input,
	textarea {
		min-height: 88px;
		padding: 9px 12px !important;
		font-family: inherit;
		resize: vertical;
	}

	// The select arrow lives in the padding, so the text needs to stop short.
	.components-select-control__input,
	select {
		padding-right: 30px !important;
	}

	// Checkbox and radio opt out of the box treatment — they are marks, not
	// fields, and inherit only the accent.
	input[type="checkbox"],
	input[type="radio"] {
		&:focus-visible {
			outline: 2px solid var(--aime-primary);
			outline-offset: 2px;
			box-shadow: none;
		}
	}

	// Field labels: one weight, one size, consistent gap to the control.
	.components-base-control__label,
	.aime-field-label {
		display: block;
		margin-bottom: 6px;
		font-size: 12px;
		font-weight: 600;
		line-height: 1.3;
		text-transform: none;
		color: var(--aime-text);
	}

	.components-base-control__help {
		margin-top: 6px;
		font-size: 12px;
		line-height: 1.45;
		color: var(--aime-text-light);
	}
}

// Reset padding for select elements inside WP ColorPicker & other internal components
#aime-app .components-color-picker select,
#aime-app .components-color-picker .components-select-control__input,
#aime-app .react-colorful + div select,
#aime-app [class*="color-picker"] select {
	padding: 4px 8px !important;
	height: auto !important;
	min-height: 0 !important;
	font-size: 11px !important;
	line-height: 1.4 !important;
}

#aime-app .aime-table-toolbar .components-select-control__input {
	height: var(--aime-control-h) !important;
	padding: 0 30px 0 12px !important;
	box-sizing: border-box !important;
}

#aime-app .aime-table-toolbar .components-search-control {
	.components-input-base {
		height: var(--aime-control-h) !important;
		min-height: var(--aime-control-h) !important;
		box-sizing: border-box !important;
	}

	.components-base-control__field {
		margin-bottom: 0 !important;
	}

	input[type="search"] {
		height: var(--aime-control-h) !important;
		box-sizing: border-box !important;
		padding: 0 8px !important;
	}
}

#aime-app .components-search-control .components-text-control__input {
	border-radius: calc(var(--aime-control-h) / 2) !important;
}

// Composite controls own their border. Any input nested inside one is a part,
// not a field, so it drops the chrome the global form rules would give it.
#aime-app .aime-searchable-select__search,
#aime-app .aime-searchable-select__dropdown input[type="text"],
#aime-app .aime-searchable-select__dropdown input[type="search"] {
	height: auto !important;
	min-height: 0 !important;
	padding: 8px 12px !important;
	border: none !important;
	border-bottom: 1px solid var(--aime-border) !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;

	&:hover,
	&:focus {
		border-color: var(--aime-border) !important;
		box-shadow: none !important;
	}
}

// ============================================
// TOKEN / MULTISELECT FIELDS
// A token field is one control that happens to contain a text input. The
// input therefore gets no chrome of its own — the container carries the
// border, the hover and the focus ring, so the field reads as a single box
// instead of a box inside a box.
// ============================================
#aime-app .components-form-token-field {
	// The wrapper is spacing-neutral: whatever grid or stack the field sits in
	// owns the rhythm, exactly as it does for a text input.
	margin: 0;

	.components-form-token-field__input-container {
		// border-box, or the 1.5px border and the 3px of padding stack on top
		// of the 36px floor and the field lands ~8px taller than every control
		// beside it — the extra height that made this box look mispadded.
		box-sizing: border-box;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px;
		min-height: var(--aime-control-h);
		padding: 3px 6px !important;
		margin: 0 !important;
		border: 1.5px solid var(--aime-border) !important;
		border-radius: var(--aime-radius-sm) !important;
		background: var(--aime-white);
		box-shadow: none !important;
		transition: border-color var(--aime-transition), box-shadow var(--aime-transition);

		&:hover {
			border-color: var(--aime-text-muted) !important;
		}

		&.is-active,
		&:focus-within {
			border-color: var(--aime-primary) !important;
			box-shadow: var(--aime-focus-ring) !important;
			outline: none !important;
		}
	}

	// The inner input inherits the container's box, not its own. 26px keeps an
	// empty field at exactly --aime-control-h, so it lines up with the text
	// input above it and the select below it.
	input.components-form-token-field__input,
	.components-form-token-field__input-container input[type="text"] {
		flex: 1;
		min-width: 120px;
		height: 26px !important;
		min-height: 26px !important;
		margin: 0 !important;
		padding: 0 4px !important;
		border: none !important;
		border-radius: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		outline: none !important;
		font-size: 13.5px;
		color: var(--aime-text);

		&:hover,
		&:focus {
			border: none !important;
			box-shadow: none !important;
		}
	}

	// Newer WP wraps the tokens in a list. It is a layout artefact, not a list
	// the reader should feel — it inherits the container's flex row.
	.components-form-token-field__token-list,
	ul.components-form-token-field__input-container {
		display: contents;
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.components-form-token-field__token {
		display: inline-flex;
		align-items: center;
		max-width: 100%;
		margin: 0;
		background: var(--aime-primary-light);
		border: 1px solid rgba(var(--aime-primary-rgb), 0.22);
		border-radius: var(--aime-radius-sm);
		color: var(--aime-primary);
		font-size: 12.5px;
		font-weight: 500;
		line-height: 1;
		overflow: hidden;
	}

	.components-form-token-field__token-text {
		padding: 0 2px 0 8px;
		line-height: 22px;
		background: transparent;
		color: inherit;
		border-radius: 0;
	}

	// The remove control was a near-invisible glyph on a tinted chip. It now
	// carries its own hit area and states: accent at rest, error on hover, so
	// removing a token looks like the destructive act it is.
	.components-form-token-field__remove-token.components-button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 20px;
		height: 22px;
		min-width: 20px;
		padding: 0;
		border: none;
		border-radius: 0;
		background: transparent;
		color: var(--aime-primary);
		cursor: pointer;
		transition: background var(--aime-transition), color var(--aime-transition);

		svg {
			width: 15px;
			height: 15px;
			fill: currentColor;
		}

		&:hover {
			background: var(--aime-error-light);
			color: var(--aime-error);
		}

		&:focus-visible {
			outline: 2px solid var(--aime-primary);
			outline-offset: -2px;
			box-shadow: none;
		}
	}

	// Suggestion dropdown picks up the same border language as the field.
	.components-form-token-field__suggestions-list {
		border: 1.5px solid var(--aime-border);
		border-top: none;
		border-radius: 0 0 var(--aime-radius-sm) var(--aime-radius-sm);
		background: var(--aime-white);
		box-shadow: var(--aime-shadow-md);
	}

	.components-form-token-field__suggestion {
		font-size: 13px;
		color: var(--aime-text);

		&.is-selected {
			background: var(--aime-primary);
			color: var(--aime-white);
		}
	}
}

// Page header button
.aime-page-header .components-button.is-primary {
	padding: 8px 20px;
	font-size: 13px;
}

// Stat cards
.aime-stat-card {
	transition: transform var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		transform: translateY(-2px);
		box-shadow: var(--aime-shadow-md);
	}
}

.aime-social-calendar {
    max-width: 800px;
    margin: 0 auto;
}

// ============================================
// TEMPLATE SVG CARD ADDITIONAL STYLES
// ============================================
.aime-category-pills {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.aime-svg-card-body {
	padding: 14px 16px 8px;

	h4 {
		margin: 0;
	}
}

.aime-svg-card-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
	margin: 0 0 8px;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aime-svg-card-meta {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aime-svg-card-category {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 600;
	text-transform: capitalize;
}

.aime-svg-card-date {
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-svg-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	border-top: 1px solid var(--aime-border-light);
	background: var(--aime-bg);
}

.aime-svg-card-preview {
	position: relative;
	overflow: hidden;

	svg {
		width: 100%;
		height: auto;
		display: block;
	}
}

.aime-svg-overlay-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	border-radius: var(--aime-radius-sm);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	background: white;
	color: var(--aime-primary);
	transition: all var(--aime-transition);

	&:hover {
		transform: scale(1.05);
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	}

	&:nth-child(2) {
		background: rgba(255, 255, 255, 0.2);
		color: white;
		border: 1px solid rgba(255, 255, 255, 0.4);

		&:hover {
			background: rgba(255, 255, 255, 0.3);
		}
	}

	svg {
		width: 16px;
		height: 16px;
		fill: none;
	}
}

.aime-empty-state {
	text-align: center;
	padding: 60px 24px;
}

// ============================================
// CSV IMPORT MODAL
// ============================================
.aime-csv-import-modal {
	max-width: 720px !important;
	width: 90vw;

	.aime-premium-modal-body {
		max-height: 65vh;
		overflow-y: auto;
	}
}

// Dropzone
.aime-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	border: 2px dashed var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-bg);
	cursor: pointer;
	padding: 24px;
	text-align: center;
	transition: all var(--aime-transition);

	&:hover {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
	}

	&.is-dragging {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
		box-shadow: 0 0 0 4px rgba(27, 94, 32, 0.08);
	}

	&.has-file {
		min-height: 80px;
		border-style: solid;
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
	}

	p {
		margin: 8px 0 0;
		font-size: 14px;
		color: var(--aime-text-light);
	}
}

.aime-dropzone-icon {
	margin-bottom: 4px;
	opacity: 0.7;
}

.aime-dropzone-link {
	color: var(--aime-primary);
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}

.aime-dropzone-file {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 500;
	color: var(--aime-text);

	.dashicons {
		font-size: 24px;
		width: 24px;
		height: 24px;
		color: var(--aime-primary);
	}
}

.aime-dropzone-remove {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 1px solid var(--aime-border);
	background: var(--aime-white);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--aime-text-light);
	transition: all var(--aime-transition);
	margin-left: auto;

	&:hover {
		background: #ffebee;
		border-color: #ef5350;
		color: #c62828;
	}
}

// Link-style button (Download sample file)
.aime-link-btn {
	display: inline-flex;
	gap: 4px;
	padding: 0;
	border: none;
	background: none;
	color: var(--aime-primary);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: underline;
	transition: color var(--aime-transition);

	&:hover {
		color: var(--aime-primary-hover);
	}
}

// Muted text
.aime-muted {
	font-size: 13px;
	color: var(--aime-text-light);
}

.aime-mt-4 { margin-top: 4px; }
.aime-mt-8 { margin-top: 8px; }

// Mapping head
.aime-csv-mapping-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;

	h4 {
		margin: 0;
		font-size: 15px;
		font-weight: 600;
		color: var(--aime-text);
	}
}

// Mapping table
.aime-csv-mapping-table {
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm);
	overflow: hidden;
	margin-bottom: 20px;
}

.aime-csv-mapping-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0;

	&:not(:last-child) {
		border-bottom: 1px solid var(--aime-border-light);
	}

	&.aime-csv-mapping-header {
		background: var(--aime-bg);
		font-size: 12px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: var(--aime-text-light);

		span {
			padding: 10px 14px;

			&:first-child {
				border-right: 1px solid var(--aime-border-light);
			}
		}
	}
}

.aime-csv-mapping-cell {
	padding: 8px 12px;

	&:first-child {
		border-right: 1px solid var(--aime-border-light);
	}

	.aime-premium-input,
	.aime-premium-select {
		width: 100%;
		box-sizing: border-box;
	}

	.aime-premium-input[readonly] {
		background: var(--aime-bg);
		color: var(--aime-text-light);
		cursor: default;
	}
}

// Assign section (Lists + Tags side by side)
.aime-csv-assign-section {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-bottom: 20px;
	margin-top: 4px;
}

.aime-csv-assign-col {
	.aime-premium-form-label {
		margin-bottom: 8px;
	}
}

// Options row (Update Subscribers + New Status)
.aime-csv-options-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--aime-border-light);
}

.aime-csv-option {
	.aime-premium-form-label {
		margin-bottom: 8px;
	}
}

// Radio buttons
.aime-radio-group {
	display: flex;
	gap: 16px;
}

.aime-radio-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 500;
	color: var(--aime-text);
	cursor: pointer;

	input[type="radio"] {
		width: 16px;
		height: 16px;
		accent-color: var(--aime-primary);
		margin: 0;
		cursor: pointer;
	}
}

// Inline error
.aime-notice-error {
	padding: 10px 14px;
	border-radius: var(--aime-radius-sm);
	background: #ffebee;
	color: #c62828;
	font-size: 13px;
	font-weight: 500;
	border: 1px solid #ef9a9a;
}

// Import source selection cards
.aime-import-source-cards {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aime-import-source-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 1.5px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	cursor: pointer;
	transition: all var(--aime-transition);
	text-align: left;

	.dashicons {
		font-size: 28px;
		width: 28px;
		height: 28px;
		color: var(--aime-text-light);
		flex-shrink: 0;
		transition: color var(--aime-transition);
	}

	&:hover {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);

		.dashicons { color: var(--aime-primary); }
	}

	&.is-selected {
		border-color: var(--aime-primary);
		background: var(--aime-primary-light);
		box-shadow: 0 0 0 2px rgba(27, 94, 32, 0.12);

		.dashicons { color: var(--aime-primary); }
		.aime-import-source-title { color: var(--aime-primary); }
	}
}

.aime-import-source-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--aime-text);
	display: block;
	line-height: 1.3;
}

.aime-import-source-desc {
	font-size: 12px;
	color: var(--aime-text-light);
	display: block;
	line-height: 1.3;
	margin-top: 2px;
}

// ═══════════════════════════════════════════════════════════
// Content Generator Module — Styles
// ═══════════════════════════════════════════════════════════

// ── Content Analytics (landing page) ──────────────────────
.aime-content-analytics {
	.aime-usage-bar-wrap {
		max-width: 600px;
	}

	.aime-usage-labels {
		display: flex;
		justify-content: space-between;
		font-size: 13px;
		color: var(--aime-text-light);
		margin-bottom: 6px;
	}

	.aime-usage-bar {
		height: 10px;
		background: var(--aime-border);
		border-radius: 5px;
		overflow: hidden;
	}

	.aime-usage-bar-fill {
		height: 100%;
		background: var(--aime-primary);
		border-radius: 5px;
		transition: width 0.4s ease;
	}

	// The hand-rolled `.aime-bar-chart` / `.aime-bar-item` / `.aime-bar` divs
	// lived here, along with `.aime-status-grid` and `.aime-tone-list`. All of it
	// went with the page: the bar chart had no axis and collapsed empty days, the
	// status chips carried no share, and the tone list printed counts with
	// nothing to compare them against. Recharts and `.aime-rankbar` replaced
	// them. The same class names still exist scoped to other modules — this block
	// only ever applied inside `.aime-content-analytics`.

	// Cards sitting in a grid stop being responsible for the gap under them.
	.aime-content-split > .aime-card,
	.aime-charts-grid > .aime-card {
		margin-bottom: 0;
	}
}

// ── Ranked bar list ───────────────────────────────────────
// One label, one bar on a shared baseline, one count. This is the plugin's
// answer to "should this be a pie": a pie asks the eye to compare angles, which
// is the least accurate comparison it can make, and it has no order — while
// draft → ready → published is a sequence, and scattering a sequence around a
// circle throws away the only structure the data has.
//
// The grid lives on the list and the rows are `display: contents`, so every
// label, track and count lines up down the card without a magic label width —
// which matters because the tone list holds user-authored text of any length.
.aime-rankbar {
	display: grid;
	grid-template-columns: minmax(0, max-content) minmax(80px, 1fr) max-content;
	align-items: center;
	gap: 10px 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.aime-rankbar__row {
	display: contents;
}

.aime-rankbar__label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	color: var(--aime-text);
	text-overflow: ellipsis;
	white-space: nowrap;
	text-transform: capitalize;
}

.aime-rankbar__dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 8px;
}

.aime-rankbar__track {
	height: 8px;
	background: var(--aime-bg-subtle);
	border-radius: 8px;
	overflow: hidden;
}

.aime-rankbar__fill {
	display: block;
	height: 100%;
	border-radius: 8px;
	transition: width var(--aime-transition);
}

.aime-rankbar__count {
	font-size: 13px;
	font-weight: 700;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.aime-rankbar__suffix {
	margin-left: 4px;
	font-size: 11px;
	font-weight: 600;
	font-style: normal;
	color: var(--aime-text-light);
}

// ── Pipeline card ─────────────────────────────────────────
.aime-pipeline {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

// The headline answers the card in one number before the bars explain it. A
// hairline, not a rule and not a box: the gap already separates the two, the
// line only has to confirm it.
.aime-pipeline__headline {
	padding-bottom: 16px;
	border-bottom: 1px solid var(--aime-border-light);
}

.aime-pipeline__value {
	display: block;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
}

.aime-pipeline__caption {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-light);
}

.aime-pipeline__foot {
	margin: 0;
	font-size: 11px;
	color: var(--aime-text-light);
}

// ── Content analytics layout ──────────────────────────────
// The time chart carries an axis, a legend and up to ninety points; the
// pipeline carries a number and a short list. Equal columns would have made the
// chart illegible to give the list room it never asked for.
.aime-charts-grid--wide-first {
	@media (min-width: 960px) {
		grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
	}
}

// A four-column table beside a list of one-word labels. Below the 960 door they
// stack, because a table squeezed into half of 782px is a table nobody reads.
.aime-content-split {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
	margin-bottom: 24px;

	@media (min-width: 960px) {
		grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
	}
}

// Counts belong on the right, on one decimal column, at one width per digit.
// A word count that shifts left as it grows cannot be compared to the row above
// it without reading both.
.aime-table {
	th.aime-num,
	td.aime-num {
		text-align: right;
		font-variant-numeric: tabular-nums;
	}
}

// ═══════════════════════════════════════════════════════════
// Workflow Automation Module — Analytics
//
// Shares the whole vocabulary of the Content analytics page — the gauge band,
// the ranked bar list, the pipeline headline, the wide-first chart grid — and
// adds only what unattended automation needs on top: a note under the quota
// explaining the grey bars in the chart, and a per-row reliability bar in the
// workflow table.
// ═══════════════════════════════════════════════════════════

.aime-wf-analytics {
	// Cards sitting in a grid stop being responsible for the gap under them.
	.aime-charts-grid > .aime-card {
		margin-bottom: 0;
	}

	// The table is the last thing on the page and the widest; it keeps its own
	// scroll rather than forcing the layout to widen for one column.
	.aime-table-wrap {
		margin-bottom: 12px;
	}
}

// Why a run was skipped, said under the bar it belongs to rather than in the
// chart legend — the legend can only name the colour, and "skipped" without
// "because the cap was reached" reads as the workflow's fault.
.aime-usage-note {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--aime-text-light);
}

// ── Table reliability bar ─────────────────────────────────
// Nine rows of "94.2%" is nine numbers read in sequence; nine bars on a shared
// baseline is one shape, and the row that dips is seen before it is read. The
// number stays beside it because a bar alone cannot be quoted.
.aime-minibar {
	display: inline-block;
	width: 72px;
	height: 6px;
	vertical-align: middle;
	background: var(--aime-bg-subtle);
	border-radius: 6px;
	overflow: hidden;
}

.aime-minibar__fill {
	display: block;
	height: 100%;
	border-radius: 6px;
	transition: width var(--aime-transition);
}

.aime-minibar__value {
	margin-left: 8px;
	font-size: 12px;
	font-weight: 600;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
}

// ── Articles page ─────────────────────────────────────────
.aime-articles-list {
	.aime-row-actions {
		display: flex;
		gap: 2px;
		align-items: center;

		.components-button.is-small {
			padding: 4px;
			min-width: auto;
		}
	}

	.aime-status-badge {
		display: inline-block;
		padding: 2px 10px;
		border-radius: 12px;
		font-size: 11px;
		font-weight: 600;
		color: #fff;
		white-space: nowrap;
	}

	.aime-table-schedule-edit {
		display: grid;
		grid-template-columns: minmax(150px, 1fr) auto;
		gap: 6px;
		align-items: center;
		max-width: 260px;

		.components-base-control {
			margin-bottom: 0;
		}
	}

	.aime-schedule-static {
		display: inline-block;
		max-width: 220px;
		font-size: 12px;
		line-height: 1.4;
		color: var(--aime-text-light);
	}
}

.aime-brand-voice-card {
	.aime-brand-voice-description {
		margin: 0 0 14px;
		color: var(--aime-text-light);
		font-size: 13px;
		line-height: 1.55;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
	}

	// Tone / Style / Avoid were three filled boxes inside the card — cards
	// nested in a card. They are a labelled record, so they get a hairline
	// ledger: the rules do the separating, no second surface required.
	.aime-brand-voice-values {
		margin: 0 0 12px;
		border-top: 1px solid var(--aime-border-light);
	}

	.aime-brand-voice-rule {
		padding: 10px 0;
		border-bottom: 1px solid var(--aime-border-light);

		&:last-child {
			border-bottom: 0;
		}

		dt {
			margin: 0 0 3px;
			font-size: 11px;
			font-weight: 600;
			letter-spacing: 0.05em;
			text-transform: uppercase;
			color: var(--aime-text-muted);
		}

		dd {
			margin: 0;
			font-size: 13px;
			line-height: 1.5;
			color: var(--aime-text-light);
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 3;
			overflow: hidden;
		}

		&.is-empty dd {
			color: var(--aime-text-muted);
			font-style: italic;
		}
	}
}

// ── Article Editor 2-column layout ────────────────────────
.aime-article-editor {
	.aime-header-left {
		display: flex;
		align-items: center;
		gap: 8px;

		h2 {
			margin: 0;
		}
	}

	.aime-schedule-inline {
		display: flex;
		align-items: center;
		gap: 6px;

		.components-base-control {
			margin-bottom: 0;
		}
	}

	.aime-card-body {
		.aime-form-field {
			margin-bottom: 18px;
		}

		> .components-base-control {
			margin-bottom: 16px;

			&:last-child {
				margin-bottom: 0;
			}
		}
	}

	.aime-form-field {
		margin-bottom: 18px;
	}

	.aime-structure-toggles {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
		gap: 12px;
		margin: 16px 0;
		padding: 12px 16px;
		background: var(--aime-bg, #f8fafc);
		border: 1px solid var(--aime-border, #e2e8f0);
		border-radius: var(--aime-radius-sm, 6px);

		.components-base-control {
			margin-bottom: 0 !important;
		}

		.components-toggle-control .components-base-control__field {
			margin-bottom: 0 !important;
		}

		.components-base-control__help {
			font-size: 11.5px;
			margin-top: 3px;
			color: var(--aime-text-muted, #64748b);
			line-height: 1.4;
		}
	}
}

.aime-content-editor-grid {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 20px;
	align-items: start;

	@media (max-width: 900px) {
		grid-template-columns: 1fr;
	}
}

.aime-chatbot-analytics .aime-page-header-actions .components-base-control.components-select-control {
    margin-bottom: 0;
}
.aime-ai-tools-grid .aime-card-body .components-base-control {
    margin-bottom: 1rem;
}

.aime-content-editor-main {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;

	// ── Required field validation ──
	.aime-form-field {
		&.has-error {
			.components-text-control__input,
			.components-textarea-control__input,
			.components-select-control__input,
			.components-form-token-field__input-container {
				border-color: var(--aime-error) !important;
				box-shadow: var(--aime-focus-ring-error) !important;
			}

			.components-base-control__label {
				color: var(--aime-error) !important;
			}
		}
	}

	.aime-field-error {
		display: block;
		font-size: 12px;
		color: var(--aime-error);
		margin-top: 4px;
		font-weight: 500;
		line-height: 1.4;
		word-break: break-word;
	}

	.aime-gen-controls {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 12px;
		margin-top: 12px;

		.components-base-control {
			margin-bottom: 0;
		}
	}

	.aime-gen-actions {
		display: flex;
		gap: 8px;
		margin-top: 12px;
		flex-wrap: wrap;

		.components-spinner {
			margin: 0 6px 0 0;
		}
	}

	.aime-gen-error,
	.aime-image-error {
		margin-top: 8px;
		padding: 8px 12px 8px 20px;
		background: #FFF0F0;
		border-left: 4px solid var(--aime-error, #d32f2f);
		border-radius: 4px;
		font-size: 12.5px;
		line-height: 1.5;
		word-break: break-word;
		display: flex;
		gap: 8px;
	}

	.aime-ai-notice {
		margin-top: 10px;
		padding: 8px 12px;
		background: #fff0f0;
		border-left: 4px solid #eb0000;
		color: #eb0000;
		font-size: 13px;
		border-radius: 4px;

		a {
			color: #1B5E20;
			font-weight: 600;
			text-decoration: underline;
		}
		&::before{
			margin-right: 10px;
		}
	}

	.aime-btn-generate {
		background: linear-gradient(135deg, #1B5E20, #2E7D32) !important;
		border: none !important;
	}

	.aime-outline-preview {
		background: var(--aime-bg);
		padding: 12px;
		border-radius: var(--aime-radius-sm);
		font-size: 12px;
		white-space: pre-wrap;
		max-height: 240px;
		overflow-y: auto;
		border: 1px solid var(--aime-border);
	}

	.aime-outline-list {
		list-style: none;
		margin: 0;
		padding: 0;

		li {
			display: flex;
			align-items: center;
			gap: 10px;
			padding: 6px 8px;
			border-bottom: 1px solid var(--aime-border);

			&:last-child {
				border-bottom: none;
			}
		}

		.aime-outline-level {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			min-width: 28px;
			height: 22px;
			border-radius: 4px;
			background: var(--aime-primary, #3b82f6);
			color: #fff;
			font-size: 11px;
			font-weight: 600;
			flex-shrink: 0;
		}

		.aime-outline-heading {
			font-size: 13px;
			font-weight: 500;
			color: var(--aime-text);
		}
	}

	.aime-title-input input {
		font-size: 18px;
		font-weight: 600;
	}

	.aime-content-textarea textarea {
		font-family: monospace;
		font-size: 13px;
		min-height: 400px;
	}

	.aime-content-view-toggle {
		display: flex;
		gap: 4px;
		margin-bottom: 12px;
	}

	.aime-tinymce-wrap {
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		overflow: hidden;
		min-height: 350px;

		.wp-editor-area {
			width: 100% !important;
			min-height: 300px;
		}

		.mce-tinymce {
			box-shadow: none !important;
		}
	}

	.aime-content-visual-preview {
		background: #fff;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		padding: 20px 24px;
		min-height: 300px;
		max-height: 600px;
		overflow-y: auto;
		font-size: 15px;
		line-height: 1.75;
		color: #333;

		h2 { font-size: 1.5em; margin: 1.2em 0 0.5em; font-weight: 700; }
		h3 { font-size: 1.25em; margin: 1em 0 0.4em; font-weight: 600; }
		p { margin: 0 0 1em; }
		ul, ol { margin: 0 0 1em 1.5em; }
		li { margin-bottom: 0.3em; }
		strong { font-weight: 700; }
		em { font-style: italic; }
		a { color: #1B5E20; text-decoration: underline; }
	}

	.aime-empty-content-hint {
		padding: 40px 20px;
		text-align: center;
		color: var(--aime-text-light);
		font-size: 14px;
	}

	.aime-field-hint {
		margin: 4px 0 0;
		color: var(--aime-text-light);
		font-size: 12px;
		font-style: italic;
	}

	.aime-image-url-manual {
		font-size: 13px;
		color: var(--aime-text-light);

		summary {
			cursor: pointer;
			&:hover { color: var(--aime-text); }
		}
	}

	.aime-content-stats {
		display: flex;
		gap: 16px;
		font-size: 12px;
		color: var(--aime-text-light);
		padding-top: 8px;
		border-top: 1px solid var(--aime-border);
		margin-top: 8px;
	}

	.aime-generating-overlay {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 48px 16px;
		color: var(--aime-text-light);
	}
}

/* Humanize button area */
.aime-humanize-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.aime-btn-humanize {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
	color: #fff !important;
	border: none !important;

	&:hover {
		opacity: 0.9;
	}

	&:disabled {
		opacity: 0.5;
	}
}

.aime-content-editor-side {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;

	.aime-field-hint {
		margin: 4px 0 0;
		color: var(--aime-text-light);
		font-size: 12px;
		font-style: italic;
	}

	.aime-featured-image-preview {
		margin-bottom: 12px;
		border-radius: var(--aime-radius-sm);
		overflow: hidden;
		border: 1px solid var(--aime-border);
		position: relative;

		img {
			display: block;
			width: 100%;
			max-width: 100%;
			height: auto;
		}

		.aime-remove-image {
			position: absolute;
			top: 8px;
			right: 8px;
			background: rgba(255,255,255,.9);
			padding: 2px 8px;
			border-radius: 4px;
			font-size: 12px;
		}
	}

	.aime-image-tabs {
		margin-bottom: 8px;

		&__nav {
			display: flex;
			gap: 0;
			border-bottom: 2px solid var(--aime-border);
			margin-bottom: 12px;
		}

		&__tab {
			padding: 8px 16px !important;
			border: 1px solid var(--aime-border) !important;
			border-bottom: 2px solid transparent !important;
			background: #f6f7f7 !important;
			cursor: pointer;
			font-size: 13px !important;
			font-weight: 500 !important;
			color: var(--aime-text-light) !important;
			margin-bottom: -2px;
			border-radius: 4px 4px 0 0 !important;
			transition: color 0.2s, border-color 0.2s, background 0.2s;
			line-height: 1.4;
			outline: none;

			&:hover {
				color: var(--aime-primary) !important;
				background: #fff !important;
			}

			&.is-active {
				color: var(--aime-primary) !important;
				background: #fff !important;
				border-bottom-color: var(--aime-primary) !important;
				border-left-color: var(--aime-border) !important;
				border-right-color: var(--aime-border) !important;
				border-top-color: var(--aime-primary) !important;
				font-weight: 600 !important;
			}
		}

		&__content {
			padding: 4px 0;
		}
	}

	.aime-image-tab-panel {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.aime-image-tab-desc {
		margin: 0;
		font-size: 13px;
		color: var(--aime-text-light);
	}

	.aime-stock-search {
		display: flex;
		gap: 8px;
		align-items: flex-start;

		> div:first-child {
			flex: 1;
		}
	}

	.aime-stock-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;

		&__item {
			position: relative;
			padding: 0;
			border: 2px solid transparent;
			border-radius: 4px;
			overflow: hidden;
			cursor: pointer;
			background: none;
			aspect-ratio: 4 / 3;

			img {
				width: 100%;
				height: 100%;
				object-fit: cover;
				display: block;
			}

			&:hover:not(:disabled) {
				border-color: var(--aime-primary);
			}

			&:disabled {
				cursor: default;
				opacity: 0.7;
			}

			&.is-importing {
				opacity: 1;
				border-color: var(--aime-primary);
			}
		}

		&__busy {
			position: absolute;
			inset: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			background: rgba(255, 255, 255, 0.6);
		}

		&__credit {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 0;
			padding: 2px 6px;
			font-size: 10px;
			line-height: 1.4;
			color: #fff;
			background: rgba(0, 0, 0, 0.45);
			text-align: left;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
	}

	.aime-char-count {
		display: block;
		text-align: right;
		font-size: 11px;
		color: var(--aime-text-light);
		margin-top: -4px;
		margin-bottom: 8px;
	}

	.aime-seo-actions {
		display: flex;
		gap: 8px;
		margin-top: 8px;
	}

	.aime-scores {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		margin-top: 12px;
	}

	.aime-score-item {
		text-align: center;
		padding: 10px;
		background: var(--aime-bg);
		border-radius: var(--aime-radius-sm);

		span {
			display: block;
			font-size: 11px;
			color: var(--aime-text-light);
			margin-bottom: 2px;
		}

		strong {
			font-size: 18px;
			color: var(--aime-primary);
		}
	}

	.aime-seo-result {
		margin-top: 12px;
		padding: 12px;
		background: var(--aime-bg);
		border-radius: var(--aime-radius-sm);

		h4 {
			margin: 0 0 8px;
			font-size: 13px;
		}
	}

	.aime-seo-issue {
		padding: 6px 8px;
		border-radius: 4px;
		font-size: 12px;
		margin-bottom: 6px;

		&.aime-seo-error {
			background: #fce4ec;
			color: #c62828;
		}

		&.aime-seo-warning {
			background: #fff8e1;
			color: #e65100;
		}

		&.aime-seo-info {
			background: #e3f2fd;
			color: #1565c0;
		}
	}

	.aime-seo-suggestion {
		font-size: 12px;
		color: var(--aime-text-light);
		margin: 4px 0;
	}
	
	.aime-seo-topic-map .components-base-control {
		margin-bottom: 0;
	}
	.aime-categories-field {
		margin-bottom: 12px;

		> label {
			display: block;
			font-size: 11px;
			font-weight: 500;
			text-transform: uppercase;
			margin-bottom: 6px;
			color: var(--aime-text-light);
		}
	}

	.aime-checkbox-list {
		max-height: 160px;
		overflow-y: auto;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		padding: 8px;
	}

	.aime-checkbox-item {
		display: flex;
		align-items: center;
		gap: 6px;
		padding: 3px 0;
		font-size: 13px;
		cursor: pointer;
	}

	.aime-version-list {
		display: flex;
		flex-direction: column;
		gap: 10px;
		margin-top: 4px;
	}

	.aime-version-row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 10px 14px;
		background: var(--aime-bg, #f8fafc);
		border: 1px solid var(--aime-border, #e2e8f0);
		border-radius: var(--aime-radius-sm, 6px);
		gap: 12px;
		transition: border-color 0.15s ease, box-shadow 0.15s ease;

		&:hover {
			border-color: var(--aime-primary, #3b82f6);
			box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
		}
	}

	.aime-version-meta {
		display: flex;
		flex-direction: column;
		gap: 3px;
		min-width: 0;
		flex: 1;
	}

	.aime-version-label {
		font-size: 13px;
		font-weight: 600;
		color: var(--aime-text, #1e293b);
		line-height: 1.3;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.aime-version-time {
		font-size: 11px;
		color: var(--aime-text-light, #64748b);
		line-height: 1.3;
	}

	.aime-version-btn {
		flex-shrink: 0;
	}
}

// ── Presets / Brand Voices card grid ──────────────────────
// Both pages show the same kind of object: a saved configuration with a name,
// a badge, some values, and edit/delete. One grid, one card shell, so the two
// tabs read as the same drawer of the same cabinet.
.aime-presets-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;

	// Cards carry a 20px bottom margin for stacked use; inside a gapped grid
	// that is a phantom gutter under every card, and it ragged the row.
	> .aime-card {
		margin-bottom: 0;
		display: flex;
		flex-direction: column;
	}

	// Body stretches so the action rail lands on the card floor. Without it the
	// footer rules sit at different heights across a row of unequal content.
	> .aime-card > .aime-card-body {
		display: flex;
		flex-direction: column;
		flex: 1;
	}
}

.aime-preset-card {
	.aime-preset-header {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 8px;
		margin-bottom: 10px;

		h3 {
			margin: 0;
			font-size: 15px;
			font-weight: 600;
			line-height: 1.35;
			color: var(--aime-text);
		}
	}

	.aime-badge-default {
		flex-shrink: 0;
		padding: 2px 8px;
		border-radius: 10px;
		font-size: 10px;
		font-weight: 600;
		letter-spacing: 0.04em;
		background: var(--aime-primary-light);
		color: var(--aime-primary);
		text-transform: uppercase;
	}

	// Preset values are single words (professional / blog_post / 1000) — chips
	// are honest here. Brand voice values are sentences and get rules instead.
	.aime-preset-details {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
		margin-bottom: 12px;

		> span {
			font-size: 12px;
			color: var(--aime-text-light);
			padding: 3px 8px;
			background: var(--aime-bg-subtle);
			border-radius: 4px;
		}
	}

	.aime-preset-template {
		font-size: 13px;
		color: var(--aime-text-light);
		margin: 0 0 12px;
		line-height: 1.5;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
	}

	.aime-preset-actions {
		display: flex;
		align-items: center;
		gap: 2px;
		margin-top: auto;
		padding-top: 12px;
		border-top: 1px solid var(--aime-border-light);

		.components-button.is-small {
			padding: 4px;
			min-width: auto;
		}
	}
}


/* .aime-preset-modal — replaced with aime-premium-modal pattern */

// ── Content Settings ──────────────────────────────────────
.aime-content-settings {
	max-width: 900px;

	> h2 {
		font-size: 20px;
		font-weight: 600;
		color: var(--aime-text);
		margin-bottom: 16px;
	}

	.aime-automation-toggles {
		display: flex;
		flex-direction: column;
		gap: 14px;
		max-width: 680px;
		margin-bottom: 24px;
	}

	.aime-toggle-card {
		padding: 16px 20px;
		background: var(--aime-card-bg, #ffffff);
		border: 1px solid var(--aime-border, #e2e8f0);
		border-radius: var(--aime-radius-sm, 8px);
		box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
		transition: border-color 0.15s ease, box-shadow 0.15s ease;

		&:hover {
			border-color: var(--aime-primary, #3b82f6);
			box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
		}

		.components-base-control {
			margin-bottom: 0 !important;
		}

		.components-toggle-control .components-base-control__field {
			margin-bottom: 0 !important;
		}

		.components-base-control__label {
			font-size: 14px;
			font-weight: 600;
			color: var(--aime-text, #1e293b);
		}

		.components-base-control__help {
			margin-top: 6px;
			margin-bottom: 0;
			font-size: 12.5px;
			color: var(--aime-text-muted, #64748b);
			line-height: 1.45;
		}
	}
}

// ── Shortcode info accordion (Conversations page) ─────────
.aime-shortcode-info {
	margin-top: 16px !important;
	margin-bottom: 0 !important;
	border-left: 4px solid var(--aime-primary, #3858e9) !important;
	background: #f0f4ff !important;

	.aime-shortcode-info__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		padding: 0;
		background: none;
		border: 0;
		cursor: pointer;
		text-align: left;
		color: #1e1e1e;

		&:hover .aime-shortcode-info__title {
			color: var(--aime-primary, #3858e9);
		}

		&:focus-visible {
			outline: 2px solid var(--aime-primary, #3858e9);
			outline-offset: 2px;
		}
	}

	.aime-shortcode-info__title {
		font-size: 14px;
		font-weight: 600;
	}

	.aime-shortcode-info__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		flex-wrap: wrap;
		margin-top: 12px;
		padding-top: 12px;
		border-top: 1px solid rgba(56, 88, 233, 0.15);
	}

	.aime-shortcode-info__text {
		flex: 1;
		min-width: 200px;

		strong {
			font-size: 14px;
		}

		p {
			font-size: 13px;
		}
	}

	.aime-shortcode-info__code {
		display: flex;
		align-items: center;
		gap: 8px;
		flex-shrink: 0;

		code {
			padding: 6px 12px;
			background: #fff;
			border: 1px solid #cbd5e0;
			border-radius: 4px;
			font-size: 13px;
			font-weight: 600;
			color: #2d3748;
			user-select: all;
		}
	}
}

// ── Conversations row actions overrides ───────────────────
.aime-conversations-list {
	.aime-row-actions {
		display: flex;
		gap: 2px;
		align-items: center;

		.components-button.is-small {
			padding: 4px;
			min-width: auto;
		}
	}

	.aime-btn-public {
		color: #22543d !important;
	}

	.aime-btn-hidden {
		color: #a0aec0 !important;
		opacity: 0.55;
	}
}

/* ── Global AI Notice (used across all modules) ── */
.aime-ai-notice {
	margin-top: 10px;
	padding: 8px 12px;
	background: #fff0f0;
	border-left: 4px solid #eb0000;
	color: #eb0000;
	font-size: 13px;
	border-radius: 4px;

	a {
		color: #1B5E20;
		font-weight: 600;
		text-decoration: underline;
	}
}

.aime-ai-quality-hint {
	margin-top: 10px;
	padding: 8px 12px;
	background: #f0f7ff;
	border-left: 4px solid #1976d2;
	color: #37474f;
	font-size: 12.5px;
	border-radius: 4px;
	line-height: 1.5;
}

// ── Reasoning-artifact notice (shown in the article editor Content card) ──
// Surfaces when AI content was generated by a model that emits unlabeled
// chain-of-thought (e.g. MiniMax M3 via custom provider) so the user knows
// the plugin auto-cleaned it and offers a one-click path to a cleaner model.
.aime-ai-thinking-hint {
	margin-top: 12px;
	padding: 12px 16px;
	background: var(--aime-info-light);
	border-left: 4px solid var(--aime-info);
	border-radius: 4px;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--aime-text);

	&__icon {
		font-size: 18px;
		line-height: 1.2;
		flex-shrink: 0;
	}

	&__body {
		flex: 1;
		min-width: 0;

		strong {
			display: block;
			margin-bottom: 4px;
			color: var(--aime-info);
		}

		p {
			margin: 4px 0;
			color: var(--aime-text-light);
		}
	}

	&__models {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		margin-top: 6px !important;
		font-size: 12.5px;

		a {
			color: var(--aime-primary);
			font-weight: 600;
			text-decoration: underline;
		}
	}

	&__dismiss {
		background: none;
		border: none;
		cursor: pointer;
		font-size: 20px;
		line-height: 1;
		color: var(--aime-text-light);
		padding: 0 4px;
		flex-shrink: 0;

		&:hover {
			color: var(--aime-text);
		}
	}
}

// ── Searchable Select (Select2-style) ─────────────────────
.aime-searchable-select {
	position: relative;

	&__trigger {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		min-height: 36px;
		padding: 6px 12px;
		background: #fff;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		font-size: 13px;
		color: var(--aime-text);
		cursor: pointer;
		text-align: left;

		&:hover { border-color: var(--aime-primary); }

		.aime-placeholder { color: var(--aime-text-light); }
	}

	&__arrow {
		margin-left: 8px;
		font-size: 11px;
		color: var(--aime-text-light);
	}

	&__dropdown {
		position: absolute;
		z-index: 100;
		top: 100%;
		left: 0;
		right: 0;
		margin-top: 2px;
		background: #fff;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	}

	&__search {
		display: block;
		width: 100%;
		padding: 8px 12px;
		border: none;
		border-bottom: 1px solid var(--aime-border);
		font-size: 13px;
		outline: none;
		box-sizing: border-box;

		&::placeholder { color: var(--aime-text-light); }
	}

	&__list {
		list-style: none;
		margin: 0;
		padding: 4px 0;
		max-height: 200px;
		overflow-y: auto;
	}

	&__item {
		padding: 7px 12px;
		font-size: 13px;
		cursor: pointer;
		color: var(--aime-text);

		&:hover { background: var(--aime-primary-light); }

		&--active {
			background: var(--aime-primary-light);
			font-weight: 600;
			color: var(--aime-primary);
		}

		&--clear {
			color: var(--aime-danger, #d32f2f);
			font-size: 12px;
			border-bottom: 1px solid var(--aime-border);
			margin-bottom: 2px;
		}
	}

	&__empty {
		color: var(--aime-text-light);
		font-style: italic;
		cursor: default;
		&:hover { background: none; }
	}
}

// Campaign ID column
.aime-id-cell {
	color: var(--aime-text-light);
	font-family: monospace;
	font-size: 12px;
}

// ── AI Tools: Copy button, Score badge, Best pick ─────────
.aime-code-block-wrap {
	position: relative;

	.aime-copy-btn {
		position: absolute;
		top: 6px;
		right: 6px;
		z-index: 2;
		padding: 4px 10px;
		font-size: 12px;
		background: var(--aime-primary);
		color: #fff;
		border: none;
		border-radius: var(--aime-radius-sm);
		cursor: pointer;
		transition: background 0.2s;

		&:hover { background: var(--aime-primary-hover); }
	}
}

.aime-score-badge {
	display: inline-block;
	padding: 2px 8px;
	background: var(--aime-primary);
	color: #fff;
	border-radius: 10px;
	font-weight: 600;
	font-size: 13px;
}

.aime-analysis-text {
	color: var(--aime-text-light);
	font-style: italic;
	margin: 6px 0;
}

.aime-subject-suggestions {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;

	li {
		padding: 6px 10px;
		border-left: 3px solid var(--aime-border);
		margin-bottom: 4px;
		font-size: 13px;

		&.aime-best-pick {
			border-left-color: var(--aime-primary);
			background: var(--aime-primary-light);
			font-weight: 600;
		}
	}
}

.aime-best-pick-badge {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 6px;
	background: var(--aime-primary);
	color: #fff;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	vertical-align: middle;
}

.aime-score-overview {
	margin-bottom: 10px;
}

.aime-score-big {
	font-size: 15px;
	margin-bottom: 6px;
}

.aime-score-breakdown {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	font-size: 13px;
	color: var(--aime-text-light);

	span {
		background: var(--aime-bg-alt, #f5f5f5);
		padding: 3px 8px;
		border-radius: var(--aime-radius-sm);
	}
}

// ── Spam Checker: verdict, word tags, severity ────────────
.aime-spam-header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.aime-verdict-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;

	&.aime-verdict--clean { background: #e8f5e9; color: #2e7d32; }
	&.aime-verdict--warning { background: #fff3e0; color: #e65100; }
	&.aime-verdict--risky { background: #fbe9e7; color: #d84315; }
	&.aime-verdict--spam { background: #ffebee; color: #c62828; }
}

.aime-spam-words {
	margin: 10px 0;
}

.aime-spam-word-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 6px 0 10px;
}

.aime-spam-word-tag {
	display: inline-block;
	padding: 3px 10px;
	background: #ffebee;
	color: #c62828;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 500;
}

.aime-rewrite-btn {
	margin-top: 4px !important;
}

.aime-spam-triggers {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;

	li {
		padding: 8px 10px;
		border-left: 3px solid var(--aime-border);
		margin-bottom: 4px;
		font-size: 13px;

		strong { display: block; margin-bottom: 2px; }
	}
}

.aime-severity {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	vertical-align: middle;

	&--low { background: #fff3e0; color: #e65100; }
	&--medium { background: #fbe9e7; color: #d84315; }
	&--high { background: #ffebee; color: #c62828; }
}

.aime-trigger-rec {
	display: block;
	font-size: 12px;
	color: var(--aime-text-light);
	margin-top: 2px;
	font-style: italic;
}

// ── Send Time Optimizer slots ─────────────────────────────
.aime-send-slots {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;

	li {
		padding: 4px 10px;
		border-left: 3px solid var(--aime-primary);
		margin-bottom: 4px;
		font-size: 13px;
	}
}

.aime-info-note {
	padding: 6px 10px;
	background: #e3f2fd;
	color: #1565c0;
	border-radius: var(--aime-radius-sm);
	font-size: 12px;
	margin-bottom: 8px;
}

// ============================================
// SMTP FAQ SECTION
// ============================================
.aime-smtp-faq {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--aime-border);

	h3 {
		font-size: 15px;
		font-weight: 600;
		margin: 0 0 16px;
		color: var(--aime-text);
	}
}

.aime-smtp-faq-item {
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-md);
	margin-bottom: 8px;
	background: var(--aime-bg-card, #fff);
	transition: box-shadow 0.15s ease;

	&[open] {
		box-shadow: var(--aime-shadow-sm);
	}

	summary {
		padding: 12px 16px;
		font-weight: 500;
		font-size: 13px;
		cursor: pointer;
		color: var(--aime-text);
		list-style: none;
		display: flex;
		align-items: center;
		gap: 8px;

		&::-webkit-details-marker {
			display: none;
		}

		&::before {
			content: '▸';
			font-size: 12px;
			transition: transform 0.15s ease;
			color: var(--aime-text-muted, #888);
		}

		&:hover {
			color: var(--aime-primary);
		}
	}

	&[open] summary::before {
		transform: rotate(90deg);
	}

	p {
		margin: 0;
		padding: 0 16px 14px;
		font-size: 13px;
		line-height: 1.6;
		color: var(--aime-text-muted, #555);
	}
}

// ============================================
// CUSTOM FIELDS INFO SECTION
// ============================================
.aime-cf-info {
	background: var(--aime-bg-card, #f9fafb);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-md);
	padding: 16px;
	margin-bottom: 16px;
}

.aime-cf-how-it-works {
	margin-top: 8px;
	font-size: 13px;

	strong {
		color: var(--aime-text);
	}

	ul {
		margin: 6px 0 0;
		padding-left: 20px;
		list-style: disc;
		color: var(--aime-text-muted, #555);

		li {
			margin-bottom: 4px;
			line-height: 1.5;
		}
	}
}

/* API Key */
.aime-api-key-display {
	margin-bottom: 8px;
}

.aime-api-key-notice {
	background: var(--aime-warning-light);
	border: 1px solid var(--aime-warning);
	border-radius: var(--aime-radius-sm, 6px);
	padding: 10px 14px;
	margin-bottom: 12px;
	color: var(--aime-warning-dark);
	font-size: 13px;
}

.aime-api-key-value {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--aime-bg-subtle);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius-sm, 6px);
	padding: 8px 12px;

	code {
		flex: 1;
		font-size: 13px;
		color: var(--aime-text);
		word-break: break-all;
		background: transparent;
		padding: 0;
	}
}

/* Settings — shared blocks */
.aime-settings-hint {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--aime-text-light);
}

.aime-settings-callout {
	margin-top: 16px;
	padding: 14px 16px;
	background: var(--aime-bg);
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	font-size: 13px;
	color: var(--aime-text-light);

	> :first-child { margin-top: 0; }
	> :last-child { margin-bottom: 0; }

	strong {
		color: var(--aime-text);
	}

	&.is-warning {
		background: var(--aime-warning-light);
		border-color: var(--aime-warning);
		color: var(--aime-warning-dark);

		strong { color: inherit; }
	}

	code {
		display: block;
		margin-top: 8px;
		padding: 10px 12px;
		background: var(--aime-white);
		border: 1px solid var(--aime-border-light);
		border-radius: var(--aime-radius-sm);
		font-size: 12px;
		white-space: normal;
		word-break: break-all;
		color: var(--aime-text);
	}
}

.aime-settings-code {
	margin: 8px 0 0;
	padding: 12px;
	background: var(--aime-bg-subtle);
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);
	overflow: auto;
	font-size: 12px;
	line-height: 1.6;
	color: var(--aime-text);
}

.aime-settings-btn-row {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.aime-cron-delay {
	margin-left: 8px;
	font-size: 12px;
	color: var(--aime-text-light);
}

/* ── Keyword Research: SEMrush-style ──────────────────────── */

.aime-kw-seed-card {
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: 8px;
	padding: 24px;
}

.aime-kw-seed-hero {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	margin-bottom: 20px;
}

.aime-kw-metrics-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 16px;
}

.aime-metric-card {
	background: var(--aime-bg);
	border-radius: 8px;
	padding: 14px 16px;

	&__label {
		font-size: 12px;
		text-transform: uppercase;
		letter-spacing: 0.5px;
		color: var(--aime-text-muted);
		margin-bottom: 6px;
		font-weight: 600;
	}

	&__value {
		font-size: 22px;
		font-weight: 700;
		line-height: 1.2;
	}

	&__sub {
		font-size: 11px;
		color: var(--aime-text-muted);
		margin-top: 2px;
	}
}

.aime-kd-gauge {
	&__bar {
		height: 6px;
		background: #e0e0e0;
		border-radius: 3px;
		overflow: hidden;
		margin-bottom: 6px;
	}

	&__fill {
		height: 100%;
		border-radius: 3px;
		transition: width 0.3s ease;
	}

	&__info {
		display: flex;
		align-items: baseline;
		gap: 8px;
	}
}

.aime-kw-summary-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 16px;
	padding: 16px;
	background: var(--aime-bg);
	border-radius: 8px;
	justify-content: center;
}

.aime-kw-summary-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 80px;
	flex: 1;

	&__num {
		font-size: 20px;
		font-weight: 700;
		line-height: 1.2;
	}

	&__label {
		font-size: 11px;
		text-transform: uppercase;
		letter-spacing: 0.5px;
		color: var(--aime-text-muted);
		margin-top: 4px;
	}
}

.aime-kw-result-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.aime-kw-result-tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--aime-border-light);
}

.aime-kw-result-tab {
	background: none;
	border: none;
	padding: 10px 18px;
	font-size: 13px;
	font-weight: 600;
	color: var(--aime-text-light);
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: all 0.15s;
	display: flex;
	align-items: center;
	gap: 6px;

	&:hover {
		color: var(--aime-primary);
	}

	&.is-active {
		color: var(--aime-primary);
		border-bottom-color: var(--aime-primary);
	}

	&__count {
		font-size: 11px;
		background: var(--aime-bg);
		padding: 1px 7px;
		border-radius: 10px;
		color: var(--aime-text-muted);
		font-weight: 500;
	}
}

.aime-intent-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.aime-cluster-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.aime-cluster-card {
	h4 { margin: 0 0 8px; }
}

.aime-tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.aime-tag {
	display: inline-block;
	padding: 3px 10px;
	font-size: 12px;
	border-radius: 4px;
	background: var(--aime-primary-light);
	color: var(--aime-primary);
	font-weight: 500;
}

.aime-status-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	text-transform: capitalize;
	background: #9e9e9e; // fallback

	&--active { background: #4caf50; }
	&--inactive { background: #9e9e9e; }
	&--closed { background: #757575; }
	&--human_takeover { background: #ff9800; }
	&--pending { background: #2196f3; }
	&--draft { background: #78909c; }
	&--published { background: #4caf50; }
	&--scheduled { background: #1565c0; }
	&--failed { background: #f44336; }
}

/* Bot cards grid (Chatbot Analytics) */
.aime-bot-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 14px;
}

.aime-bot-card {
	padding: 16px;
	background: var(--aime-bg, #f9f9f9);
	border: 1px solid var(--aime-border-light, #e8e8e8);
	border-radius: 10px;
	transition: box-shadow 0.15s ease;

	&:hover {
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	}

	&__header {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-bottom: 8px;
	}

	&__name {
		font-weight: 600;
		font-size: 14px;
		color: var(--aime-text, #1e1e1e);
		flex: 1;
	}

	&__meta {
		font-size: 12px;
		color: var(--aime-text-light, #888);
		margin-bottom: 10px;
		min-height: 18px;
	}

	&__actions {
		display: flex;
		gap: 12px;
		border-top: 1px solid var(--aime-border-light, #e8e8e8);
		padding-top: 10px;

		.components-button {
			font-size: 12px;
			padding: 0;
			min-height: auto;
			text-decoration: none;

			&:hover {
				text-decoration: underline;
			}
		}
	}
}

.aime-kw-table {
	@extend .aime-table;

	th {
		white-space: nowrap;
		cursor: pointer;
		user-select: none;
	}
}

.aime-kw-stat-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 80px;
	flex: 1;
	padding: 12px 8px;
	background: #fff;
	border-radius: 8px;
	border: 1px solid var(--aime-border-light, #e8e8e8);
	gap: 4px;
}

.aime-kw-stat-val {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
}

.aime-kw-stat-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--aime-text-muted, #888);
	text-align: center;
}

/* -- Content Brief Grid Layout -------------------------------- */
.aime-brief-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-top: 20px;

	&__full {
		grid-column: 1 / -1;
	}
	&__main {
		grid-column: 1 / -1;
		@media (min-width: 782px) {
			grid-column: 1 / 2;
		}
	}
	&__side {
		grid-column: 1 / -1;
		@media (min-width: 782px) {
			grid-column: span 1;
		}
	}

	@media (max-width: 782px) {
		grid-template-columns: 1fr;
	}

	// Ensure cards fill properly
	> .components-card,
	> [class*="aime-brief-grid__"] {
		min-width: 0;
	}
}

.aime-brief-seo-tips {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aime-brief-tip {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 13px;

	&__label {
		font-weight: 600;
		white-space: nowrap;
		min-width: 120px;
	}

	code {
		background: #f0f0f1;
		padding: 2px 6px;
		border-radius: 3px;
		font-size: 12px;
		word-break: break-all;
	}
}

/* -- SEO / GEO / AEO Guide ----------------------------------- */
.aime-seo-guide-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;

	@media (max-width: 900px) {
		grid-template-columns: 1fr;
	}
}

.aime-seo-guide-card {
	background: #fafafa;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px;

	&__icon {
		width: 40px;
		height: 40px;
		border-radius: 10px;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 20px;
		margin-bottom: 12px;
	}

	h5 {
		margin: 0 0 12px;
		font-size: 14px;
		font-weight: 700;
	}

	.aime-list {
		margin: 0;
		padding-left: 18px;

		li {
			font-size: 13px;
			color: #444;
			margin-bottom: 6px;
			line-height: 1.5;
		}
	}
}

/* ================================================================
   SVG CHART COMPONENTS
   ================================================================ */

/* Donut chart */
.aime-chart-donut-wrap {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.aime-chart-donut {
	transform: rotate(-90deg);
	flex-shrink: 0;
}

.aime-chart-donut text {
	transform: rotate(90deg);
	transform-origin: center;
}

.aime-chart-legend {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 120px;
}

.aime-chart-legend__item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
}

.aime-chart-legend__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.aime-chart-legend__label {
	color: #555;
	flex: 1;
}

.aime-chart-legend__val {
	font-weight: 600;
	color: #333;

	small {
		font-weight: 400;
		color: #888;
	}
}

/* Horizontal Bar Chart */
.aime-chart-hbar {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aime-chart-hbar__title {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	margin-bottom: 4px;
}

.aime-chart-hbar__row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.aime-chart-hbar__label {
	width: 120px;
	font-size: 12px;
	color: #555;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex-shrink: 0;
}

.aime-chart-hbar__track {
	flex: 1;
	background: #f0f0f1;
	border-radius: 4px;
	overflow: hidden;
	min-height: 22px;
}

.aime-chart-hbar__fill {
	border-radius: 4px;
	transition: width 0.4s ease;
	min-width: 2px;
}

.aime-chart-hbar__val {
	width: 60px;
	font-size: 12px;
	font-weight: 600;
	color: #333;
	text-align: right;
	flex-shrink: 0;
}

/* Radial Gauge */
.aime-chart-gauge {
	text-align: center;
}

/* Stacked Bar */
.aime-chart-stacked {
	display: flex;
	border-radius: 6px;
	overflow: hidden;
	background: #f0f0f1;
}

/* Analytics Layout Helpers */
.aime-analytics-gauges {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	padding: 20px;
	background: #f9f9f9;
	border-radius: 12px;
	border: 1px solid #e8e8e8;
}

.aime-analytics-charts-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 16px;

	&--1 {
		grid-template-columns: 1fr;
		max-width: 480px;
	}

	&--3 {
		grid-template-columns: repeat(3, 1fr);
	}

	@media (max-width: 768px) {
		grid-template-columns: 1fr;

		&--1, &--3 {
			grid-template-columns: 1fr;
		}
	}
}

/* Gap List Items */
.aime-gap-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aime-gap-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 10px 14px;
	background: #f9f9f9;
	border-radius: 8px;
	border: 1px solid #eee;
	font-size: 13px;
	line-height: 1.6;
}

.aime-gap-item__num {
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #1565c0;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
}

/* Strategy Timeline */
.aime-strategy-timeline {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding-left: 16px;
	border-left: 2px solid #e0e0e0;
}

.aime-strategy-step {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 12px 0;
	position: relative;
}

.aime-strategy-step__marker {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #1565c0;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
	margin-left: -30px;
}

.aime-strategy-step__text {
	font-size: 13px;
	line-height: 1.6;
	color: #333;
}

/* Competitor Strength Cards */
.aime-comp-strengths {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
}

.aime-comp-strength-card {
	padding: 16px;
	background: #f9f9f9;
	border-radius: 10px;
	border: 1px solid #eee;
}

.aime-comp-strength-card__domain {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 10px;
}

.aime-comp-strength-card__icon {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	color: #fff;
	font-weight: 700;
	font-size: 13px;
}

/* Title Suggestions */
.aime-title-suggestions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.aime-title-suggestion {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	background: #f9f9f9;
	border-radius: 8px;
	border: 1px solid #eee;
}

.aime-title-suggestion__rank {
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #1565c0;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
}

.aime-title-suggestion__text {
	flex: 1;
	font-size: 14px;
	font-weight: 500;
	color: #333;
}

.aime-title-suggestion__len {
	font-size: 11px;
	font-weight: 600;
	flex-shrink: 0;
}

/* Outline Visual */
.aime-outline-visual {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.aime-outline-item {
	padding: 10px 14px;
	border-left: 3px solid #1565c0;
	background: #f9f9f9;
	border-radius: 0 8px 8px 0;
}

.aime-outline-item__header {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
}

.aime-outline-item__level {
	padding: 1px 6px;
	font-size: 10px;
	font-weight: 700;
	background: #1565c0;
	color: #fff;
	border-radius: 3px;
	flex-shrink: 0;
}

.aime-outline-item__notes {
	font-size: 12px;
	color: #888;
	margin-top: 4px;
	padding-left: 42px;
}

.aime-outline-item__subs {
	margin-top: 8px;
	padding-left: 42px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.aime-outline-sub {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #555;
}

/* CTA Cards */
.aime-cta-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	background: #e8f5e9;
	border: 1px solid #c8e6c9;
	border-radius: 8px;
	font-size: 13px;
	color: #333;
}

.aime-cta-card__icon {
	font-size: 16px;
}

/* Tag Variants */
.aime-tag--primary {
	background: #1565c0 !important;
	color: #fff !important;
}

.aime-tag--accent {
	background: #ff9800 !important;
	color: #fff !important;
}

/* ── Settings Vertical Tab Layout ── */
.aime-settings-layout {
	display: flex;
	gap: 24px;
	margin-top: 16px;
}

.aime-settings-sidebar {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 200px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 10px;
	align-self: flex-start;
	position: sticky;
	top: 46px; // clears the admin bar (32px) with breathing room
	// The rail runs the height of the viewport rather than stopping under its
	// last tab — a five-item stub next to a long settings column reads as a
	// fragment of the page instead of its spine.
	min-height: calc(100vh - 140px);
}

.aime-settings-tab {
	position: relative;
	display: block;
	width: 100%;
	padding: 10px 14px;
	border: none;
	background: none;
	text-align: left;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--aime-text-light);
	border-radius: var(--aime-radius-sm);
	cursor: pointer;
	transition: background var(--aime-transition), color var(--aime-transition);

	&:hover {
		background: var(--aime-primary-light);
		color: var(--aime-primary);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 2px;
	}

	&.is-active {
		background: var(--aime-primary);
		color: var(--aime-white);
		font-weight: 600;
		box-shadow: 0 6px 14px rgba(var(--aime-primary-rgb), 0.24);
	}
}

.aime-settings-content {
	flex: 1;
	min-width: 0;
}

// The rail goes horizontal before it starts crushing the content column.
@media (max-width: 782px) {
	.aime-settings-layout {
		flex-direction: column;
	}

	.aime-settings-sidebar {
		position: static;
		flex-direction: row;
		flex-wrap: wrap;
		min-width: 0;
		min-height: 0;
	}

	.aime-settings-tab {
		width: auto;
	}
}

/* ── Log Viewer ── */
.aime-log-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;

	.components-base-control {
		margin-bottom: 0;
	}
}

.aime-log-count {
	margin-left: auto;
	font-size: 13px;
	color: var(--aime-text-muted);
}

.aime-log-table {
	font-size: 13px;

	td, th {
		padding: 8px 12px;
	}

	.aime-log-time {
		white-space: nowrap;
		font-size: 12px;
		color: var(--aime-text-light);
	}

	.aime-log-msg {
		word-break: break-word;
		max-width: 500px;
	}
}

.aime-log-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;

	&--info {
		background: var(--aime-info-light);
		color: var(--aime-info-dark);
	}

	&--warning {
		background: var(--aime-warning-light);
		color: var(--aime-warning-dark);
	}

	&--error {
		background: var(--aime-error-light);
		color: var(--aime-error-dark);
	}
}

.aime-log-level--error {
	background: var(--aime-error-light);
}

/* ── Image Generation Progress ── */
.aime-image-generating {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 16px;
}

.aime-image-progress-hint {
	font-size: 13px;
	color: #64748b;
	animation: aime-fade-in 0.3s ease;
}

@keyframes aime-fade-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

// ============================================
// WORKFLOW AUTOMATION — VISUAL BUILDER (.aime-wf-*)
// Patterned after .aime-flow-canvas / .aime-auto-node. All colors use the
// aime CSS variables so per-module accents and theme overrides (incl. dark
// variable sets) cascade automatically.
// ============================================

.aime-wf-builder {
	display: flex;
	flex-direction: column;
	gap: 12px;

	// The builder measures itself, not the window. Collapsing the module rail
	// hands this page 168px it did not have a moment ago, and a viewport query
	// cannot see that — it would keep the strip layout on a screen with room
	// for the rail, and it would promise three columns on a wide window whose
	// content box is narrow. Everything below reads this container instead.
	container: aime-wf / inline-size;

	// One height for the canvas and the config column. They were sized
	// independently before — the canvas off the viewport, the panel off a fixed
	// 480px floor — so the two columns ended at different places and, on a short
	// screen, the panel's own floor exceeded its own ceiling and it scrolled
	// inside a box taller than the window.
	--aime-wf-h: clamp(420px, calc(100vh - 330px), 860px);
}

.aime-wf-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 10px 14px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow);

	&__left,
	&__right {
		display: flex;
		align-items: center;
		gap: 8px;
		flex-wrap: wrap;
		min-width: 0;
	}

	&__left {
		flex: 1 1 260px;
	}

	&__right {
		flex-shrink: 0;
	}

	.components-base-control {
		margin-bottom: 0;
	}

	// When the builder itself is narrow the actions become their own row and the
	// name takes the full width, rather than four controls squeezing a title
	// field down to an ellipsis.
	@container aime-wf (max-width: 700px) {
		&__left,
		&__right {
			flex: 1 1 100%;
		}

		&__right {
			justify-content: flex-end;
		}
	}
}

#aime-app .aime-log-toolbar .components-base-control,
#aime-app .aime-wf-topbar__right .components-base-control,
#aime-app .aime-seo-topic-map .components-base-control {
	margin-bottom: 0;
}
#aime-app .components-toggle-control {
	margin-bottom: 14px;
}
#aime-app .aime-toggle-stack .components-base-control {
	margin-bottom: 0;
}
.aime-wf-name-input {
	border: 1px solid transparent;
	border-radius: var(--aime-radius-sm);
	background: transparent;
	color: var(--aime-text);
	font-size: 16px;
	font-weight: 600;
	padding: 4px 8px;
	min-width: 0;
	flex: 1 1 200px;
	max-width: 320px;

	&:hover {
		border-color: var(--aime-border);
	}

	&:focus {
		border-color: var(--aime-primary);
		background: var(--aime-white);
		box-shadow: var(--aime-focus-ring);
		outline: none;
	}
}

.aime-wf-dirty-dot {
	color: var(--aime-warning);
	font-size: 11px;
}

// Three organs in one frame: the source you add from, the thing you are
// building, the properties of what you selected. Left → centre → right is the
// order every builder reads in, so the palette becomes a rail as soon as there
// is width for one — and folds back to a strip above the canvas when there is
// not, rather than starving the canvas to keep a shape.
.aime-wf-layout {
	display: grid;
	gap: 12px;
	grid-template-columns: minmax(0, 1fr) 320px;
	grid-template-areas:
		"palette palette"
		"canvas  config";
	align-items: stretch;

	> .aime-wf-palette { grid-area: palette; }
	> .aime-wf-canvas { grid-area: canvas; }
	> .aime-wf-config { grid-area: config; }

	// Thresholds are content widths now, not window widths. 1060px is where a
	// 200px rail and a 320px panel still leave the canvas ~500px — the canvas
	// is the reason the page exists, so it sets the floor. Browsers without
	// container query support keep the two-column default below, which is a
	// working layout rather than a broken one.
	@container aime-wf (min-width: 1060px) {
		grid-template-columns: 200px minmax(0, 1fr) 320px;
		grid-template-areas: "palette canvas config";
	}

	@container aime-wf (max-width: 860px) {
		grid-template-columns: minmax(0, 1fr) 280px;
	}

	// Stacked: the canvas keeps a workable height, the panel stops being a
	// scroller of its own and simply extends the page. Two nested scrollbars on
	// one narrow screen is one more than anybody can aim at.
	@container aime-wf (max-width: 700px) {
		grid-template-columns: 1fr;
		grid-template-areas:
			"palette"
			"canvas"
			"config";

		.aime-wf-canvas {
			height: clamp(360px, 55vh, 520px);
		}

		.aime-wf-config {
			height: auto;
			max-height: none;
			overflow-y: visible;
		}
	}
}

// Canvas wrapper
.aime-wf-canvas {
	position: relative;
	height: var(--aime-wf-h);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-bg);
	overflow: hidden;

	.react-flow {
		width: 100%;
		height: 100%;
	}

	.react-flow__background {
		background: var(--aime-bg);
	}
}

// Node cards
.aime-wf-node {
	position: relative;
	padding: 10px 14px;
	background: var(--aime-white);
	border: 2px solid var(--aime-border);
	border-radius: var(--aime-radius);
	display: flex;
	gap: 10px;
	align-items: center;
	min-width: 190px;
	max-width: 260px;
	cursor: pointer;
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow);
	}

	&.is-selected {
		border-color: var(--aime-primary);
		box-shadow: 0 0 0 3px var(--aime-primary-light);
	}
}

.aime-wf-node--trigger {
	border-color: var(--aime-success);
	background: var(--aime-success-light);
}

.aime-wf-node--condition {
	border-color: var(--aime-warning);
	background: var(--aime-warning-light);
	padding-bottom: 22px;
}

.aime-wf-node--invalid {
	border-color: var(--aime-danger, #c62828) !important;
	background: rgba(198, 40, 40, 0.06) !important;

	.aime-wf-node__summary {
		color: var(--aime-danger, #c62828);
		font-weight: 500;
	}
}

.aime-wf-node__icon {
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
}

.aime-wf-node__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;

	strong {
		font-size: 13px;
		color: var(--aime-text);
	}
}

.aime-wf-node__summary {
	font-size: 11px;
	color: var(--aime-text-light);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 180px;
}

.aime-wf-node__badge {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;

	&--invalid {
		background: var(--aime-danger, #c62828);
		color: var(--aime-white);
	}
}

// Run-status ring overlays (Run Now polling)
.aime-wf-node--run-pending {
	opacity: 0.65;
}

.aime-wf-node--run-running {
	border-color: var(--aime-info);
	box-shadow: 0 0 0 3px var(--aime-info-light);
	animation: aime-wf-pulse 1.4s ease-in-out infinite;
}

.aime-wf-node--run-success {
	border-color: var(--aime-success);
	box-shadow: 0 0 0 3px var(--aime-success-light);
}

.aime-wf-node--run-failed {
	border-color: var(--aime-danger, #c62828);
	box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

.aime-wf-node--run-skipped {
	opacity: 0.5;
}

@keyframes aime-wf-pulse {
	0%, 100% { box-shadow: 0 0 0 3px var(--aime-info-light); }
	50% { box-shadow: 0 0 0 6px var(--aime-info-light); }
}

// Condition yes/no handles + labels
.aime-wf-handle-yes {
	background: var(--aime-success) !important;
}

.aime-wf-handle-no {
	background: var(--aime-danger, #c62828) !important;
}

.aime-wf-branch-label {
	position: absolute;
	bottom: 4px;
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;

	&--yes {
		left: 22%;
		color: var(--aime-success);
	}

	&--no {
		right: 22%;
		color: var(--aime-danger, #c62828);
	}
}

// Palette (left column)
// Horizontal step palette above the canvas
.aime-wf-palette {
	display: flex;
	align-items: stretch;
	gap: 16px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 10px 14px;

	&__intro {
		flex-shrink: 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
		padding-right: 16px;
		border-right: 1px solid var(--aime-border);
		max-width: 150px;
	}

	&__title {
		margin: 0 0 2px;
		font-size: 14px;
		color: var(--aime-text);
	}

	&__hint {
		margin: 0;
		font-size: 11px;
		line-height: 1.3;
		color: var(--aime-text-muted);
	}

	&__groups {
		display: flex;
		align-items: stretch;
		gap: 16px;
		overflow-x: auto;
		flex: 1;
		min-width: 0;
		padding-bottom: 2px;
		// The default admin scrollbar is a 16px slab under a 34px row of chips.
		// It reads as a second UI element rather than as a hint that the strip
		// continues.
		scrollbar-width: thin;
		scrollbar-color: var(--aime-border) transparent;

		&::-webkit-scrollbar {
			height: 6px;
		}

		&::-webkit-scrollbar-track {
			background: transparent;
		}

		&::-webkit-scrollbar-thumb {
			background: var(--aime-border);
			border-radius: 3px;
		}

		&:hover::-webkit-scrollbar-thumb {
			background: var(--aime-text-muted);
		}
	}

	&__group {
		flex-shrink: 0;

		& + & {
			padding-left: 16px;
			border-left: 1px dashed var(--aime-border);
		}
	}

	&__group-label {
		font-size: 10px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--aime-text-muted);
		margin-bottom: 6px;
		white-space: nowrap;
	}

	&__group-items {
		display: flex;
		gap: 6px;
	}

	&__item {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 32px;
		padding: 6px 10px;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm);
		background: var(--aime-white);
		color: var(--aime-text);
		font-size: 12px;
		white-space: nowrap;
		cursor: grab;
		transition: border-color var(--aime-transition), background var(--aime-transition),
			box-shadow var(--aime-transition);

		&:hover {
			border-color: var(--aime-primary);
			background: var(--aime-primary-light);
		}

		&:focus-visible {
			outline: 2px solid var(--aime-primary);
			outline-offset: 2px;
		}

		&:active {
			cursor: grabbing;
			box-shadow: var(--aime-shadow);
		}

		&.is-unavailable {
			opacity: 0.45;
			cursor: not-allowed;
		}

		&.is-locked {
			cursor: pointer;
			opacity: 0.75;
		}
	}

	&__icon {
		font-size: 15px;
		line-height: 1;
	}

	&__label {
		overflow: hidden;
		text-overflow: ellipsis;
	}

	@container aime-wf (max-width: 700px) {
		flex-direction: column;
		gap: 10px;

		&__intro {
			border-right: 0;
			border-bottom: 1px solid var(--aime-border);
			padding-right: 0;
			padding-bottom: 8px;
			max-width: none;
		}
	}
}

// Rail form. The horizontal strip put every step behind a sideways scroll —
// the reader had to drag a scrollbar to find out what steps even exist. Stacked
// vertically there is room for all of them at once, the module names read as
// section headings instead of a dashed band, and the canvas gets back the
// ~90px of height the strip was spending.
@container aime-wf (min-width: 1060px) {
	.aime-wf-palette {
		flex-direction: column;
		align-items: stretch;
		height: var(--aime-wf-h);
		gap: 0;
		padding: 20px;
		box-shadow: var(--aime-shadow-md);
	}

	.aime-wf-palette__intro {
		border-right: 0;
		border-bottom: 1px solid var(--aime-border-light);
		padding-right: 0;
		padding-bottom: 16px;
		margin-bottom: 16px;
		max-width: none;
	}

	.aime-wf-palette__title {
		font-size: 13px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: var(--aime-text);
		margin-bottom: 4px;
	}

	.aime-wf-palette__help {
		font-size: 12px;
		line-height: 1.4;
		color: var(--aime-text-muted);
	}

	.aime-wf-palette__groups {
		flex-direction: column;
		align-items: stretch;
		gap: 20px;
		overflow-x: hidden;
		overflow-y: auto;
		padding-bottom: 0;
	}

	.aime-wf-palette__group + .aime-wf-palette__group {
		padding-left: 0;
		padding-top: 20px;
		border-left: 0;
		border-top: 1px solid var(--aime-border-light);
	}

	.aime-wf-palette__group-label {
		font-size: 11px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.06em;
		color: var(--aime-text-light);
		margin-bottom: 10px;
	}

	.aime-wf-palette__group-items {
		flex-direction: column;
		gap: 6px;
	}

	// Full-width targets that wrap: "Create Email Campaign (Draft)" is a real
	// label and truncating it to fit a chip would cost the reader the meaning.
	.aime-wf-palette__item {
		width: 100%;
		justify-content: flex-start;
		white-space: normal;
		text-align: left;
		line-height: 1.4;
		padding: 10px 12px;
		font-size: 13px;
		border-radius: var(--aime-radius-sm);
		transition: all var(--aime-transition-fast);

		&:hover {
			background: var(--aime-primary-light);
			border-color: var(--aime-primary);
			transform: translateX(2px);
			box-shadow: var(--aime-shadow);
		}

		&:active {
			transform: translateX(1px);
		}
	}

	.aime-wf-palette__icon {
		font-size: 16px;
		flex-shrink: 0;
	}
}

// Config panel (right column)
.aime-wf-config {
	display: flex;
	flex-direction: column;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	padding: 20px;
	overflow-y: auto;
	overscroll-behavior: contain;
	height: var(--aime-wf-h);
	min-height: 0;
	box-shadow: var(--aime-shadow-md);

	// Sits above __head. Styled explicitly rather than leaning on WP's is-link,
	// which renders at 11px in an undefined admin-theme colour here.
	&__back {
		align-self: flex-start;
		flex: 0 0 auto;
		height: auto;
		min-height: 0;
		margin: 0 0 14px;
		padding: 0;
		background: none;
		border: 0;
		font-size: 13px;
		font-weight: 600;
		line-height: 1.4;
		color: var(--aime-text-muted);
		text-decoration: none;
		cursor: pointer;
		transition: color var(--aime-transition);

		&:hover:not(:disabled),
		&:focus:not(:disabled) {
			color: var(--aime-primary);
		}
	}

	&__head {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 12px;
		margin-bottom: 16px;
		padding-bottom: 16px;
		border-bottom: 1px solid var(--aime-border-light);
		// The panel scrolls; its own header should not scroll away from the
		// field the reader is editing.
		position: sticky;
		z-index: 2;
		background: var(--aime-white);
		// Default: the head is the first thing in the panel, so it pulls up
		// over the panel's own 20px padding and sticks flush to the top.
		top: -20px;
		padding-top: 20px;
		margin-top: -20px;

		// When a back link precedes it, that negative pull dragged the opaque
		// header up over the link and hid it. Nothing to reclaim in that case.
		&:not(:first-child) {
			top: 0;
			padding-top: 0;
			margin-top: 0;
		}
	}

	&__title {
		margin: 0;
		font-size: 16px;
		font-weight: 600;
		color: var(--aime-text);
		line-height: 1.3;
	}

	&__desc {
		font-size: 13px;
		line-height: 1.5;
		color: var(--aime-text-light);
		margin: 0 0 16px;
	}

	&__hint {
		font-size: 12px;
		color: var(--aime-text-muted);
		margin-top: 16px;
		padding: 12px;
		background: var(--aime-bg-subtle);
		border-radius: var(--aime-radius-sm);
		border-left: 3px solid var(--aime-primary-light);
	}

	.aime-wf-trigger-group {
		margin-bottom: 20px;

		.components-base-control {
			margin-bottom: 8px;

			&:last-child {
				margin-bottom: 0;
			}
		}
	}

	.aime-wf-trigger-desc {
		font-size: 12px;
		line-height: 1.5;
		color: var(--aime-text-light);
		margin: 0;
		padding: 8px 12px;
		background: var(--aime-bg-subtle);
		border-radius: var(--aime-radius-sm);
		border-left: 3px solid var(--aime-accent, #2E7D32);
	}

	// Add spacing between form fields
	.components-base-control {
		margin-bottom: 20px;

		&:last-child {
			margin-bottom: 0;
		}
	}

	// Improve notice styling within config panel
	.aime-notice {
		margin-bottom: 16px;
	}

	// RangeControl's companion number input is too narrow for 4-digit
	// values (e.g. word count 1200 renders clipped as "120").
	.components-range-control__number,
	.components-range-control .components-input-control__container,
	.components-range-control .components-number-control {
		min-width: 70px;
	}

	.components-range-control .components-input-control__input {
		min-width: 70px;
		padding-right: 4px;
	}
}

// Prompt textarea with the "Prompt library" browse button. Own header row
// replaces TextareaControl's label so the button can sit right-aligned.
.aime-wf-promptfield {
	&__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		margin-bottom: 8px;
	}

	&__label {
		font-size: 11px;
		font-weight: 500;
		color: var(--aime-text);
		text-transform: uppercase;
		letter-spacing: 0.4px;
	}

	&__browse {
		height: auto;
		min-height: 0;
		padding: 3px 10px;
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm, 4px);
		background: var(--aime-white);
		font-size: 12px;
		font-weight: 600;
		line-height: 1.6;
		color: var(--aime-primary);
		cursor: pointer;
		transition:
			border-color var(--aime-transition, 0.15s),
			background var(--aime-transition, 0.15s);

		&:hover:not(:disabled),
		&:focus-visible:not(:disabled) {
			border-color: var(--aime-primary);
			background: var(--aime-bg-subtle);
		}

		&:disabled {
			opacity: 0.5;
			cursor: not-allowed;
		}
	}
}

// Clickable {token} chips under token-capable workflow fields.
.aime-wf-tokens {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	// Sits outside the .components-base-control rhythm, so it must carry its
	// own spacing on both sides — otherwise the next field crowds it.
	margin-top: 8px;
	margin-bottom: 18px;

	&__label {
		font-size: 11px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.4px;
		color: var(--aime-text-light);
		margin-right: 2px;
	}

	&__chip {
		height: auto;
		min-height: 0;
		padding: 2px 8px;
		border: 1px solid var(--aime-border);
		border-radius: 999px;
		background: var(--aime-bg-subtle);
		font-family: var(--aime-mono, monospace);
		font-size: 11.5px;
		line-height: 1.5;
		color: var(--aime-text-muted);
		cursor: pointer;
		transition:
			color var(--aime-transition, 0.15s),
			border-color var(--aime-transition, 0.15s),
			background var(--aime-transition, 0.15s);

		&:hover,
		&:focus-visible {
			border-color: var(--aime-primary);
			background: var(--aime-white);
			color: var(--aime-primary);
			outline: none;
		}
	}
}

// Prompt library modal — searchable list of pre-made prompt cards.
.aime-wf-promptlib {
	max-width: 560px;

	.components-modal__content {
		padding: 0 32px 28px;
	}

	&__intro {
		margin: 0 0 14px;
		font-size: 13px;
		line-height: 1.5;
		color: var(--aime-text-muted);
	}

	&__search {
		margin-bottom: 16px;
	}

	&__list {
		max-height: 46vh;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding-right: 4px;
	}

	&__group {
		margin: 18px 0 10px;
		font-size: 11px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.5px;
		color: var(--aime-text-light);

		&:first-child {
			margin-top: 0;
		}
	}

	&__card {
		display: block;
		width: 100%;
		margin-bottom: 10px;
		padding: 12px 14px;
		text-align: left;
		background: var(--aime-white);
		border: 1px solid var(--aime-border);
		border-radius: var(--aime-radius-sm, 4px);
		cursor: pointer;
		transition:
			border-color var(--aime-transition, 0.15s),
			box-shadow var(--aime-transition, 0.15s);

		&:hover,
		&:focus-visible {
			border-color: var(--aime-primary);
			box-shadow: var(--aime-shadow-md, 0 2px 8px rgba(0, 0, 0, 0.08));
			outline: none;
		}
	}

	&__card-title {
		display: block;
		margin-bottom: 4px;
		font-size: 13px;
		font-weight: 600;
		color: var(--aime-text);
	}

	&__card-text {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		font-size: 12.5px;
		line-height: 1.5;
		color: var(--aime-text-muted);
	}

	&__empty {
		margin: 24px 0;
		text-align: center;
		font-size: 13px;
		color: var(--aime-text-muted);
	}
}

// Two fields side by side is right when the panel runs the page width, and
// wrong in a 300px rail — there it is not a two-column form, it is two
// truncated ones. Single column is therefore the default, not the exception.
.aime-wf-field-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;

	@container aime-wf (max-width: 700px) {
		grid-template-columns: 1fr 1fr;
	}
}

.aime-wf-weekdays {
	margin: 8px 0;

	&__label {
		display: block;
		margin-bottom: 6px;
		font-weight: 600;
		font-size: 12px;
		color: var(--aime-text);
	}

	&__chips {
		display: flex;
		gap: 6px;
		flex-wrap: wrap;
	}
}

.aime-wf-chip {
	padding: 4px 10px;
	border-radius: 14px;
	border: 1px solid var(--aime-border);
	background: var(--aime-white);
	color: var(--aime-text);
	cursor: pointer;
	font-size: 12px;
	transition: all var(--aime-transition);

	&.is-active {
		background: var(--aime-primary);
		border-color: var(--aime-primary);
		color: var(--aime-white);
	}
}

// Template picker cards
.aime-wf-template-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
}

.aime-wf-template-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 16px;
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	background: var(--aime-white);
	color: var(--aime-text);
	text-align: left;
	cursor: pointer;
	transition: border-color var(--aime-transition), box-shadow var(--aime-transition);

	&:hover {
		border-color: var(--aime-primary);
		box-shadow: var(--aime-shadow-md);
	}

	&--blank {
		border-style: dashed;
	}

	&.is-unavailable {
		opacity: 0.5;
	}

	strong {
		display: flex;
		align-items: center;
		gap: 6px;
		font-size: 14px;
	}
}

.aime-wf-template-card__icon {
	font-size: 24px;
	line-height: 1;
}

.aime-wf-template-card__desc {
	font-size: 12px;
	color: var(--aime-text-light);
}

.aime-wf-template-card__meta {
	font-size: 11px;
	color: var(--aime-text-muted);
}

// Run-status chip (workflow list) + branch chip (history)
.aime-wf-run-chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	background: var(--aime-bg-subtle);
	color: var(--aime-text-light);

	&--queued,
	&--running {
		background: var(--aime-info-light);
		color: var(--aime-info);
	}

	&--success {
		background: var(--aime-success-light);
		color: var(--aime-success);
	}

	&--partial {
		background: var(--aime-warning-light);
		color: var(--aime-warning);
	}

	&--failed {
		background: rgba(198, 40, 40, 0.1);
		color: var(--aime-danger, #c62828);
	}
}

.aime-wf-branch-chip {
	display: inline-flex;
	margin-left: 8px;
	padding: 1px 6px;
	border-radius: 8px;
	font-size: 10px;
	font-weight: 600;
	background: var(--aime-warning-light);
	color: var(--aime-warning);
}

.aime-wf-settings {
	margin-top: 20px;
	max-width: 560px;
}

/* Inline icons in the Featured Image tab nav (replaces emoji glyphs). */
.aime-image-tabs__icon {
	display: inline-flex;
	align-items: center;
	margin-right: 6px;
	vertical-align: -3px;
}

/* Free-plan step counter in the workflow builder topbar. */
.aime-wf-step-meter {
	display: inline-flex;
	align-items: center;
	margin-left: 10px;
	padding: 2px 8px;
	border-radius: 3px;
	background: #f0f6fc;
	border: 1px solid #c5d9ed;
	font-size: 11px;
	color: #1d2327;
	white-space: nowrap;
}

/* AI Autopilot button */
.aime-btn-ai-autopilot {
	background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
	color: #ffffff !important;
	border: none !important;
	font-weight: 600 !important;
	box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease !important;

	&:hover:not(:disabled) {
		background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%) !important;
		box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35) !important;
		transform: translateY(-1px);
	}

	&:active:not(:disabled) {
		transform: translateY(0);
	}
}

/* AI Template Card in TemplatePicker */
.aime-wf-template-card--ai {
	border-color: #8b5cf6 !important;
	background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%) !important;
	position: relative;
	overflow: hidden;

	strong {
		color: #6d28d9 !important;
	}

	&::after {
		content: 'AI';
		position: absolute;
		top: 10px;
		right: 12px;
		background: #ede9fe;
		color: #7c3aed;
		font-size: 10px;
		font-weight: 700;
		padding: 2px 6px;
		border-radius: 4px;
		letter-spacing: 0.5px;
	}

	&:hover {
		border-color: #7c3aed !important;
		box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18) !important;
	}
}

/* AI Workflow Modal */
.aime-ai-wf-modal {
	max-width: 680px;

	.components-modal__content {
		padding: 0 28px 24px;
	}

	&__body {
		display: flex;
		flex-direction: column;
		gap: 4px;
	}

	&__subtitle {
		margin: 0 0 16px;
		font-size: 13px;
		line-height: 1.5;
		color: var(--aime-text-muted, #64748b);
	}

	&__section {
		display: flex;
		flex-direction: column;
		gap: 6px;
	}

	&__label {
		font-size: 12px;
		font-weight: 600;
		color: var(--aime-text, #1e293b);
	}

	.aime-ai-wf-recipes {
		display: flex;
		flex-direction: column;
		gap: 6px;
		max-height: 210px;
		overflow-y: auto;
		padding: 4px 2px;
	}

	.aime-ai-wf-recipe-chip {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
		padding: 8px 12px;
		border: 1px solid var(--aime-border, #e2e8f0);
		border-radius: 6px;
		background: #ffffff;
		text-align: left;
		cursor: pointer;
		font-size: 12.5px;
		transition: all 0.15s ease;

		&:hover {
			border-color: #a78bfa;
			background: #fdfcff;
			transform: translateX(2px);
		}

		&.is-selected {
			border-color: #7c3aed;
			background: #f5f3ff;
			box-shadow: 0 0 0 1px #7c3aed;
		}

		&__icon {
			font-size: 16px;
			line-height: 1;
			flex-shrink: 0;
		}

		&__text {
			flex: 1;
			font-weight: 600;
			color: var(--aime-text, #1e293b);
		}

		&__badge {
			font-size: 10.5px;
			font-weight: 500;
			padding: 2px 7px;
			border-radius: 4px;
			background: #f1f5f9;
			color: #475569;
			flex-shrink: 0;
		}
	}

	.aime-ai-wf-modal__textarea {
		margin-bottom: 0;

		textarea {
			min-height: 90px;
			font-size: 13px;
			line-height: 1.5;
			border-radius: 6px;
			border-color: var(--aime-border, #cbd5e1);

			&:focus {
				border-color: #7c3aed;
				box-shadow: 0 0 0 1px #7c3aed;
			}
		}
	}

	.aime-ai-wf-guide {
		margin-top: 8px;
		padding: 10px 12px;
		background: #f8fafc;
		border: 1px solid #e2e8f0;
		border-radius: 6px;
		font-size: 11.5px;
		line-height: 1.45;
		display: flex;
		flex-direction: column;
		gap: 6px;

		&__row {
			display: flex;
			align-items: center;
			gap: 8px;
			flex-wrap: wrap;
		}

		&__tag {
			font-weight: 600;
			color: #475569;
			background: #e2e8f0;
			padding: 1px 6px;
			border-radius: 4px;
			font-size: 11px;
		}

		&__formula {
			font-family: monospace;
			font-size: 11.5px;
			color: #0f766e;
			background: #f0fdfa;
			padding: 2px 6px;
			border-radius: 4px;
			border: 1px solid #ccfbf1;
		}

		&__grid {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 8px;
			padding-top: 4px;
			border-top: 1px dashed #e2e8f0;

			@media (max-width: 600px) {
				grid-template-columns: 1fr;
			}
		}

		&__item {
			display: flex;
			flex-direction: column;
			gap: 2px;
		}

		&__item-title {
			font-weight: 600;
			color: #334155;
			font-size: 11px;
		}

		&__item-desc {
			color: #64748b;
			font-size: 11px;
		}

		&__hint {
			margin-top: 2px;
			font-size: 11px;
			color: #854d0e;
			background: #fefce8;
			border: 1px solid #fef08a;
			padding: 4px 8px;
			border-radius: 4px;
		}
	}

	&__status {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 10px 14px;
		margin-top: 12px;
		border-radius: 6px;
		background: #f5f3ff;
		border: 1px solid #ddd6fe;
		color: #6d28d9;
		font-size: 12.5px;
		font-weight: 500;
	}

	&__spinner {
		width: 16px;
		height: 16px;
		border: 2px solid #ddd6fe;
		border-top-color: #7c3aed;
		border-radius: 50%;
		animation: aime-spin 0.8s linear infinite;
		flex-shrink: 0;
	}
}

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

// ── AI Usage & Cost panel (AI Providers → Usage & Cost) ───
//
// Two organs, one card: a meter of four totals sitting on the card's inset
// floor, and the ledger that explains them below it. The split is a hairline,
// not a shadow, and the card body loses its own padding so each organ can own
// its edge — a stat rail that stops 20px short of the card edge reads as a
// widget parked inside a card rather than as the top of it.
.aime-usage-panel {
	> .aime-card-body {
		padding: 0;
	}
}

// The 1px grid gap over a hairline background is what draws the rules between
// stats: it survives wrapping at any column count, which border-left does not.
// auto-fit, not auto-fill — an unfilled track would keep its width and leave a
// bare strip of the hairline background parked at the end of the rail.
.aime-usage-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 1px;
	background: var(--aime-border-light);
	border-bottom: 1px solid var(--aime-border);
}

.aime-usage-stat {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 20px;
	background: var(--aime-white);
}

// 32/700 because the user came here to read a number, not the card title.
// tabular-nums so 140,908 and 139 hang off the same left edge when the grid
// reflows and two values end up stacked.
.aime-usage-stat__value {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}

.aime-usage-stat__label {
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--aime-text-light);
}

.aime-usage-stat__note {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-muted);
}

// A partial estimate says so in the number itself; the label says why.
.aime-usage-stat__partial {
	margin-left: 1px;
	font-size: 0.55em;
	vertical-align: super;
	color: var(--aime-text-muted);
}

// Failures are the one status this panel can report, so they are the one place
// it is allowed to spend color. Zero failures stays ink — a red 0 would train
// the eye to ignore the cell that matters.
.aime-usage-stat.is-error {
	.aime-usage-stat__value {
		color: var(--aime-error);
	}

	.aime-usage-stat__note {
		color: var(--aime-error);
	}
}

.aime-usage-panel .aime-table-wrap {
	padding: 4px 8px 8px;
}

.aime-usage-table {
	font-variant-numeric: tabular-nums;

	th,
	td {
		padding: 10px 12px;
	}

	// Right-aligned so the digits of every row line up in a column the eye can
	// compare down, with the header sitting over the last digit, not the first.
	.is-numeric {
		text-align: right;
		white-space: nowrap;
	}

	tbody tr:last-child td {
		border-bottom: 0;
	}
}

.aime-usage-table__conn {
	font-weight: 600;
	color: var(--aime-text);
}

.aime-usage-table__model {
	color: var(--aime-text);
	word-break: break-word;
}

.aime-usage-table__slash {
	color: var(--aime-text-muted);
}

// Per-row failures ride under the call count instead of taking a column: the
// total above already reports them, and this is the row that says where.
.aime-usage-table__failed {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-error);
}

// An em dash in a money column reads as zero unless it is visibly not a number.
.aime-usage-table__unpriced {
	color: var(--aime-text-muted);
}

.aime-usage-task {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 6px;
	background: var(--aime-bg-subtle);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-light);
}

.aime-usage-footnote {
	margin: 0;
	padding: 0 20px 20px;
	max-width: 78ch;
	font-size: 12px;
	color: var(--aime-text-light);
}

/* Usage table */
.aime-usage-table {
	font-size: 13px;
	width: 100%;

	&__tokens {
		.is-numeric {
			display: flex;
			gap: 12px;
		}
	}

	&__failed {
		display: flex;
		align-items: center;
		gap: 4px;
		font-size: 11px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: var(--aime-error-dark);
	}
}

.aime-usage-task {
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--aime-text);
	background: var(--aime-bg-subtle);
	border: 1px solid var(--aime-border-light);
}

@media (max-width: 782px) {
	.aime-usage-stat {
		padding: 16px;
	}

	.aime-usage-stat__value {
		font-size: 26px;
	}
}

// ============================================
// DIALOG SYSTEM — WORDPRESS-NATIVE MODALS
//
// Two dialogs in the plugin (Add/Edit AI Provider, Add/Edit SMTP Connection)
// are `@wordpress/components` <Modal>s rather than the hand-rolled
// `.aime-premium-modal` shell, and they were arriving in WordPress's own
// chrome: 4px corners, a neutral-black scrim, a square close glyph, no
// entrance. Same product, two dialog languages. This block puts them on the
// shared one — 16px frame, ink-tinted scrim, round close button, the same
// arrival — without replacing the component, so focus trapping, Escape and
// the aria wiring keep coming from WordPress.
//
// Selectors are unscoped by design: <Modal> portals to <body>, outside
// #aime-app, so they key on the plugin's own modal class names instead and
// cannot reach the block editor's modals.
// ============================================

.aime-modal-overlay.components-modal__screen-overlay {
	background-color: var(--aime-overlay);
	backdrop-filter: blur(4px);
	animation: aime-overlay-in 0.18s ease-out;
}

.components-modal__frame {
	&.aime-ai-modal,
	&.aime-smtp-modal {
		border-radius: var(--aime-radius-lg);
		border: 1px solid var(--aime-border-light);
		box-shadow: var(--aime-shadow-xl);
		animation: aime-modal-in var(--aime-enter) both;

		.components-modal__header {
			border-bottom: 1px solid var(--aime-border-light);
			padding: 0 24px;
			background: var(--aime-white);
		}

		.components-modal__header-heading {
			font-size: 18px;
			font-weight: 700;
			color: var(--aime-text);
		}

		// WordPress ships this close control as a square icon button. Reshaped
		// to the same 32px round object the premium modals use, so closing
		// either kind of dialog is the same gesture at the same target.
		.components-modal__header .components-button.has-icon {
			width: 32px;
			height: 32px;
			min-width: 32px;
			padding: 0;
			border-radius: var(--aime-radius-pill);
			border: 1px solid var(--aime-border);
			background: var(--aime-white);
			color: var(--aime-text-light);
			transition: background-color var(--aime-transition-fast),
				border-color var(--aime-transition-fast),
				color var(--aime-transition-fast),
				transform var(--aime-transition-fast);

			svg {
				fill: currentColor;
			}

			&:hover {
				background: var(--aime-error-light);
				border-color: var(--aime-error);
				color: var(--aime-error);
			}

			&:active {
				transform: scale(0.92);
			}

			&:focus-visible {
				outline: 2px solid var(--aime-primary);
				outline-offset: 2px;
				box-shadow: none;
			}
		}
	}
}

// ============================================
// INTERACTION MOTION
//
// Everything below is feedback, not choreography: 120–180ms, colour plus at
// most a 1–2px move, on controls the visitor is already touching. The rule the
// section obeys is that no motion changes an element's box — these are dense
// admin surfaces, and a growing row or a lifting card shifts the next target
// out from under the cursor. Buttons and form fields already carry their own
// transitions from the control systems above; this closes the gaps that were
// left: dropdowns, tooltips, tabs, rail items, checkboxes, table rows.
// ============================================

@keyframes aime-pop-in {
	from { opacity: 0; transform: translateY(-4px) scale(0.985); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

// ── Menus, dropdowns, popovers ───────────────────────────
// A menu belongs to the button that opened it, so it arrives from that edge
// instead of fading in place. Origin is the top because every menu in the
// plugin opens downward from a toolbar control.
#aime-app .components-dropdown-menu__menu,
#aime-app .components-popover:not([data-popover-inline]) .components-popover__content {
	animation: aime-pop-in var(--aime-enter-quick) both;
	transform-origin: top center;
}

#aime-app .components-menu-item,
.components-popover .components-menu-item {
	transition: background-color var(--aime-transition-fast),
		color var(--aime-transition-fast);
}

// ── Collapsed-rail tooltips ──────────────────────────────
// The label slides the 4px it was hidden by, which reads as the name coming
// out of the icon rather than materialising beside it.
.aime-sidebar-nav.is-collapsed {
	.aime-sidebar-item[data-tip],
	.aime-nav-toggle[data-tip] {
		&::after {
			transform: translateY(-50%) translateX(-4px);
			transition: opacity var(--aime-transition-fast),
				transform var(--aime-transition-fast), visibility 0s linear 0.12s;
		}

		&:hover::after,
		&:focus-visible::after {
			transform: translateY(-50%) translateX(0);
			transition-delay: 0s;
		}
	}
}

// ── Rail items ───────────────────────────────────────────
// Only the accent shadow eases in; the fill and the label weight land at once
// so the selection never looks tentative.
.aime-sidebar-item {
	transition: background-color var(--aime-transition-fast),
		color var(--aime-transition-fast), box-shadow var(--aime-transition);
}

.aime-sidebar-item-icon {
	transition: transform var(--aime-transition-fast);
}

.aime-sidebar-item:active:not(.aime-sidebar-active) .aime-sidebar-item-icon {
	transform: scale(0.9);
}

// ── Tabs ─────────────────────────────────────────────────
.aime-tab-btn,
.aime-sub-tab {
	transition: color var(--aime-transition-fast),
		background-color var(--aime-transition-fast),
		border-color var(--aime-transition-fast), box-shadow var(--aime-transition);
}

#aime-app .components-tab-panel__tabs-item {
	transition: color var(--aime-transition-fast),
		box-shadow var(--aime-transition), background-color var(--aime-transition-fast);
}

// ── Checkboxes, radios, toggles ──────────────────────────
// WordPress animates the toggle knob itself; what it never does is
// acknowledge the press on the control the finger is actually on.
#aime-app {
	.components-checkbox-control__input,
	.components-radio-control__input,
	input[type="checkbox"],
	input[type="radio"] {
		transition: background-color var(--aime-transition-fast),
			border-color var(--aime-transition-fast),
			box-shadow var(--aime-transition-fast),
			transform var(--aime-transition-fast);

		&:active:not(:disabled) {
			transform: scale(0.9);
		}
	}

	.components-form-toggle__thumb {
		transition: transform var(--aime-transition),
			background-color var(--aime-transition-fast);
	}
}

// ── Table rows ───────────────────────────────────────────
// Rows tint on hover. No lift and no border change: at this density either
// would jitter the rows below the cursor.
#aime-app {
	.aime-table tbody tr,
	.aime-data-table tbody tr {
		transition: background-color var(--aime-transition-fast);
	}
}

// ── Reduce Motion ────────────────────────────────────────
// Anyone who asked for less motion keeps every state — the page still dims,
// the dialog still appears, focus rings still land — and loses only the
// travel. Durations collapse to 1ms rather than 0 so `transitionend`
// listeners still fire.
@media (prefers-reduced-motion: reduce) {
	#aime-app,
	.components-modal__screen-overlay,
	.components-modal__frame,
	.aime-premium-modal-overlay {
		&,
		*,
		*::before,
		*::after {
			animation-duration: 1ms !important;
			animation-iteration-count: 1 !important;
			transition-duration: 1ms !important;
			scroll-behavior: auto !important;
		}
	}

	// Swap the travelling entrance for the plain dim, so the dialog still
	// announces itself without sliding.
	.aime-premium-modal,
	.components-modal__frame.aime-ai-modal,
	.components-modal__frame.aime-smtp-modal {
		animation-name: aime-overlay-in !important;
	}

	.aime-sidebar-nav.is-collapsed {
		.aime-sidebar-item[data-tip]::after,
		.aime-nav-toggle[data-tip]::after {
			transform: translateY(-50%) translateX(0);
		}
	}
}

// ============================================
// DASHBOARD — SUMMARY BAND, ACTIVITY, MODULE SHARE
//
// The dashboard used to open on five same-size cards: two two-slice donuts,
// two gauge panels and a five-line chart, all ranked equal by a single
// auto-fit grid. Nothing on it was bigger than anything else, so nothing was
// the answer. This is the replacement hierarchy — a band of three gauges that
// answers "is this working", one activity chart that answers "is it moving",
// then the module detail underneath.
// ============================================

.aime-overview-band {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
	gap: 20px;
	margin-bottom: 20px;

	// Auto-fit lands on three equal columns once there is room, and three equal
	// columns say the three cards rank the same. At the wide door the workspace
	// gauge takes the extra width its larger arc needs, so the lead reads as
	// the lead.
	@media (min-width: 1280px) {
		grid-template-columns: 1.25fr 1fr 1fr;
	}
}

.aime-band-card {
	display: flex;
	flex-direction: column;
	margin-bottom: 0;

	.aime-card-body {
		display: flex;
		flex: 1;
		flex-direction: column;
		align-items: center;
		gap: 16px;
	}
}

.aime-band-card__label {
	align-self: flex-start;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--aime-text-light);
}

// Chips and hint are alternates for the same slot, so both are pinned to the
// bottom edge and every card in the band closes on one line regardless of
// which state it is in.
.aime-band-chips,
.aime-band-card__hint {
	width: 100%;
	margin-top: auto;
}

.aime-band-chips {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

// An inset floor, not a card. A bordered, shadowed box inside a bordered card
// is a card nested in a card; the third tonal step (--aime-bg-subtle) is what
// this system uses to mark an interior region instead.
.aime-band-chip {
	min-width: 0;
	padding: 10px 12px;
	background: var(--aime-bg-subtle);
	border-radius: 8px;
}

.aime-band-chip__label {
	display: block;
	overflow: hidden;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-light);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aime-band-chip__value {
	display: block;
	margin-top: 2px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
}

.aime-band-card__hint {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--aime-text-light);
	text-align: center;
}

// ── Arc gauge ────────────────────────────────────────────
.aime-arc {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.aime-arc__svg {
	display: block;
}

.aime-arc__track {
	stroke: var(--aime-border-light);
}

// Deliberately colourless here. Left alone the value stroke inherits the room
// accent, so the same component lights green in the lobby and crimson in the
// Email room without a prop. The dashboard passes an explicit colour only
// where a gauge stands for a room other than the page it is on.
.aime-arc__value {
	stroke: var(--aime-primary);
	transition: stroke-dashoffset 0.6s var(--aime-ease-out);
}

// The number sits in the mouth of the arc rather than under it — that hole is
// the reason to use an open arc instead of a ring, and leaving it empty while
// parking the value below wastes both. Pulled up by margin rather than
// absolute positioning so a caption that wraps grows the card instead of
// spilling over whatever is beneath it.
.aime-arc__center {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: -48px;
	text-align: center;
}

.aime-band-card--lead .aime-arc__center {
	margin-top: -56px;
}

.aime-arc__value-text {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--aime-text);
	font-variant-numeric: tabular-nums;
}

.aime-arc__caption {
	margin-top: 2px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--aime-text-light);
}

// ── Activity card ────────────────────────────────────────
.aime-insight-card {
	.aime-card-header {
		flex-wrap: wrap;
		gap: 12px;
	}
}

// The range covered, said in words next to the title. It is context for the
// heading, not a second heading, so it drops to body weight and Ink Light.
.aime-card-title__note {
	margin-left: 8px;
	font-size: 13px;
	font-weight: 400;
	color: var(--aime-text-light);
}

// Segmented range control. The selected option rises to the surface plane
// instead of filling with the accent: this sits in a card header beside the
// card title, and an accent fill there would outrank the title it belongs to.
.aime-range-toggle {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	background: var(--aime-bg-subtle);
	border-radius: 8px;
}

.aime-range-toggle__btn {
	padding: 5px 10px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--aime-text-light);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--aime-transition-fast),
		color var(--aime-transition-fast),
		box-shadow var(--aime-transition-fast);

	&:hover:not(.is-active) {
		color: var(--aime-text);
	}

	&.is-active {
		background: var(--aime-white);
		color: var(--aime-text);
		box-shadow: var(--aime-shadow);
	}

	&:focus-visible {
		outline: 2px solid var(--aime-primary);
		outline-offset: 1px;
	}
}

// A refetch swaps the numbers under a chart that keeps its size, so the only
// honest signal is that the current reading is stale. Dimming says that
// without collapsing the card and bouncing everything below it.
.aime-insight-body {
	transition: opacity var(--aime-transition);

	&.is-loading {
		opacity: 0.45;
	}
}

.aime-insight-placeholder {
	height: 300px;
	background: var(--aime-bg-subtle);
	border-radius: var(--aime-radius);
}

// Legend for the activity chart. Scoped to the card: an older
// `.aime-chart-legend` elsewhere is a vertical key beside a donut, and an
// unscoped rule here would silently lay those on their side — including the
// `flex-direction: column` it sets, which a bare `flex-wrap` cannot undo.
.aime-insight-card .aime-chart-legend {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px 20px;
	min-width: 0;
	margin: 0 0 4px;
	padding: 0;
	list-style: none;
}

.aime-insight-card .aime-chart-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-light);
}

.aime-insight-card .aime-chart-legend__dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 8px;
}

// ── Chart tooltip ────────────────────────────────────────
// Recharts' default is a white box with a 1px grey edge that belongs to no
// system. This is the card language at a smaller scale, on the Floating
// shadow step because a tooltip genuinely floats.
.aime-chart-tooltip {
	min-width: 172px;
	padding: 10px 12px;
	background: var(--aime-white);
	border: 1px solid var(--aime-border);
	border-radius: var(--aime-radius);
	box-shadow: var(--aime-shadow-lg);
	font-size: 13px;
	color: var(--aime-text);
}

.aime-chart-tooltip__date {
	margin-bottom: 8px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--aime-text-light);
}

.aime-chart-tooltip__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.aime-chart-tooltip__row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 4px;

	&:last-child {
		margin-bottom: 0;
	}
}

.aime-chart-tooltip__dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 8px;
}

.aime-chart-tooltip__name {
	flex: 1;
	color: var(--aime-text-light);
}

.aime-chart-tooltip__value {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.aime-chart-tooltip__total {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--aime-border-light);
	font-weight: 700;
}

// ── Module part-of-whole bar ─────────────────────────────
// This replaced two 260px donut charts. A pie with two slices is a bar drawn
// the expensive way, and five of them down a page could not be compared to
// each other at all — five bars on one scan line can.
.aime-module-share {
	margin-bottom: 16px;
}

.aime-module-share__bar {
	height: 8px;
	background: var(--aime-bg-subtle);
	border-radius: 8px;
	overflow: hidden;
}

.aime-module-share__fill {
	display: block;
	height: 100%;
	border-radius: 8px;
}

.aime-module-share__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin-top: 8px;
}

.aime-module-share__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--aime-text-light);

	strong {
		color: var(--aime-text);
		font-weight: 700;
		font-variant-numeric: tabular-nums;
	}
}

.aime-module-share__dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 8px;
}

.aime-module-share__dot--rest {
	background: var(--aime-bg-subtle);
	border: 1px solid var(--aime-border);
}

// Two chips side by side stop being readable long before the card does.
@media (max-width: 480px) {
	.aime-band-chips {
		grid-template-columns: 1fr;
	}
}

/* ═══════════════════════════════════════════════════════════
   EMAIL ANALYTICS — OPEN RATE
   ═══════════════════════════════════════════════════════════ */

// Arc over its own part-of-whole bar. The arc answers "how good", the bar
// answers "out of how many" — one is a rate, the other is the count it came
// from, and separating them is why this replaced a two-slice pie.
.aime-openrate {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	padding: 8px 0 4px;

	.aime-module-share {
		width: 100%;
		max-width: 320px;
	}
}

/* ═══════════════════════════════════════════════════════════
   FREE-PLAN QUOTA STRIP
   ═══════════════════════════════════════════════════════════ */

// Sits above a list and answers "how much of this can I still do" before the
// user spends work finding out from a 403. Deliberately built as a tinted rule,
// not a card: it introduces the card below it, so giving it the same elevation
// would make two competing objects where the list is the only real one. The
// room tint carries the identity — a thick coloured edge would be a second
// object stuck to the side of the first.
.aime-quota-strip {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 16px;
	padding: 12px 16px;
	background: var(--aime-primary-light);
	border: 1px solid var(--aime-border-light);
	border-radius: var(--aime-radius-sm);

	// One quota out — the strip stops being an FYI and becomes the reason the
	// next click will fail, so it takes the warning tint and earns its button.
	&.is-blocked {
		background: var(--aime-warning-light);
		border-color: var(--aime-warning);
	}

	&__plan {
		flex: 0 0 auto;
		padding-top: 2px;
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		color: var(--aime-text-muted);
	}

	&__meters {
		flex: 1 1 320px;
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
		gap: 8px 24px;
	}

	&__action {
		flex: 0 0 auto;
		align-self: center;
	}
}

.aime-quota-meter {
	min-width: 0;

	&__head {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 8px;
		margin-bottom: 5px;
	}

	&__label {
		font-size: 12px;
		font-weight: 600;
		color: var(--aime-text);
		// Long labels shorten rather than push the count off its own row.
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	// The number the user actually came for, so it gets the weight — the "x of y"
	// underneath is the supporting detail, not the headline.
	&__left {
		flex: 0 0 auto;
		font-size: 13px;
		font-weight: 700;
		font-variant-numeric: tabular-nums;
		color: var(--aime-primary);
	}

	&__track {
		height: 4px;
		border-radius: 999px;
		background: var(--aime-bg-subtle);
		overflow: hidden;
	}

	&__fill {
		display: block;
		height: 100%;
		border-radius: inherit;
		background: var(--aime-primary);
		transition: width var(--aime-transition);
	}

	&__note {
		margin: 5px 0 0;
		font-size: 11px;
		font-variant-numeric: tabular-nums;
		color: var(--aime-text-light);
	}

	&.is-low {
		.aime-quota-meter__left { color: var(--aime-warning-dark); }
		.aime-quota-meter__fill { background: var(--aime-warning); }
	}

	&.is-empty {
		.aime-quota-meter__left { color: var(--aime-error-dark); }
		.aime-quota-meter__fill { background: var(--aime-error); }
	}
}

@media (max-width: 782px) {
	.aime-quota-strip {
		gap: 12px;

		&__action {
			align-self: stretch;
		}
	}
}
