/**
 * TrustLens Automation — Split Inspector layout.
 *
 * Left rail = rules list (compact, email-like). Right pane = per-rule flow
 * viz, stats, recent-run log. Classes are scoped to .wstl-auto-* to avoid
 * collisions with WP admin core / WooCommerce / other plugins.
 *
 * @since 1.5.0
 */

/* Design tokens — declared on both the main canvas and the rule modal so
   `var(--wa-*)` cascades into the modal, which is rendered *outside*
   `.wstl-auto` (at .wrap's sibling level). Without this, modal backgrounds
   resolve to transparent and borders to browser defaults. */
.wstl-auto,
.wstl-rule-modal {
	--wa-bg:        #ffffff;
	--wa-bg-soft:   #f8fafc;
	--wa-bg-list:   #f4f7fb;
	--wa-border:    #e2eaf2;
	--wa-border-2:  #d5e0eb;
	--wa-text:      #0a2540;
	--wa-text-2:    #14283e;
	--wa-muted:     #5b6d80;
	--wa-muted-2:   #94a3b8;
	--wa-accent:    #635bff;
	--wa-accent-2:  #8b84ff;
	--wa-accent-soft:#ede9fe;
	--wa-blue:      #2271b1;
	--wa-blue-soft: #dbeafe;
	--wa-green:     #047857;
	--wa-green-soft:#d1fae5;
	--wa-amber:     #b45309;
	--wa-amber-soft:#fef3c7;
	--wa-red:       #991b1b;
	--wa-red-soft:  #fee2e2;
	--wa-purple:    #7c3aed;
	--wa-purple-soft:#ede9fe;
	--wa-shadow-sm: 0 1px 2px rgba(10,37,64,.04);
	--wa-shadow-md: 0 8px 20px rgba(10,37,64,.06);
}

.wstl-auto {
	color: var(--wa-text);
	/* Break from the dark persistent header above — wrap resets top spacing
	   to zero on plugin pages, so we reintroduce it here for the canvas. */
	padding-top: 20px;
}

/* Shared tiny-icon style for decorative SVGs inside the automation canvas. */
.wstl-auto svg { display: block; }

/* ---------- Master switch strip ---------- */
/* Light surface card so it blends with page canvas and doesn't compete with
   the dark persistent header stacked above it. Stats read via typography,
   not background color. */
.wstl-auto-master {
	background: var(--wa-bg);
	border: 1px solid var(--wa-border);
	color: var(--wa-text);
	padding: 14px 18px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 16px;
	box-shadow: var(--wa-shadow-sm);
}
.wstl-auto-master-lead { display: flex; align-items: center; gap: 12px; }
.wstl-auto-master-icon {
	width: 38px; height: 38px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--wa-accent) 0%, var(--wa-accent-2) 100%);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-shadow: 0 4px 12px -2px rgba(99,91,255,.45), inset 0 1px 0 rgba(255,255,255,.2);
}
.wstl-auto-master-icon svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.wstl-auto-master h2 {
	margin: 0 0 2px;
	font-size: 14.5px;
	font-weight: 700;
	color: var(--wa-text);
	letter-spacing: -.01em;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	line-height: 1.25;
}
.wstl-auto-master p  { margin: 0; font-size: 12px; color: var(--wa-muted); line-height: 1.45; }
.wstl-auto-master-stats {
	display: flex;
	gap: 0;
	align-items: center;
	margin-left: auto;
}
.wstl-auto-master-stat {
	text-align: right;
	padding: 0 16px;
	border-left: 1px solid var(--wa-border);
}
.wstl-auto-master-stat:first-child { border-left: 0; padding-left: 0; }
.wstl-auto-master-stat .v { font-size: 18px; font-weight: 700; color: var(--wa-text); line-height: 1; font-variant-numeric: tabular-nums; }
.wstl-auto-master-stat .v.is-error { color: var(--wa-red); }
.wstl-auto-master-stat .l { font-size: 10px; color: var(--wa-muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; font-weight: 600; }
.wstl-auto-master-form { display: inline-flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--wa-border); }
.wstl-auto-master-form label { font-size: 12.5px; color: var(--wa-text); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.wstl-auto-master-form input[type=checkbox] { accent-color: var(--wa-accent); transform: scale(1.1); }

/* Engine status pill — replaces the heavy save button for idle state. */
.wstl-auto-master-engine {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	background: var(--wa-green-soft);
	color: var(--wa-green);
	border: 1px solid rgba(4,120,87,.22);
}
.wstl-auto-master-engine.is-off {
	background: var(--wa-bg-soft);
	color: var(--wa-muted);
	border-color: var(--wa-border);
}
.wstl-auto-master-engine::before {
	content: '';
	width: 6px; height: 6px;
	border-radius: 50%;
	background: currentColor;
}

/* ---------- Split shell ---------- */
.wstl-auto-split {
	display: grid;
	grid-template-columns: 360px 1fr;
	background: var(--wa-bg);
	border: 1px solid var(--wa-border);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: var(--wa-shadow-md);
	min-height: 620px;
}

/* ---------- Left rail ---------- */
.wstl-auto-left {
	background: var(--wa-bg-list);
	border-right: 1px solid var(--wa-border);
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.wstl-auto-left-head {
	padding: 14px 18px;
	border-bottom: 1px solid var(--wa-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--wa-bg);
}
.wstl-auto-left-head h3 {
	margin: 0;
	font-size: 11px;
	color: var(--wa-muted);
	text-transform: uppercase;
	letter-spacing: .1em;
	font-weight: 700;
}
.wstl-auto-left-head h3 strong { color: var(--wa-text); font-weight: 700; }
.wstl-auto-new {
	background: var(--wa-accent);
	color: #fff !important;
	border: 0;
	padding: 6px 12px;
	border-radius: 7px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	text-decoration: none;
}
.wstl-auto-new:hover { background: #4f46e5; color: #fff; }

.wstl-auto-list {
	overflow-y: auto;
	flex: 1;
	list-style: none;
	margin: 0;
	padding: 0;
}
.wstl-auto-item {
	padding: 13px 18px 13px 21px;
	border-bottom: 1px solid var(--wa-border);
	cursor: pointer;
	position: relative;
	transition: background .12s;
	display: block;
	color: inherit;
	text-decoration: none;
}
.wstl-auto-item::before {
	content: '';
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: 3px;
	background: transparent;
}
.wstl-auto-item:hover { background: rgba(99,91,255,.04); color: inherit; }
.wstl-auto-item.is-active { background: var(--wa-bg); }
.wstl-auto-item.is-active::before { background: var(--wa-accent); }
.wstl-auto-item.is-disabled .wstl-auto-item-name { color: var(--wa-muted-2); }

.wstl-auto-item-top {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 3px;
}
.wstl-auto-item-name {
	flex: 1;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--wa-text);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.wstl-auto-item-dot {
	width: 8px; height: 8px;
	border-radius: 50%;
	background: var(--wa-green);
	flex-shrink: 0;
	box-shadow: 0 0 0 2px var(--wa-green-soft);
}
.wstl-auto-item-dot.is-off { background: var(--wa-muted-2); box-shadow: 0 0 0 2px var(--wa-bg-soft); }
.wstl-auto-item-dot.is-error { background: #ef4444; box-shadow: 0 0 0 2px var(--wa-red-soft); }

.wstl-auto-item-sub {
	font-size: 11.5px;
	color: var(--wa-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 5px;
}
.wstl-auto-item-sep {
	width: 10px; height: 10px;
	stroke: currentColor;
	stroke-width: 2.5;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: .45;
	flex-shrink: 0;
}
.wstl-auto-item-stat {
	margin-top: 5px;
	font-size: 10.5px;
	color: var(--wa-muted-2);
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.wstl-auto-item-stat .err { color: #991b1b; font-weight: 700; }

.wstl-auto-list-empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--wa-muted);
	font-size: 12.5px;
}

/* ---------- Right pane ---------- */
.wstl-auto-right {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.wstl-auto-right-head {
	padding: 22px 26px 18px;
	border-bottom: 1px solid var(--wa-border);
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
}
.wstl-auto-right-title {
	font-size: 20px;
	font-weight: 700;
	color: var(--wa-text);
	letter-spacing: -0.02em;
	margin: 0 0 4px;
	line-height: 1.2;
}
.wstl-auto-right-sub {
	font-size: 12.5px;
	color: var(--wa-muted);
	display: flex;
	align-items: center;
	gap: 6px;
}
.wstl-auto-right-sub-dot {
	display: inline-block;
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--wa-green);
}
.wstl-auto-right-sub-dot.is-off { background: var(--wa-muted-2); }
.wstl-auto-right-sub .divider { color: var(--wa-border-2); padding: 0 4px; }

.wstl-auto-right-head-actions { display: flex; gap: 6px; align-items: center; }
.wstl-auto-right-head-actions button,
.wstl-auto-right-head-actions .button {
	font: inherit;
	padding: 7px 12px;
	border: 1px solid var(--wa-border);
	background: #fff;
	border-radius: 7px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--wa-muted);
	cursor: pointer;
	line-height: 1;
}
.wstl-auto-right-head-actions button.primary,
.wstl-auto-right-head-actions .button.primary {
	background: var(--wa-text);
	color: #fff;
	border-color: var(--wa-text);
}
.wstl-auto-right-head-actions button.primary:hover { background: #000; }
.wstl-auto-right-head-actions .danger:hover { color: var(--wa-red); border-color: #fecaca; }

/* ---------- Flow viz ---------- */
.wstl-auto-canvas {
	padding: 24px 26px;
	flex: 1;
	overflow-y: auto;
}
.wstl-auto-flow {
	display: flex;
	align-items: stretch;
	gap: 0;
	margin-bottom: 22px;
	flex-wrap: wrap;
}
.wstl-auto-flow-step {
	flex: 1 1 200px;
	min-width: 180px;
	background: #fff;
	border: 1.5px solid var(--wa-border);
	border-radius: 12px;
	padding: 14px 16px;
}
.wstl-auto-flow-step-kind {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .12em;
	margin-bottom: 8px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px;
	border-radius: 999px;
	color: #fff;
}
.wstl-auto-flow-step-val {
	font-size: 14.5px;
	font-weight: 600;
	color: var(--wa-text);
	margin-bottom: 4px;
	line-height: 1.3;
	word-break: break-word;
}
.wstl-auto-flow-step-val code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 12px;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(0,0,0,.04);
}
.wstl-auto-flow-step-hint {
	font-size: 11.5px;
	color: var(--wa-muted);
	line-height: 1.4;
}
.wstl-auto-flow-step.trigger   { border-color: #bfdbfe; background: linear-gradient(180deg, var(--wa-blue-soft) 0%, #fff 80%); }
.wstl-auto-flow-step.trigger   .wstl-auto-flow-step-kind { background: var(--wa-blue); }
.wstl-auto-flow-step.condition { border-color: #fcd34d; background: linear-gradient(180deg, var(--wa-amber-soft) 0%, #fff 80%); }
.wstl-auto-flow-step.condition .wstl-auto-flow-step-kind { background: var(--wa-amber); }
.wstl-auto-flow-step.action    { border-color: #c4b5fd; background: linear-gradient(180deg, var(--wa-purple-soft) 0%, #fff 80%); }
.wstl-auto-flow-step.action    .wstl-auto-flow-step-kind { background: var(--wa-purple); }
.wstl-auto-flow-step.action.is-danger { border-color: #fca5a5; background: linear-gradient(180deg, var(--wa-red-soft) 0%, #fff 80%); }
.wstl-auto-flow-step.action.is-danger .wstl-auto-flow-step-kind { background: #dc2626; }

.wstl-auto-flow-arrow {
	width: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--wa-muted-2);
	flex-shrink: 0;
}
.wstl-auto-flow-arrow svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Stats + recent runs ---------- */
.wstl-auto-panels {
	display: grid;
	grid-template-columns: 1fr 1.2fr;
	gap: 14px;
}
@media (max-width: 1000px) {
	.wstl-auto-panels { grid-template-columns: 1fr; }
}
.wstl-auto-panel {
	background: var(--wa-bg-soft);
	border: 1px solid var(--wa-border);
	border-radius: 10px;
	padding: 14px 16px;
}
.wstl-auto-panel-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 10px;
}
.wstl-auto-panel-title {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--wa-muted);
	font-weight: 700;
}
.wstl-auto-panel-sub { font-size: 10.5px; color: var(--wa-muted-2); }

.wstl-auto-stat {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 7px 0;
	border-bottom: 1px solid var(--wa-border);
}
.wstl-auto-stat:last-child { border-bottom: 0; }
.wstl-auto-stat-k { font-size: 12px; color: var(--wa-muted); }
.wstl-auto-stat-v {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--wa-text);
	font-variant-numeric: tabular-nums;
}
.wstl-auto-stat-v.green { color: var(--wa-green); }
.wstl-auto-stat-v.red { color: var(--wa-red); }
.wstl-auto-stat-v.amber { color: #b45309; }
.wstl-auto-stat-v.muted { color: var(--wa-muted-2); }

.wstl-auto-spark {
	margin-top: 10px;
	display: flex;
	align-items: flex-end;
	gap: 2px;
	height: 42px;
	padding: 4px 0 0;
	border-top: 1px dashed var(--wa-border);
}
.wstl-auto-spark-bar {
	flex: 1;
	background: var(--wa-accent-soft);
	border-radius: 2px 2px 0 0;
	min-height: 2px;
	position: relative;
	transition: background .15s;
}
.wstl-auto-spark-bar.has-err { background: #fecaca; }
.wstl-auto-spark-bar:hover { background: var(--wa-accent); }
.wstl-auto-spark-bar.has-err:hover { background: #ef4444; }

.wstl-auto-runs {
	list-style: none;
	margin: 0; padding: 0;
}
.wstl-auto-runs li {
	padding: 8px 0;
	display: grid;
	grid-template-columns: 58px 1fr auto;
	gap: 10px;
	align-items: center;
	font-size: 12px;
	border-bottom: 1px dashed var(--wa-border);
}
.wstl-auto-runs li:last-child { border-bottom: 0; }
.wstl-auto-runs .t {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 11px;
	color: var(--wa-muted-2);
}
.wstl-auto-runs .b {
	color: var(--wa-text);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.wstl-auto-runs .b code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 11px;
	padding: 1px 5px;
	background: rgba(0,0,0,.04);
	border-radius: 3px;
}
.wstl-auto-runs .s {
	font-size: 10.5px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 999px;
	white-space: nowrap;
}
.wstl-auto-runs .s.ok { background: var(--wa-green-soft); color: var(--wa-green); }
.wstl-auto-runs .s.err { background: var(--wa-red-soft); color: var(--wa-red); }
.wstl-auto-runs .s.skip { background: #fef3c7; color: #92400e; }

/* In-modal error panel — populated by admin.js when a save is rejected. */
.wstl-rule-error {
	margin: 14px 24px 0;
	padding: 12px 14px;
	background: #fef2f2;
	border: 1px solid #fca5a5;
	color: #991b1b;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.55;
}
.wstl-rule-error[hidden] { display: none; }
.wstl-rule-error strong { display: block; margin-bottom: 4px; font-weight: 600; }
.wstl-rule-error ul { margin: 0 0 0 18px; padding: 0; list-style: disc; }
.wstl-rule-error ul li { margin-top: 3px; }
.wstl-auto-runs-empty {
	padding: 24px 10px;
	text-align: center;
	color: var(--wa-muted);
	font-size: 12px;
}

/* ---------- Empty states ---------- */
.wstl-auto-right-empty {
	padding: 60px 40px;
	text-align: center;
	color: var(--wa-muted);
}
.wstl-auto-right-empty .icon {
	width: 56px; height: 56px;
	border-radius: 50%;
	background: var(--wa-accent-soft);
	color: var(--wa-accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 14px;
}
.wstl-auto-right-empty .icon svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wstl-auto-right-empty h3 {
	margin: 0 0 6px;
	font-size: 16px;
	font-weight: 700;
	color: var(--wa-text);
}
.wstl-auto-right-empty p {
	margin: 0 0 18px;
	font-size: 13px;
	max-width: 420px;
	margin-left: auto;
	margin-right: auto;
}

/* =========================================================
   Rule modal — Stacked Cards layout
   -----------------------------------------------------------
   Visibility (.is-open) and overlay come from settings.css.
   That file also applies a decorative 4px gradient bar, extra
   form padding, and a 36×36 gray close-button skin by default.
   The overrides below suppress those so the Stacked-Cards
   skin renders cleanly.
   ========================================================= */

/* Suppress the base "::before gradient strip" on the rule modal only. */
.wstl-rule-modal-content::before { display: none; }

/* Shell */
.wstl-rule-modal-content {
	width: 560px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 48px);
	padding: 0;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(10,37,64,.25), 0 10px 30px rgba(10,37,64,.12);
	background: var(--wa-bg);
	position: relative;
	display: flex;
	flex-direction: column;
}

/* Form fills the shell, no inherited padding / overflow — our internal
   sections handle their own spacing + scroll. */
.wstl-rule-modal-content > form.wstl-rule-form {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
	padding: 0;
	overflow: visible;
}

/* Close button — raise specificity to beat settings.css:
   `.wstl-modal-content > .wstl-modal-close` (0,2,0). */
.wstl-rule-modal-content > .wstl-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: transparent;
	border: 0;
	color: var(--wa-muted);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	padding: 0;
	font-size: 0;
	transition: background .12s, color .12s;
}
.wstl-rule-modal-content > .wstl-modal-close:hover {
	background: var(--wa-bg-soft);
	color: var(--wa-text);
}
.wstl-rule-modal-content > .wstl-modal-close svg {
	width: 16px; height: 16px;
	stroke: currentColor; stroke-width: 2;
	fill: none; stroke-linecap: round; stroke-linejoin: round;
}

/* Head: rule name */
.wstl-rule-head {
	padding: 22px 24px 18px;
	border-bottom: 1px solid var(--wa-border);
}
.wstl-rule-head-label {
	display: block;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--wa-muted);
	font-weight: 700;
	margin-bottom: 4px;
}
.wstl-rule-head-input {
	width: 100%;
	font: inherit;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--wa-text);
	border: 0;
	background: transparent;
	padding: 2px 0;
	display: block;
}
.wstl-rule-head-input:focus { outline: 0; }
.wstl-rule-head-input::placeholder { color: var(--wa-muted-2); font-weight: 500; }

/* Body: scrollable card stack */
.wstl-rule-body {
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
}

/* Shared card chrome — white body, 3px colored left edge carries role. */
.wstl-rule-card {
	background: var(--wa-bg);
	border: 1px solid var(--wa-border);
	border-left: 3px solid var(--wa-border-2);
	border-radius: 10px;
	padding: 14px 16px 14px 15px;
	transition: border-left-color .15s;
}
.wstl-rule-card-head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
}
.wstl-rule-card-icon {
	width: 18px;
	height: 18px;
	color: var(--wa-muted);
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.wstl-rule-card-icon svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.wstl-rule-card-kind {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--wa-muted);
	font-weight: 700;
}
.wstl-rule-card-title {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--wa-text);
	letter-spacing: -.005em;
	line-height: 1.3;
}
.wstl-rule-card-optional {
	font-size: 11.5px;
	font-weight: 500;
	color: var(--wa-muted-2);
	margin-left: 4px;
}

/* Card role variants — left edge + icon color only. */
.wstl-rule-card-trigger   { border-left-color: var(--wa-blue); }
.wstl-rule-card-trigger   .wstl-rule-card-icon { color: var(--wa-blue); }

.wstl-rule-card-condition { border-left-color: var(--wa-amber); }
.wstl-rule-card-condition .wstl-rule-card-icon { color: var(--wa-amber); }

.wstl-rule-card-action    { border-left-color: var(--wa-purple); }
.wstl-rule-card-action    .wstl-rule-card-icon { color: var(--wa-purple); }

/* Inputs */
.wstl-rule-input,
.wstl-rule-select {
	width: 100%;
	font: inherit;
	padding: 9px 12px;
	border: 1px solid var(--wa-border);
	border-radius: 8px;
	background: rgba(255,255,255,.96);
	color: var(--wa-text);
	transition: border-color .12s, box-shadow .12s;
	line-height: 1.2;
}
.wstl-rule-input:focus,
.wstl-rule-select:focus {
	outline: 0;
	border-color: var(--wa-accent);
	box-shadow: 0 0 0 3px rgba(99,91,255,.12);
}
.wstl-rule-select {
	appearance: none;
	padding-right: 32px;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6d80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 14px;
}

.wstl-rule-action-value { margin-top: 8px; }

/* Condition repeater */
.wstl-rule-conds {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 8px;
}
.wstl-rule-cond-row {
	display: grid;
	grid-template-columns: 1fr 96px 1fr 32px;
	gap: 6px;
	align-items: center;
}
.wstl-rule-cond-row .wstl-rule-select,
.wstl-rule-cond-row .wstl-rule-input {
	padding: 7px 10px;
	padding-right: 28px;
	font-size: 12.5px;
}
.wstl-rule-cond-row .wstl-rule-input { padding-right: 10px; }

.wstl-rule-cond-remove {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid var(--wa-border);
	border-radius: 7px;
	color: var(--wa-muted);
	cursor: pointer;
	padding: 0;
	font-size: 0;
}
.wstl-rule-cond-remove:hover { color: var(--wa-red); border-color: #fca5a5; background: var(--wa-red-soft); }
.wstl-rule-cond-remove svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }

.wstl-rule-cond-add {
	font: inherit;
	background: transparent;
	border: 1px dashed var(--wa-border-2);
	color: var(--wa-muted);
	padding: 6px 10px;
	border-radius: 7px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	line-height: 1;
}
.wstl-rule-cond-add:hover { border-color: var(--wa-accent); color: var(--wa-accent); border-style: solid; }
.wstl-rule-cond-add svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; }

/* Foot */
.wstl-rule-foot {
	padding: 14px 20px;
	border-top: 1px solid var(--wa-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: var(--wa-bg-soft);
	flex-shrink: 0;
}
.wstl-rule-enabled {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	color: var(--wa-muted);
	cursor: pointer;
	font-weight: 500;
}
.wstl-rule-enabled input {
	accent-color: var(--wa-accent);
	transform: scale(1.1);
}
.wstl-rule-foot-actions {
	display: flex;
	gap: 8px;
}
.wstl-rule-btn {
	font: inherit;
	padding: 9px 16px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid var(--wa-border);
	background: var(--wa-bg);
	color: var(--wa-text);
	transition: all .12s;
	line-height: 1;
}
.wstl-rule-btn:hover { background: var(--wa-bg-soft); }
.wstl-rule-btn-primary {
	background: var(--wa-accent);
	color: #fff;
	border-color: var(--wa-accent);
}
.wstl-rule-btn-primary:hover { background: #4f46e5; border-color: #4f46e5; }
.wstl-rule-btn-primary:disabled { opacity: .6; cursor: wait; }
.wstl-rule-btn-ghost {
	border-color: transparent;
	background: transparent;
	color: var(--wa-muted);
}
.wstl-rule-btn-ghost:hover { background: var(--wa-bg); color: var(--wa-text); }

/* Responsive: reduce padding + allow full-width cond layout */
@media (max-width: 600px) {
	.wstl-rule-modal-content { width: 100%; max-height: 100vh; border-radius: 0; }
	.wstl-rule-cond-row { grid-template-columns: 1fr 1fr 32px; }
	.wstl-rule-cond-row .wstl-condition-value { grid-column: 1 / -1; }
}

/* ---------- Responsive: collapse split on narrow screens ---------- */
@media (max-width: 900px) {
	.wstl-auto-split { grid-template-columns: 1fr; min-height: 0; }
	.wstl-auto-left { border-right: 0; border-bottom: 1px solid var(--wa-border); max-height: 50vh; }
	.wstl-auto-master-stats { gap: 14px; }
	.wstl-auto-master-stat .v { font-size: 16px; }
}
