/**
 * TrustLens persistent admin header.
 *
 * Dark WordPress-admin sidebar palette as the base, plugin purple preserved
 * in the logo mark, WP blue as the active-tab fill. Renders via
 * in_admin_header inside #wpbody-content so it stays below the WP admin bar
 * and to the right of the admin menu sidebar.
 *
 * Classes are wstl-hdr-* / wstl-cmdp-* scoped — no bare selectors — to
 * avoid collisions with WP core, WooCommerce, or other plugins.
 *
 * @since 1.2.2
 */

/* =========================================================
   Tokens — scoped via .wstl-hdr / .wstl-cmdp root
   ========================================================= */
.wstl-hdr,
.wstl-cmdp,
.wstl-cmdp-overlay {
	--wh-bg:#1d2327;
	--wh-bg-2:#2c3338;
	--wh-bg-3:#3c434a;
	--wh-text:#c3c4c7;
	--wh-muted:#a7aaad;
	--wh-blue:#2271b1;
	--wh-blue-hover:#135e96;
	--wh-blue-light:#72aee6;
	--wh-accent:#635bff;
	--wh-accent-soft:#8b84ff;
	--wh-good:#10b981;
	--wh-warn:#f59e0b;
	--wh-danger:#ef4444;
	--wh-pro:#c4bdff;
	--wh-line:#eff2f6;
	--wh-line-strong:#d5e0eb;
}

/* =========================================================
   Header shell
   ========================================================= */
.wstl-hdr {
	background: var(--wh-bg);
	line-height: 1.5;
	/* Horizontal values match WP's .wrap so the header aligns with content below. */
	margin: 0 20px 0 2px;
	z-index: 100;
	border-radius: 12px;
	box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 28px -10px rgba(10,37,64,.32), 0 2px 6px -2px rgba(10,37,64,.2);
}
/* Round the header's outer corners via the visible first/last rows so
   popovers (notifications, avatar menu, status) can escape the header box
   — we can't use overflow: hidden on .wstl-hdr or absolutely-positioned
   popovers get clipped. */
.wstl-hdr > :first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.wstl-hdr > :last-child  { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

/* Reset inherited link/button/input styling inside header. Wrapped in :where()
   so the reset has zero specificity — single-class selectors like
   .wstl-hdr-search override it naturally, no !important or re-prefixing needed. */
:where(.wstl-hdr a, .wstl-hdr button) { color: inherit; text-decoration: none; background: transparent; border: 0; cursor: pointer; font: inherit; padding: 0; }
:where(.wstl-hdr svg.wstl-hdr-icon) { display: inline-block; width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:where(.wstl-hdr input) { font: inherit; outline: none; border: 0; background: transparent; color: inherit; width: 100%; }

.wstl-hdr a:focus-visible, .wstl-hdr button:focus-visible {
	outline: 2px solid var(--wh-accent-soft);
	outline-offset: 2px;
	border-radius: 6px;
}

/* Row 1 — top */
.wstl-hdr-top {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 16px;
	border-bottom: 1px solid var(--wh-bg-3);
	min-height: 52px;
}

/* Logo */
.wstl-hdr-logo {
	color: #fff;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.2;
	transition: opacity .15s;
	flex-shrink: 0;
}
.wstl-hdr-logo > span:last-child { display: inline-flex; flex-direction: column; }
.wstl-hdr-logo:hover { opacity: .88; }
/* Keep the logo text white on focus (WP admin's `a:focus` recolors to
   #043959, invisible on dark bg; use :focus not :focus-visible because WP's
   rule fires on mouse click too). */
.wstl-hdr-logo:focus { color: #fff; }
.wstl-hdr-mark {
	width: 35px; height: 35px;
	display: inline-flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.wstl-hdr-mark img { width: 100%; height: 100%; display: block; }
.wstl-hdr-logo small {
	display: block;
	font-size: 9px;
	color: var(--wh-muted);
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin-top: 1px;
	line-height: 1.2;
}

/* Mobile burger */
.wstl-hdr-burger {
	display: none;
	width: 32px; height: 32px;
	border-radius: 8px;
	align-items: center; justify-content: center;
	color: var(--wh-muted);
	flex-shrink: 0;
}
.wstl-hdr-burger:hover { background: var(--wh-bg-2); color: #fff; }

/* Search trigger (⌘K) */
.wstl-hdr-search {
	flex: 1 1 auto;
	max-width: 380px;
	min-width: 180px;
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(255,255,255,.09);
	border: 1px solid rgba(255,255,255,.16);
	border-radius: 8px;
	padding: 7px 12px;
	color: var(--wh-muted);
	transition: all .15s;
	margin: 0 4px;
}
.wstl-hdr-search:hover { color: #fff; }
.wstl-hdr-search .placeholder {
	flex: 1;
	font-size: 12.5px;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.wstl-hdr-kbd {
	background: rgba(255,255,255,.1);
	border: 1px solid rgba(255,255,255,.08);
	border-radius: 4px;
	padding: 2px 6px;
	font-size: 10px;
	color: var(--wh-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	letter-spacing: .04em;
	flex-shrink: 0;
}

/* Right cluster */
.wstl-hdr-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.wstl-hdr-rel { position: relative; }

/* Unsaved-changes indicator — amber pill, hidden until a form goes dirty */
.wstl-hdr-unsaved {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-right: 4px;
	padding: 5px 11px;
	border-radius: 999px;
	background: rgba(245, 158, 11, 0.16);
	border: 1px solid rgba(245, 158, 11, 0.34);
	color: var(--wh-warn);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}
.wstl-hdr-unsaved[hidden] { display: none; }
.wstl-hdr-unsaved-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--wh-warn);
	flex: none;
	box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
	animation: wstl-unsaved-pulse 1.9s infinite;
}
@keyframes wstl-unsaved-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
	70%  { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
	100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
@media (prefers-reduced-motion: reduce) {
	.wstl-hdr-unsaved-dot { animation: none; }
}
@media (max-width: 782px) {
	.wstl-hdr-unsaved { font-size: 0; gap: 0; padding: 7px; }
}

/* Status pill */
.wstl-hdr-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	border: 1px solid transparent;
	transition: all .15s;
	white-space: nowrap;
	line-height: 1;
}
.wstl-hdr-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wstl-hdr-status-good    { background: rgba(16,185,129,.14);  color: var(--wh-good);   border-color: rgba(16,185,129,.32); }
.wstl-hdr-status-warn    { background: rgba(245,158,11,.14);  color: var(--wh-warn);   border-color: rgba(245,158,11,.32); }
.wstl-hdr-status-danger  { background: rgba(239,68,68,.14);   color: var(--wh-danger); border-color: rgba(239,68,68,.32); }
.wstl-hdr-status-warn .dot, .wstl-hdr-status-danger .dot { animation: wstl-hdr-pulse 1.8s ease-out infinite; }
.wstl-hdr-status:hover { filter: brightness(1.15); }

@keyframes wstl-hdr-pulse {
	0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
	70%  { box-shadow: 0 0 0 6px transparent; opacity: .85; }
	100% { box-shadow: 0 0 0 0 transparent;  opacity: 1; }
}

/* Tier chip */
.wstl-hdr-tier {
	display: inline-flex;
	align-items: center;
	padding: 3px 8px;
	border-radius: 999px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	border: 1px solid transparent;
	white-space: nowrap;
	line-height: 1.2;
}
.wstl-hdr-tier-pro  { background: rgba(139,132,255,.18); color: var(--wh-pro); border-color: rgba(139,132,255,.3); }
.wstl-hdr-tier-free { background: rgba(255,255,255,.08); color: var(--wh-muted); border-color: rgba(255,255,255,.1); }

/* Icon button (bell, help, avatar container) */
.wstl-hdr-ib {
	width: 32px; height: 32px;
	border-radius: 8px;
	display: inline-flex;
	align-items: center; justify-content: center;
	color: var(--wh-muted);
	position: relative;
	border: 1px solid transparent;
	transition: all .15s;
	flex-shrink: 0;
}
.wstl-hdr-ib:hover { background: var(--wh-bg-2); color: #fff; border-color: var(--wh-bg-3); }
.wstl-hdr-badge {
	position: absolute;
	top: -3px; right: -3px;
	min-width: 15px; height: 15px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--wh-danger);
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	display: inline-flex;
	align-items: center; justify-content: center;
	box-shadow: 0 0 0 2px var(--wh-bg);
	line-height: 1;
	pointer-events: none;
}

/* Avatar */
.wstl-hdr-avatar {
	width: 32px; height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--wh-blue), var(--wh-blue-light));
	color: #fff;
	font-weight: 700;
	font-size: 12px;
	display: inline-flex;
	align-items: center; justify-content: center;
	box-shadow: 0 0 0 2px var(--wh-bg-3);
	transition: box-shadow .15s;
	letter-spacing: .02em;
	flex-shrink: 0;
}
.wstl-hdr-avatar:hover { box-shadow: 0 0 0 2px var(--wh-blue-light); }

/* Menu row arrow (user-menu "Open Notifications settings" etc) */
.wstl-hdr-menu-arrow { margin-left: auto; width: 14px; height: 14px; flex-shrink: 0; }

/* Mobile-only search icon trigger (replaces the full search bar under 900px) */
.wstl-hdr-search-mobile { display: none; }

/* Row 2 — primary nav */
.wstl-hdr-nav-wrap {
	background: var(--wh-bg-2);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
	/* Animated drawer collapse on mobile — max-height transitions in the
	   responsive block below. Desktop keeps natural height. */
	overflow: hidden;
}
.wstl-hdr-nav {
	display: flex;
	gap: 14px;
	padding: 0 16px;
	overflow-x: auto;
	scrollbar-width: thin;
	min-height: 40px;
	align-items: stretch;
}
.wstl-hdr-nav::-webkit-scrollbar { height: 4px; }
.wstl-hdr-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.wstl-hdr-tab {
	color: var(--wh-text);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 10px;
	font-size: 12.5px;
	font-weight: 500;
	white-space: nowrap;
	transition: color .15s, background-color .15s;
	letter-spacing: -.005em;
	position: relative;
}
.wstl-hdr-tab .wstl-hdr-icon { color: var(--wh-muted); transition: color .15s; }

/* Underline indicator — tracks the tab's content box (inset to match padding). */
.wstl-hdr-tab::after {
	content: '';
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 0;
	height: 2px;
	background: var(--wh-blue-light);
	border-radius: 2px 2px 0 0;
	opacity: 0;
	transform: scaleX(.6);
	transition: opacity .15s, transform .18s ease;
}

/* Shared hover, focus, and active — white text/icon, underline snaps.
   :focus (not :focus-visible) is required to override WP admin common.css
   `a:focus { color: #043959 }` which fires on mouse click AND keyboard and
   would otherwise make the tab label invisible on our dark header. */
.wstl-hdr-tab:hover,
.wstl-hdr-tab:focus,
.wstl-hdr-tab.on { color: #fff; }
.wstl-hdr-tab:hover .wstl-hdr-icon,
.wstl-hdr-tab:focus .wstl-hdr-icon,
.wstl-hdr-tab.on .wstl-hdr-icon { color: #fff; }
.wstl-hdr-tab:hover::after,
.wstl-hdr-tab:focus::after,
.wstl-hdr-tab.on::after { transform: scaleX(1); }

/* Hover + focus — light wash + faint underline. */
.wstl-hdr-tab:hover,
.wstl-hdr-tab:focus { background: rgba(255,255,255,.04); }
.wstl-hdr-tab:hover::after,
.wstl-hdr-tab:focus::after { opacity: .5; }

/* Active — bolder, wider padding, stronger wash, solid thicker underline. */
.wstl-hdr-tab.on { font-weight: 600; background: rgba(255,255,255,.05); padding: 0 13px; }
.wstl-hdr-tab.on::after { opacity: 1; height: 3px; left: 13px; right: 13px; }
.wstl-hdr-tab.on:hover { background: rgba(255,255,255,.08); }

/* Small PRO tag */
.wstl-hdr-tag-pro {
	font-size: 9px;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 2px 7px;
	background: rgba(139,132,255,.20);
	color: #cfcaff;
	box-shadow: inset 0 0 0 1px rgba(139,132,255,.34);
	border-radius: 5px;
	font-weight: 700;
	margin-left: 4px;
}
.wstl-hdr-tab.on .wstl-hdr-tag-pro { background: rgba(255,255,255,.22); color: #fff; }

/* Row 3 — Settings sub-nav */
.wstl-hdr-subnav {
	background: var(--wh-bg);
	border-top: 1px solid var(--wh-bg-3);
}
.wstl-hdr-subnav-inner {
	display: flex;
	gap: 4px;
	padding: 0 16px;
	overflow-x: auto;
	scrollbar-width: thin;
}
.wstl-hdr-subtab {
	color: var(--wh-muted);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 500;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	white-space: nowrap;
	transition: color .15s;
}
.wstl-hdr-subtab:hover,
.wstl-hdr-subtab:focus,
.wstl-hdr-subtab.on { color: #fff; }
.wstl-hdr-subtab.on { border-bottom-color: var(--wh-accent); font-weight: 600; }

/* =========================================================
   Popovers
   ========================================================= */
.wstl-hdr-pop {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 320px;
	/* Keep the popover on-screen on narrow viewports. 24px keeps a small
	   gutter from the right edge so it doesn't butt against the scrollbar. */
	max-width: calc(100vw - 24px);
	background: #fff;
	border: 1px solid var(--wh-line-strong);
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(10,37,64,.25), 0 0 0 1px rgba(10,37,64,.04);
	opacity: 0;
	transform: translateY(-6px);
	pointer-events: none;
	transition: opacity .15s, transform .15s;
	z-index: 110;
	color: #0a2540;
}
.wstl-hdr-pop.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.wstl-hdr-pop-wide { min-width: 360px; }

/* On narrow viewports where min-width would push the pop off-screen,
   let it shrink down and align to the right of its trigger normally. */
@media (max-width: 480px) {
	.wstl-hdr-pop { min-width: 0; width: calc(100vw - 24px); }
}

.wstl-hdr-pop-section { padding: 12px 16px; border-bottom: 1px solid var(--wh-line); }
.wstl-hdr-pop-section:last-child { border-bottom: 0; }
.wstl-hdr-pop-head {
	font-size: 11px;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: .08em;
	font-weight: 600;
	margin-bottom: 8px;
}

.wstl-hdr-pop-title { font-size: 14px; font-weight: 600; color: #0a2540; margin-bottom: 4px; }
.wstl-hdr-pop-detail { font-size: 12px; color: #6b7280; margin-bottom: 4px; line-height: 1.5; }

.wstl-hdr-pop-fps { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wstl-hdr-pop-fps li {
	display: flex; justify-content: space-between; align-items: center;
	padding: 8px 10px;
	background: #fef3c7;
	border-left: 3px solid var(--wh-warn);
	border-radius: 6px;
}
.wstl-hdr-pop-fps .hash {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 12px;
	color: #0a2540;
	font-weight: 500;
}
.wstl-hdr-pop-fps .ttl { font-size: 10px; color: #92400e; font-weight: 600; letter-spacing: .05em; }

.wstl-hdr-pop-cta {
	color: #fff;
	display: block;
	padding: 10px 12px;
	background: #1d2327;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	text-align: center;
	margin-top: 8px;
	transition: background .15s;
}
.wstl-hdr-pop-cta:hover { background: #000; }

.wstl-hdr-pop-empty {
	padding: 24px 12px;
	text-align: center;
	color: #6b7280;
	font-size: 12px;
}

/* Notifications rows */
.wstl-hdr-notif {
	color: #0a2540;
	display: flex;
	gap: 10px;
	padding: 10px;
	border-radius: 8px;
	cursor: pointer;
	transition: background .15s;
}
.wstl-hdr-notif + .wstl-hdr-notif { margin-top: 2px; }
.wstl-hdr-notif:hover { background: #f6f9fc; }
.wstl-hdr-notif-icon {
	width: 28px; height: 28px;
	border-radius: 8px;
	display: flex;
	align-items: center; justify-content: center;
	flex-shrink: 0;
	margin-top: 2px;
	color: #1e40af;
}
.wstl-hdr-notif-danger .wstl-hdr-notif-icon { background: #fee2e2; color: #991b1b; }
.wstl-hdr-notif-warn   .wstl-hdr-notif-icon { background: #fef3c7; color: #92400e; }
.wstl-hdr-notif-good   .wstl-hdr-notif-icon { background: #d1fae5; color: #065f46; }
.wstl-hdr-notif-info   .wstl-hdr-notif-icon { background: #dbeafe; color: #1e40af; }
.wstl-hdr-notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wstl-hdr-notif-body .t { font-size: 13px; font-weight: 600; color: #0a2540; line-height: 1.35; }
.wstl-hdr-notif-body .d { font-size: 12px; color: #6b7280; line-height: 1.35; }
.wstl-hdr-notif-arrow { color: #9ca3af; align-self: center; transition: transform .15s, color .15s; flex-shrink: 0; }
.wstl-hdr-notif:hover .wstl-hdr-notif-arrow { color: #0a2540; transform: translateX(2px); }

/* "Live state" note under notifications list */
.wstl-hdr-pop-note {
	font-size: 11px;
	color: #6b7280;
	line-height: 1.4;
	margin: 10px 2px 0;
	padding-top: 8px;
	border-top: 1px dashed var(--wh-line);
}

.wstl-hdr-pop-foot { padding: 6px 8px; }

/* User menu items */
.wstl-hdr-pop-ident {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--wh-line);
}
.wstl-hdr-pop-ident .wstl-hdr-avatar { cursor: default; box-shadow: 0 0 0 2px rgba(34,113,177,.22); }
.wstl-hdr-pop-ident .n { font-size: 13px; font-weight: 600; color: #0a2540; }
.wstl-hdr-pop-ident .e { font-size: 11px; color: #6b7280; margin-top: 2px; }

.wstl-hdr-pop-menu { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.wstl-hdr-menu-item {
	color: #0a2540;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 13px;
	cursor: pointer;
	transition: background .15s;
}
.wstl-hdr-menu-item:hover { background: #f6f9fc; }
.wstl-hdr-menu-item .wstl-hdr-icon { color: #6b7280; }
.wstl-hdr-menu-item .wstl-hdr-tag-pro { margin-left: auto; }

/* =========================================================
   Command palette (⌘K)
   ========================================================= */
.wstl-cmdp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10,37,64,.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s;
	/* Must render above WP admin bar (z-index: 99999). */
	z-index: 100000;
}
.wstl-cmdp-overlay.open { opacity: 1; pointer-events: auto; }

.wstl-cmdp {
	position: fixed;
	top: 14vh;
	left: 50%;
	transform: translateX(-50%) translateY(-10px);
	width: min(640px, 92vw);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 80px rgba(10,37,64,.4), 0 0 0 1px rgba(10,37,64,.05);
	opacity: 0;
	pointer-events: none;
	transition: all .2s;
	/* One above the overlay, two above the WP admin bar. */
	z-index: 100001;
	overflow: hidden;
	color: #0a2540;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wstl-cmdp.open {
	opacity: 1;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

.wstl-cmdp-input-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--wh-line);
}
.wstl-cmdp-input-wrap .wstl-hdr-icon { color: #6b7280; width: 16px; height: 16px; }
.wstl-cmdp-input { flex: 1; font-size: 14px; color: #0a2540; border: 0; outline: none; background: transparent; }
.wstl-cmdp-input::placeholder { color: #9ca3af; }
.wstl-cmdp-esc {
	background: #f6f9fc;
	border: 1px solid var(--wh-line);
	border-radius: 4px;
	padding: 2px 8px;
	font-size: 10px;
	color: #6b7280;
	font-family: ui-monospace, monospace;
}

.wstl-cmdp-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.wstl-cmdp-grp { padding: 4px; }
.wstl-cmdp-grp-t {
	font-size: 10px;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: .1em;
	font-weight: 600;
	padding: 6px 10px 4px;
}
.wstl-cmdp-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	color: #0a2540;
	text-decoration: none;
}
.wstl-cmdp-item:hover, .wstl-cmdp-item.active { background: #ede9fe; color: var(--wh-accent); }
.wstl-cmdp-item.active .wstl-hdr-icon { color: var(--wh-accent); }
.wstl-cmdp-item .wstl-hdr-icon { color: #6b7280; width: 16px; height: 16px; flex-shrink: 0; }
.wstl-cmdp-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wstl-cmdp-item-sub { flex-shrink: 0; margin-left: 10px; font-size: 11px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.wstl-cmdp-tag-pro { flex-shrink: 0; margin-left: 0; }
.wstl-cmdp-empty { padding: 40px 20px; text-align: center; color: #6b7280; font-size: 13px; }

.wstl-cmdp-foot {
	padding: 10px 16px;
	border-top: 1px solid var(--wh-line);
	display: flex;
	gap: 16px;
	font-size: 11px;
	color: #6b7280;
	background: #fafbfd;
	flex-wrap: wrap;
}
.wstl-cmdp-foot kbd {
	background: #fff;
	border: 1px solid var(--wh-line-strong);
	border-radius: 4px;
	padding: 0 6px;
	font-size: 10px;
	font-family: ui-monospace, monospace;
	color: #0a2540;
	min-width: 18px;
	text-align: center;
	display: inline-block;
	margin-right: 2px;
}

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet: collapse the status pill to an icon-only dot button so the
   live signal (panic / targeted / chargeback) stays visible instead
   of disappearing. Same popover opens on click; aria-label carries
   the full status label. */
@media (max-width: 1100px) {
	.wstl-hdr-status {
		width: 32px;
		height: 32px;
		padding: 0;
		gap: 0;
		justify-content: center;
		border-radius: 8px;
	}
	.wstl-hdr-status > span:not(.dot) { display: none; }
	.wstl-hdr-status .dot { width: 9px; height: 9px; }
}

/* Phone / narrow tablet: hide the inline search bar, show a compact
   search icon button that opens the same ⌘K palette, and collapse
   the primary nav into an animated drawer triggered by the burger. */
@media (max-width: 900px) {
	.wstl-hdr-search { display: none; }
	.wstl-hdr-search-mobile { display: inline-flex; }
	.wstl-hdr-burger { display: inline-flex; }

	.wstl-hdr-nav-wrap {
		max-height: 0;
		transition: max-height .22s ease;
	}
	.wstl-hdr-nav-wrap.open { max-height: 480px; }
	.wstl-hdr-nav { flex-direction: column; padding: 8px 16px; gap: 2px; min-height: 0; }
	.wstl-hdr-tab { width: 100%; }
}

@media (max-width: 600px) {
	.wstl-hdr-tier, .wstl-hdr-logo small { display: none; }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
	.wstl-hdr-status .dot { animation: none; }
	.wstl-hdr-pop, .wstl-cmdp, .wstl-cmdp-overlay { transition: none; }
}

/* =========================================================
   Tighten the gap between our sticky header and the page's
   first h1 inside .wrap. WP's .wrap has default margin-top,
   and .wp-heading-inline picks up its own spacing — zero the
   top so the 20px margin-bottom on .wstl-hdr is the sole
   source of the gap.
   ========================================================= */
.wstl-has-header #wpbody-content > .wrap { margin-top: 0; padding-top: 0; }
.wstl-has-header #wpbody-content > .wrap > h1:first-child,
.wstl-has-header #wpbody-content > .wrap > .wp-heading-inline:first-child { margin-top: 0; padding-top: 0; }

/* =========================================================
   Page-bar status chips — date, state pill, and free-text, rendered
   by `wstl_render_page_meta_chips()` inside the unified page bar.
   ========================================================= */
.wstl-page-meta-date {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #0a2540;
	font-weight: 600;
}
.wstl-page-meta-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	opacity: .7;
}
.wstl-page-meta-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px 3px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	border: 1px solid transparent;
}
.wstl-page-meta-pill::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}
.wstl-page-meta-pill-good   { background: rgba(16,185,129,.12); color: #047857; border-color: rgba(16,185,129,.28); }
.wstl-page-meta-pill-warn   { background: rgba(245,158,11,.14); color: #92400e; border-color: rgba(245,158,11,.32); }
.wstl-page-meta-pill-danger { background: rgba(239,68,68,.14);  color: #991b1b; border-color: rgba(239,68,68,.32); }
.wstl-page-meta-pill-info   { background: rgba(34,113,177,.12); color: #1e40af; border-color: rgba(34,113,177,.28); }
.wstl-page-meta-text { color: #5b6d80; }
.wstl-page-meta-text::before {
	content: '';
	display: inline-block;
	width: 1px;
	height: 12px;
	background: #d5e0eb;
	margin-right: 12px;
	vertical-align: middle;
}

/* Clickable chip — a status chip that deep-links to the view it names. */
.wstl-chip-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	border-radius: 999px;
	transition: transform .12s ease, filter .12s ease;
}
.wstl-chip-link:hover { transform: translateY(-1px); filter: brightness(.97); }
.wstl-chip-link:hover .wstl-page-meta-text { color: #1a2433; text-decoration: underline; }
.wstl-chip-link:focus-visible {
	outline: 2px solid var(--wstl-color-primary, #3377EE);
	outline-offset: 2px;
}

/* =========================================================
   Unified page bar — page name + live status chips + primary action.
   A light card aligned to the dark header's edges and sitting directly
   beneath it, rendered by wstl_render_page_header() on every page so the
   header and page identity read as one continuous unit.
   ========================================================= */
.wstl-pagebar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 14px;
	padding: 9px 16px;
	margin: 14px 0;
	background: #fff;
	border: 1px solid #e4ebf3;
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(10, 37, 64, 0.04);
}
.wstl-pagebar-id {
	padding-right: 16px;
}
/* Professional title separation — a hairline rule trails the identity block,
   shown only when status chips follow it so it never dangles on its own. */
.wstl-pagebar-id:has(+ .wstl-pagebar-meta) {
	border-right: 1px solid #e7eef6;
}
.wstl-pagebar-title {
	margin: 0;
	padding: 0;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.2;
	color: #15233a;
}
.wstl-pagebar-sub {
	margin: 3px 0 0;
	padding: 0;
	font-size: 12.5px;
	font-weight: 400;
	line-height: 1.4;
	color: #6b7a8d;
}
.wstl-pagebar-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 12px;
	font-size: 12.5px;
	color: #4f6075;
	line-height: 1.3;
}
.wstl-pagebar-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-left: auto;
}
/* The text chip carries its own divider for standalone strips; inside the bar
   the meta zone already has a border-left, so suppress the doubled rule. */
.wstl-pagebar-meta .wstl-page-meta-text::before { display: none; }
@media (max-width: 782px) {
	.wstl-pagebar { align-items: flex-start; }
	.wstl-pagebar-id { padding-right: 0; }
	.wstl-pagebar-id:has(+ .wstl-pagebar-meta) { border-right: 0; }
	.wstl-pagebar-meta { width: 100%; }
	.wstl-pagebar-actions { margin-left: 0; }
}
