/* Warehouse Manager — app shell ({home}/wms/*) */

/*
 * Colours. Every colour is a token. The theme colour (Settings → General) is the accent:
 * the default (#4d7c0f) uses the tuned shades below; any other colour sets
 * <html data-wpwm-color style="--wpwm-theme; --wpwm-on-theme; --wpwm-ink"> and the shades are
 * worked out from it (WPWM_Options::html_attributes()).
 *   --wpwm-accent         buttons, focus, the selected menu item
 *   --wpwm-accent-ink     the accent as text on the page (links, selected tab): always readable
 *   --wpwm-accent-bright  decoration only (active menu bar): never behind text
 *   --wpwm-on-accent      text on an accent background
 */
:root {
	--wpwm-bg: #f4f6fa;
	--wpwm-surface: #ffffff;
	--wpwm-border: #e4e7ec;
	--wpwm-text: #1a2233;
	--wpwm-muted: #5f6b7a;
	--wpwm-warning: #b45309;
	--wpwm-warning-soft: #fdf3e2;
	--wpwm-critical: #b91c1c;
	--wpwm-critical-soft: #fdecec;
	--wpwm-on-critical: #ffffff; /* Text on a critical background (danger buttons), whatever the theme colour. */
	--wpwm-radius: 10px;
	--wpwm-shadow: 0 1px 2px rgba(16, 24, 40, .05);
	--wpwm-sidebar-width: 248px;

	/* Default theme colour (#4d7c0f) with its tuned shades. */
	--wpwm-accent: #4d7c0f;
	--wpwm-accent-hover: #3f6212;
	--wpwm-accent-soft: #f1f8e6;
	--wpwm-accent-bright: #7cb518;
	--wpwm-on-accent: #ffffff;
	--wpwm-accent-ink: var(--wpwm-accent);

	/* Tables follow the theme colour: tinted header, tinted row on hover. */
	--wpwm-table-head: var(--wpwm-accent-soft);
	--wpwm-table-head-text: color-mix(in srgb, var(--wpwm-accent-ink) 85%, #000);
	--wpwm-table-hover: color-mix(in srgb, var(--wpwm-accent) 9%, var(--wpwm-surface));

	/* Light sidebar */
	--wpwm-sidebar: #ffffff;
	--wpwm-sidebar-border: #e4e7ec;
	--wpwm-sidebar-text: #344054;
	--wpwm-sidebar-muted: #667085;
	--wpwm-sidebar-strong: #101828;
	--wpwm-sidebar-hover: #f4f6fa;
	--wpwm-sidebar-hover-text: #101828;
	--wpwm-sidebar-active: var(--wpwm-accent-soft);
	--wpwm-sidebar-active-text: var(--wpwm-accent-ink);
	--wpwm-sidebar-chip: #f2f4f7;
	--wpwm-sidebar-line: #e4e7ec;
}
/* A chosen theme colour (light mode). */
:root[data-wpwm-color] {
	--wpwm-accent: var(--wpwm-theme);
	--wpwm-accent-hover: color-mix(in srgb, var(--wpwm-theme) 82%, #000);
	--wpwm-accent-soft: color-mix(in srgb, var(--wpwm-theme) 12%, #fff);
	--wpwm-accent-bright: var(--wpwm-theme);
	--wpwm-accent-ink: var(--wpwm-ink, var(--wpwm-theme));
	--wpwm-on-accent: var(--wpwm-on-theme, #fff);
}

/* Dark mode (system setting): dark surfaces and sidebar, lighter accents. */
@media (prefers-color-scheme: dark) {
	:root {
		--wpwm-bg: #0f1319;
		--wpwm-surface: #171c24;
		--wpwm-border: #2a313c;
		--wpwm-text: #e7eaef;
		--wpwm-muted: #9aa4b2;
		--wpwm-warning: #f0b35a;
		--wpwm-warning-soft: #2e2414;
		--wpwm-critical: #f08a8a;
		--wpwm-critical-soft: #331a1c;
		--wpwm-on-critical: #0b0e13;
		--wpwm-shadow: none;
		--wpwm-on-accent: #0b0e13;
		--wpwm-sidebar: #0b0e13;
		--wpwm-sidebar-border: #1c222c;
		--wpwm-sidebar-text: #cbd2dc;
		--wpwm-sidebar-muted: #8b95a5;
		--wpwm-sidebar-strong: #ffffff;
		--wpwm-sidebar-hover: #1c222c;
		--wpwm-sidebar-hover-text: #ffffff;
		--wpwm-sidebar-active: #1c222c;
		--wpwm-sidebar-active-text: #ffffff;
		--wpwm-sidebar-chip: rgba(255, 255, 255, .08);
		--wpwm-sidebar-line: rgba(255, 255, 255, .12);
		--wpwm-table-head-text: var(--wpwm-accent-ink);
		--wpwm-table-hover: color-mix(in srgb, var(--wpwm-accent) 12%, var(--wpwm-surface));
	}
	:root { --wpwm-accent: #a3d65c; --wpwm-accent-hover: #b8e27e; --wpwm-accent-soft: #1f2a12; --wpwm-accent-bright: #8bc34a; }
	/* A chosen theme colour, lighter for dark surfaces; dark text on it. */
	:root[data-wpwm-color] {
		--wpwm-accent: color-mix(in srgb, var(--wpwm-theme) 60%, #fff);
		--wpwm-accent-hover: color-mix(in srgb, var(--wpwm-theme) 45%, #fff);
		--wpwm-accent-soft: color-mix(in srgb, var(--wpwm-theme) 22%, #171c24);
		--wpwm-accent-ink: var(--wpwm-accent);
		--wpwm-on-accent: #0b0e13;
	}
}


* { box-sizing: border-box; }

body.wpwm {
	margin: 0;
	background: var(--wpwm-bg);
	color: var(--wpwm-text);
	font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.screen-reader-text {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}

a { color: var(--wpwm-accent-ink); }

/* ---------- Shell ---------- */

.wpwm-shell { display: flex; min-height: 100vh; }

.wpwm-sidebar {
	position: sticky; top: 0;
	width: var(--wpwm-sidebar-width); flex-shrink: 0; height: 100vh; overflow-y: auto;
	background: var(--wpwm-sidebar); color: var(--wpwm-sidebar-text);
	border-right: 1px solid var(--wpwm-sidebar-border);
	padding: 20px 12px;
}

.wpwm-brand {
	display: flex; align-items: center; gap: 10px;
	padding: 4px 8px 20px; color: var(--wpwm-sidebar-strong); text-decoration: none;
}
.wpwm-brand-mark {
	display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
	/* Same colours as the buttons: the theme colour, with white or dark text to stay readable. */
	border-radius: 8px; background: var(--wpwm-accent); color: var(--wpwm-on-accent); font-weight: 700;
}
.wpwm-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wpwm-brand-text small {
	color: var(--wpwm-sidebar-muted); font-size: 12px;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.wpwm-nav ul { list-style: none; margin: 0 0 8px; padding: 0; }
/* Group label with a divider line above it, so each group reads as its own block. */
.wpwm-nav-group {
	margin: 14px 4px 6px; padding: 14px 6px 0; border-top: 1px solid var(--wpwm-sidebar-line);
	color: var(--wpwm-sidebar-strong);
	font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
}
.wpwm-nav a {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 8px 10px; border-radius: 7px;
	color: var(--wpwm-sidebar-text); text-decoration: none;
}
.wpwm-nav a:hover { background: var(--wpwm-sidebar-hover); color: var(--wpwm-sidebar-hover-text); }
.wpwm-nav a.is-active,
.wpwm-nav a.is-active:hover {
	background: var(--wpwm-sidebar-active); color: var(--wpwm-sidebar-active-text); font-weight: 600;
}
/* "Add on" badge on menu entries from the PRO edition (they link to the PRO site). */
.wpwm-pro {
	font-size: 10px; padding: 1px 7px; border-radius: 999px; letter-spacing: .06em; white-space: nowrap;
	background: var(--wpwm-accent-soft); color: var(--wpwm-accent-ink); font-weight: 700;
}

.wpwm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.wpwm-topbar {
	position: sticky; top: 0; z-index: 5;
	display: flex; align-items: center; gap: 12px;
	padding: 12px 28px; min-height: 60px;
	background: var(--wpwm-surface); border-bottom: 1px solid var(--wpwm-border);
}
.wpwm-title { margin: 0; font-size: 18px; font-weight: 650; flex: 1; min-width: 0; }

.wpwm-menu-toggle {
	display: none; border: 1px solid var(--wpwm-border); background: var(--wpwm-surface); color: var(--wpwm-text);
	width: 38px; height: 38px; border-radius: 8px; font-size: 18px; cursor: pointer;
}

/* Account: round avatar button + popup menu */
.wpwm-user { position: relative; margin-left: auto; flex-shrink: 0; }

.wpwm-avatar-button {
	display: block; padding: 2px; border: 0; border-radius: 50%;
	background: transparent; cursor: pointer; line-height: 0;
}
.wpwm-avatar-button:hover .wpwm-avatar,
.wpwm-avatar-button[aria-expanded="true"] .wpwm-avatar { box-shadow: 0 0 0 2px var(--wpwm-accent); }
.wpwm-avatar-button:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }

/* Avatar + caret badge on its bottom-right edge (outside .wpwm-avatar, which clips its image). */
.wpwm-avatar-wrap { position: relative; display: block; }

.wpwm-caret-badge {
	position: absolute; right: -3px; bottom: -3px;
	display: grid; place-items: center;
	width: 16px; height: 16px; border-radius: 50%;
	background: var(--wpwm-surface); color: var(--wpwm-muted);
	box-shadow: 0 0 0 1px var(--wpwm-border), 0 1px 2px rgba(16, 24, 40, .12);
	transition: background-color .15s, color .15s;
}
.wpwm-avatar-button:hover .wpwm-caret-badge,
.wpwm-avatar-button[aria-expanded="true"] .wpwm-caret-badge {
	background: var(--wpwm-accent); color: var(--wpwm-on-accent); box-shadow: 0 0 0 2px var(--wpwm-surface);
}

/* Caret: points down when closed, flips up while the menu is open. */
.wpwm-caret { display: block; transition: transform .15s ease; }
.wpwm-avatar-button[aria-expanded="true"] .wpwm-caret { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
	.wpwm-caret, .wpwm-user-menu { transition: none; animation: none; }
}

.wpwm-avatar {
	position: relative; display: grid; place-items: center;
	width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
	background: var(--wpwm-accent-soft); color: var(--wpwm-accent-ink);
	box-shadow: 0 0 0 1px var(--wpwm-border);
	transition: box-shadow .15s;
}
.wpwm-avatar-initials { font-size: 13px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.wpwm-avatar img {
	position: absolute; inset: 0; width: 100%; height: 100%;
	object-fit: cover; border-radius: 50%;
}

.wpwm-user-menu {
	position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
	min-width: 220px; padding: 6px;
	background: var(--wpwm-surface); border: 1px solid var(--wpwm-border); border-radius: var(--wpwm-radius);
	box-shadow: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
	animation: wpwm-pop .12s ease-out;
}
.wpwm-user-menu[hidden] { display: none; }
@keyframes wpwm-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.wpwm-user-menu-head {
	display: flex; flex-direction: column; gap: 1px;
	padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--wpwm-border);
	line-height: 1.3;
}
.wpwm-user-menu-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpwm-user-menu-head small { color: var(--wpwm-muted); font-size: 12px; }

.wpwm-user-menu a {
	display: block; padding: 8px 10px; border-radius: 6px;
	color: var(--wpwm-text); text-decoration: none; font-size: 13.5px;
}
.wpwm-user-menu a:hover,
.wpwm-user-menu a:focus-visible { background: var(--wpwm-bg); outline: none; }
.wpwm-user-menu a.is-logout { color: var(--wpwm-critical); }

/* Page content: a white sheet, centered in the area beside the sidebar. */
.wpwm-content {
	width: calc(100% - 56px); max-width: 1240px; margin: 28px auto;
	padding: 28px;
	background: var(--wpwm-surface);
	border: 1px solid var(--wpwm-border); border-radius: 14px;
	box-shadow: var(--wpwm-shadow);
}

/* ---------- Panels ---------- */

.wpwm-panel {
	background: var(--wpwm-surface); border: 1px solid var(--wpwm-border);
	border-radius: var(--wpwm-radius); box-shadow: var(--wpwm-shadow);
	padding: 20px; margin-bottom: 24px;
}
.wpwm-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wpwm-panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; }

.wpwm-empty { color: var(--wpwm-muted); }
.wpwm-panel.wpwm-empty { text-align: center; padding: 48px 20px; }
.wpwm-panel.wpwm-empty h2 { color: var(--wpwm-text); margin: 0 0 6px; font-size: 18px; }
.wpwm-error-code { font-size: 44px; font-weight: 700; margin: 0; color: var(--wpwm-border); }

.wpwm-button {
	display: inline-block; padding: 9px 16px; border-radius: 8px;
	background: var(--wpwm-accent); color: var(--wpwm-on-accent); text-decoration: none; font-weight: 600;
}
.wpwm-button:hover { filter: brightness(1.08); }

.wpwm-overlay { display: none; }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
	.wpwm-sidebar {
		position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
		transform: translateX(-100%); transition: transform .2s ease;
	}
	.wpwm-shell.is-open .wpwm-sidebar { transform: none; }
	.wpwm-shell.is-open .wpwm-overlay {
		display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .4);
	}
	.wpwm-menu-toggle { display: inline-grid; place-items: center; }
	.wpwm-topbar { padding: 10px 16px; }
	/* Phones/tablets: full width, no frame, so no screen space is lost. */
	.wpwm-content { width: 100%; margin: 0; padding: 20px 16px; border: 0; border-radius: 0; box-shadow: none; }
}

@media (max-width: 480px) {
}

/* =====================================================================
   Shared list / form components (Products and every list page after it)
   ===================================================================== */

/* ---------- Buttons ---------- */
.wpwm-button { border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2; }
.wpwm-button:disabled { opacity: .55; cursor: default; filter: none; }
.wpwm-button.is-secondary { background: var(--wpwm-surface); color: var(--wpwm-text); border-color: var(--wpwm-border); }
.wpwm-button.is-secondary:hover:not(:disabled) { background: var(--wpwm-bg); filter: none; }
.wpwm-button.is-danger { background: var(--wpwm-critical); color: var(--wpwm-on-critical); }
.wpwm-button:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }

.wpwm-link-button {
	border: 0; background: none; padding: 4px 6px; border-radius: 6px;
	color: var(--wpwm-accent-ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.wpwm-link-button:hover { background: var(--wpwm-accent-soft); }
.wpwm-link-button.is-danger { color: var(--wpwm-critical); }
.wpwm-link-button.is-danger:hover { background: var(--wpwm-critical-soft); }
.wpwm-link-button:disabled { opacity: .5; cursor: default; }

.wpwm-icon-button {
	width: 32px; height: 32px; border: 0; border-radius: 8px; background: none;
	color: var(--wpwm-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.wpwm-icon-button:hover { background: var(--wpwm-bg); color: var(--wpwm-text); }

/* ---------- Inputs ---------- */
.wpwm-input, .wpwm-select {
	width: 100%; padding: 8px 11px; border: 1px solid var(--wpwm-border); border-radius: 8px;
	background: var(--wpwm-surface); color: var(--wpwm-text); font: inherit; line-height: 1.4;
}
.wpwm-select { width: auto; padding-right: 30px; }
.wpwm-input:focus, .wpwm-select:focus { outline: none; border-color: var(--wpwm-accent); box-shadow: 0 0 0 3px var(--wpwm-accent-soft); }
.wpwm-input[aria-invalid="true"], .wpwm-select[aria-invalid="true"] { border-color: var(--wpwm-critical); }
textarea.wpwm-input { resize: vertical; min-height: 72px; }

/* ---------- Toolbar ---------- */
.wpwm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.wpwm-search { flex: 1 1 260px; max-width: 420px; }
.wpwm-toolbar .wpwm-button { margin-left: auto; }

/* ---------- Table ---------- */
.wpwm-table-panel { padding: 0; overflow: hidden; }
.wpwm-table-wrap { overflow-x: auto; }
.wpwm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wpwm-table th, .wpwm-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--wpwm-border); vertical-align: middle; }
.wpwm-table th { background: var(--wpwm-table-head); color: var(--wpwm-table-head-text); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.wpwm-table tbody tr:hover td { background: var(--wpwm-table-hover); }
.wpwm-table tbody tr:last-child td { border-bottom: 0; }
.wpwm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wpwm-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
.wpwm-table .actions { text-align: right; white-space: nowrap; width: 1%; }
.wpwm-cell-title { display: block; font-weight: 600; }
.wpwm-cell-sub { display: block; color: var(--wpwm-muted); font-size: 12px; }

/* Second line that opens a list on hover / focus / tap (e.g. "3 rsvd" → its sales orders). */
.wpwm-sub-pop-trigger {
	display: inline-block; margin: 0 0 0 auto; padding: 0; border: 0; background: none; font: inherit; font-size: 12px;
	color: var(--wpwm-muted); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help;
}
.num .wpwm-sub-pop-trigger { display: block; margin-left: auto; }
.wpwm-sub-pop-trigger:hover, .wpwm-sub-pop-trigger[aria-expanded="true"] { color: var(--wpwm-accent-ink); }
.wpwm-sub-pop-trigger:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; border-radius: 3px; }
.wpwm-sub-pop {
	position: fixed; z-index: 1000; min-width: 200px; max-width: min(320px, calc(100vw - 16px)); max-height: 280px; overflow-y: auto;
	padding: 10px 12px; background: var(--wpwm-surface); color: var(--wpwm-text); text-align: left;
	border: 1px solid var(--wpwm-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.wpwm-sub-pop[hidden] { display: none; }
.wpwm-sub-pop-title { margin: 0 0 6px; color: var(--wpwm-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.wpwm-sub-pop-list { margin: 0; padding: 0; list-style: none; }
.wpwm-sub-pop-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.wpwm-sub-pop-list li + li { border-top: 1px solid var(--wpwm-border); }
.wpwm-sub-pop-link { font-weight: 600; white-space: nowrap; }
a.wpwm-sub-pop-link { color: var(--wpwm-accent-ink); text-decoration: none; }
a.wpwm-sub-pop-link:hover, a.wpwm-sub-pop-link:focus-visible { text-decoration: underline; }
.wpwm-sub-pop-meta { color: var(--wpwm-muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.wpwm-table-message { text-align: center !important; padding: 40px 16px !important; color: var(--wpwm-muted); }

.wpwm-sort {
	display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
	color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer;
}
.wpwm-sort::after { content: "\2195"; opacity: .35; font-size: 11px; }
.wpwm-sort.is-active { color: var(--wpwm-text); }
.wpwm-sort.is-active::after { content: "\2191"; opacity: 1; }
.wpwm-sort.is-active.is-desc::after { content: "\2193"; }
.wpwm-table th.num .wpwm-sort { flex-direction: row-reverse; }

.is-loading .wpwm-table tbody { opacity: .5; transition: opacity .15s; }

/* ---------- Badges ---------- */
.wpwm-badge {
	display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
	font-size: 11.5px; font-weight: 600; line-height: 1.5; vertical-align: middle;
}
td > .wpwm-badge:first-child { margin-left: 0; }
.wpwm-badge.is-success { background: #e7f6ec; color: #15803d; }
.wpwm-badge.is-muted { background: var(--wpwm-bg); color: var(--wpwm-muted); border: 1px solid var(--wpwm-border); }
.wpwm-badge.is-warning { background: var(--wpwm-warning-soft); color: var(--wpwm-warning); }
@media (prefers-color-scheme: dark) {
	.wpwm-badge.is-success { background: #14301e; color: #6ee7a0; }
}

/* ---------- Pagination ---------- */
.wpwm-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--wpwm-border); }
.wpwm-pagination-summary { margin: 0; color: var(--wpwm-muted); font-size: 13px; }
.wpwm-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.wpwm-pager[hidden] { display: none; }

/* Numbered page links (shared component: WPWM.pagination) */
.wpwm-page-number,
.wpwm-page-step {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 34px; height: 34px; padding: 0 10px;
	border: 1px solid var(--wpwm-border); border-radius: 8px;
	background: var(--wpwm-surface); color: var(--wpwm-text);
	font-size: 13px; font-weight: 500; text-decoration: none; font-variant-numeric: tabular-nums;
	transition: background-color .12s, border-color .12s, color .12s;
}
a.wpwm-page-number:hover,
a.wpwm-page-step:hover { border-color: var(--wpwm-accent); color: var(--wpwm-accent-ink); background: var(--wpwm-accent-soft); }
.wpwm-page-number:focus-visible,
.wpwm-page-step:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }
.wpwm-page-number.is-current { background: var(--wpwm-accent); border-color: var(--wpwm-accent); color: var(--wpwm-on-accent); font-weight: 600; }
.wpwm-page-step.is-disabled { opacity: .45; cursor: default; }
.wpwm-page-gap { min-width: 22px; text-align: center; color: var(--wpwm-muted); }
.wpwm-page-step { gap: 6px; }
@media (max-width: 480px) {
	.wpwm-page-step-label { display: none; } /* Arrows only on phones; aria-label keeps the word. */
	.wpwm-pager { flex-wrap: nowrap; }
}

/* ---------- Dialogs ---------- */
.wpwm-dialog {
	width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
	border: 1px solid var(--wpwm-border); border-radius: 14px;
	background: var(--wpwm-surface); color: var(--wpwm-text);
	box-shadow: 0 24px 64px rgba(16, 24, 40, .25);
}
.wpwm-dialog.is-small { width: min(440px, calc(100vw - 32px)); }
.wpwm-dialog::backdrop { background: rgba(15, 19, 25, .5); }
.wpwm-dialog[open] { animation: wpwm-pop .14s ease-out; }
.wpwm-dialog .wpwm-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.wpwm-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--wpwm-border); }
.wpwm-dialog-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.wpwm-dialog-body { padding: 18px 20px; overflow-y: auto; }
.wpwm-dialog-body > p { margin: 0 0 8px; }
.wpwm-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--wpwm-border); background: var(--wpwm-bg); border-radius: 0 0 14px 14px; }

/* ---------- Form fields ---------- */
.wpwm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.wpwm-grid .span-2 { grid-column: 1 / -1; }
.wpwm-field label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }
.wpwm-field .wpwm-select { width: 100%; }
.wpwm-field .req { color: var(--wpwm-critical); }
.wpwm-field-hint { margin: 4px 0 0; color: var(--wpwm-muted); font-size: 12px; }
.wpwm-field-error { margin: 4px 0 0; color: var(--wpwm-critical); font-size: 12.5px; }
.wpwm-field-error:empty { display: none; }
.wpwm-form-error { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--wpwm-critical-soft); color: var(--wpwm-critical); font-size: 13.5px; }

/* ---------- Toast: top center of the window, just under the header bar ---------- */
.wpwm-toast {
	position: fixed; top: 76px; z-index: 1000;
	left: 50%; transform: translateX(-50%);
	width: max-content; max-width: min(560px, calc(100vw - 32px));
	padding: 12px 18px; border-radius: 10px; background: #111827; color: #fff;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .25); font-size: 14px; line-height: 1.45;
	animation: wpwm-drop .18s ease-out;
}
.wpwm-toast.is-error { background: var(--wpwm-critical); box-shadow: 0 12px 32px rgba(185, 28, 28, .3); }
@keyframes wpwm-drop {
	from { opacity: 0; transform: translate(-50%, -10px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 900px) {
	.wpwm-toast { top: 68px; }
}
/* Shown in the browser's top layer (popover) so it sits above open dialogs too.
   Reset the browser's default popover box (centered, bordered, full inset). */
.wpwm-toast[popover] { inset: auto; margin: 0; overflow: visible; }
.wpwm-toast[popover]:popover-open { top: 76px; left: 50%; }
@media (max-width: 900px) {
	.wpwm-toast[popover]:popover-open { top: 68px; }
}
@media (prefers-reduced-motion: reduce) {
	.wpwm-toast { animation: none; }
}
.wpwm-toast[hidden] { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
	.wpwm-table .hide-sm { display: none; }
	.wpwm-grid { grid-template-columns: 1fr; }
	.wpwm-search { max-width: none; flex-basis: 100%; }
	.wpwm-toolbar .wpwm-button { margin-left: 0; }
	.wpwm-pagination { flex-direction: column; align-items: stretch; text-align: center; }
	.wpwm-pager { justify-content: center; }
	.wpwm-page-number, .wpwm-page-step { min-width: 32px; height: 32px; padding: 0 8px; }
}

/* ---------- Deleted products (trash view) ---------- */
/* "Trashed (N)" link in its own row directly above the table */
.wpwm-table-views { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: -6px 0 8px; font-size: 13px; }
.wpwm-trash-link { color: var(--wpwm-critical); font-weight: 500; text-decoration: none; }
.wpwm-trash-link:hover { text-decoration: underline; }
.wpwm-trash-link.is-empty { color: var(--wpwm-muted); }

.wpwm-view-bar {
	display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
	margin-bottom: 14px; padding: 10px 14px; border-radius: var(--wpwm-radius);
	background: var(--wpwm-warning-soft); border: 1px solid var(--wpwm-border);
}
.wpwm-view-bar p { margin: 0; color: var(--wpwm-muted); font-size: 13px; }
.wpwm-back-link { font-weight: 600; text-decoration: none; white-space: nowrap; }
.wpwm-back-link:hover { text-decoration: underline; }
.is-trash .wpwm-table tbody td { color: var(--wpwm-muted); }
.is-trash .wpwm-table .wpwm-cell-title { color: var(--wpwm-text); }
.wpwm-table .nowrap { white-space: nowrap; }

/* Toast action button (Undo) */
.wpwm-toast { display: flex; align-items: center; gap: 14px; }
.wpwm-toast[hidden] { display: none; }
.wpwm-toast-action {
	margin-left: auto; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px;
	background: transparent; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.wpwm-toast-action:hover { background: rgba(255, 255, 255, .12); }


/* Spacing inside the white page sheet */
.wpwm-content > :last-child,
.wpwm-table-panel { margin-bottom: 0; }
.wpwm-pagination[hidden] { display: none; }

/* Product name that opens the edit form */
.wpwm-name-link {
	padding: 0; border: 0; background: none; cursor: pointer;
	color: var(--wpwm-text); font: inherit; font-weight: 600; text-align: left;
}
.wpwm-name-link:hover { color: var(--wpwm-accent-ink); text-decoration: underline; }
.wpwm-name-link:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; border-radius: 3px; }
.wpwm-name-link:disabled { opacity: .6; cursor: progress; }

/* ---------- Row selection + bulk actions ---------- */
.wpwm-table th.check, .wpwm-table td.check { width: 1%; padding-right: 0; }
.wpwm-check { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--wpwm-accent); cursor: pointer; }
.wpwm-table tbody tr.is-selected td { background: var(--wpwm-accent-soft); }

.wpwm-bulk { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.wpwm-bulk[hidden] { display: none; }
.wpwm-bulk-count { font-weight: 600; color: var(--wpwm-text); }
.wpwm-button.is-small { padding: 6px 12px; font-size: 13px; }
.wpwm-table-views { min-height: 32px; }

/* ---------- Sidebar sub-menus (Products → All Products / Categories / Units) ---------- */
.wpwm-nav-parent {
	display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
	padding: 8px 10px; border: 0; border-radius: 7px; background: none; cursor: pointer;
	color: var(--wpwm-sidebar-text); font: inherit; text-align: left;
}
.wpwm-nav-parent:hover { background: var(--wpwm-sidebar-hover); color: var(--wpwm-sidebar-hover-text); }
.wpwm-nav-parent.is-current { color: var(--wpwm-sidebar-active-text); font-weight: 600; }
.wpwm-nav-parent:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: -2px; }
.wpwm-nav-parent .wpwm-caret { opacity: .7; transition: transform .15s ease; }
.wpwm-nav-parent[aria-expanded="true"] .wpwm-caret { transform: rotate(180deg); }
.wpwm-nav .wpwm-subnav { margin: 2px 0 6px 14px; padding-left: 8px; border-left: 1px solid var(--wpwm-sidebar-line); }
.wpwm-subnav[hidden] { display: none; }
.wpwm-subnav a { padding: 6px 10px; font-size: 13.5px; }

/* ---------- Breadcrumb in the top bar: "Products / Categories" ---------- */
.wpwm-crumb { color: var(--wpwm-muted); font-weight: 500; text-decoration: none; }
.wpwm-crumb:hover { color: var(--wpwm-accent-ink); text-decoration: underline; }
.wpwm-crumb-sep { margin: 0 6px; color: var(--wpwm-border); font-weight: 400; }

/* Toast with a list of reasons (bulk delete: skipped items) */
.wpwm-toast-body { display: flex; flex-direction: column; gap: 6px; }
.wpwm-toast-list { margin: 0; padding-left: 18px; font-size: 12.5px; opacity: .92; }
.wpwm-toast-list li { margin: 2px 0; }

/* =====================================================================
   Form pages (add / edit): partials/form-page.php + assets/js/pages/form.js
   ===================================================================== */
/* Fills the white page sheet so the sticky save bar spans it edge to edge. */
.wpwm-form-page { width: 100%; }
.wpwm-form-section-body { max-width: 760px; }
.wpwm-form-page > .wpwm-form-error { margin-bottom: 20px; }

.wpwm-form-section {
	display: grid; grid-template-columns: 240px 1fr; gap: 16px 40px;
	padding: 24px 0; border-bottom: 1px solid var(--wpwm-border);
}
.wpwm-form-section:first-of-type { padding-top: 4px; }
.wpwm-form-section-head h2 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.wpwm-form-section-head p { margin: 0; color: var(--wpwm-muted); font-size: 13px; line-height: 1.5; }
.wpwm-form-section-body { min-width: 0; }

/* Save bar stays in reach on long forms. */
.wpwm-form-actions {
	position: sticky; bottom: 0; z-index: 4;
	display: flex; justify-content: flex-end; gap: 10px;
	margin: 0 -28px -28px; padding: 14px 28px;
	background: var(--wpwm-surface); border-top: 1px solid var(--wpwm-border);
	border-radius: 0 0 14px 14px;
}
.wpwm-form-actions .wpwm-button { text-decoration: none; }

/* Read-only figures (e.g. stock on the product form) */
.wpwm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 8px; }
.wpwm-stats div { padding: 10px 12px; border: 1px solid var(--wpwm-border); border-radius: 8px; background: var(--wpwm-bg); }
.wpwm-stats dt { color: var(--wpwm-muted); font-size: 12px; }
.wpwm-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.wpwm-field-hint.is-warning { color: var(--wpwm-warning); font-weight: 500; }
.wpwm-margin:empty { display: none; }

/* Links styled as the buttons they replace (Add / Edit on list pages). */
a.wpwm-button { text-decoration: none; }
a.wpwm-link-button { display: inline-block; text-decoration: none; }
a.wpwm-name-link { text-decoration: none; }

@media (max-width: 900px) {
	.wpwm-form-section { grid-template-columns: 1fr; gap: 12px; }
	.wpwm-form-actions { margin: 0 -16px -20px; padding: 12px 16px; border-radius: 0; }
}
@media (max-width: 480px) {
	.wpwm-form-actions { flex-wrap: wrap; }
	.wpwm-form-actions .wpwm-button { flex: 1 1 auto; text-align: center; }
	.wpwm-stats { grid-template-columns: 1fr; }
}

/* =====================================================================
   Notification types (shared WPWM.toast): success · info · warning · error
   Same place and shape everywhere; colour + icon tell them apart.
   Fixed colours on purpose: readable with white text in light and dark mode.
   ===================================================================== */
.wpwm-toast {
	display: flex; align-items: flex-start; gap: 12px;
	min-width: min(340px, calc(100vw - 32px));
	padding: 12px 10px 12px 14px;
}
.wpwm-toast[hidden] { display: none; }
.wpwm-toast-icon {
	flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px;
	border-radius: 50%; font-size: 13px; font-weight: 800; line-height: 1;
	background: rgba(255, 255, 255, .2); color: #fff;
}
.wpwm-toast-body { flex: 1; min-width: 0; padding-top: 2px; }
.wpwm-toast-text { display: block; font-weight: 500; }
.wpwm-toast-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; opacity: .95; }
.wpwm-toast-action { margin-left: 0; align-self: center; flex: none; }
.wpwm-toast-close {
	flex: none; width: 26px; height: 26px; margin: -2px 0 0; padding: 0;
	border: 0; border-radius: 6px; background: none; color: inherit;
	font-size: 20px; line-height: 1; opacity: .7; cursor: pointer;
}
.wpwm-toast-close:hover, .wpwm-toast-close:focus-visible { opacity: 1; background: rgba(255, 255, 255, .15); outline: none; }

.wpwm-toast.is-success { background: #111827; box-shadow: 0 12px 32px rgba(16, 24, 40, .25); }
.wpwm-toast.is-success .wpwm-toast-icon { background: #16a34a; }
.wpwm-toast.is-info { background: #111827; box-shadow: 0 12px 32px rgba(16, 24, 40, .25); }
.wpwm-toast.is-info .wpwm-toast-icon { background: #2563eb; font-family: Georgia, serif; font-style: italic; }
.wpwm-toast.is-warning { background: #b45309; box-shadow: 0 12px 32px rgba(180, 83, 9, .3); }
.wpwm-toast.is-error { background: #b91c1c; box-shadow: 0 12px 32px rgba(185, 28, 28, .3); }

/* =====================================================================
   Notification colours: Bootstrap 5 alerts (light) / Bootstrap 5.3 dark-mode alerts.
   success = .alert-success · info = .alert-info · warning = .alert-warning · error = .alert-danger
   ===================================================================== */
.wpwm-toast {
	--wpwm-toast-bg: #f8f9fa;
	--wpwm-toast-text: #212529;
	--wpwm-toast-border: #e9ecef;
	--wpwm-toast-icon: #6c757d;
	background: var(--wpwm-toast-bg);
	color: var(--wpwm-toast-text);
	border: 1px solid var(--wpwm-toast-border);
	box-shadow: 0 10px 28px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
}
.wpwm-toast.is-success { --wpwm-toast-bg: #d1e7dd; --wpwm-toast-text: #0a3622; --wpwm-toast-border: #a3cfbb; --wpwm-toast-icon: #198754; }
.wpwm-toast.is-info    { --wpwm-toast-bg: #cff4fc; --wpwm-toast-text: #055160; --wpwm-toast-border: #9eeaf9; --wpwm-toast-icon: #0aa2c0; }
.wpwm-toast.is-warning { --wpwm-toast-bg: #fff3cd; --wpwm-toast-text: #664d03; --wpwm-toast-border: #ffe69c; --wpwm-toast-icon: #ffc107; }
.wpwm-toast.is-error   { --wpwm-toast-bg: #f8d7da; --wpwm-toast-text: #58151c; --wpwm-toast-border: #f1aeb5; --wpwm-toast-icon: #dc3545; }

/* Same rule for every type, so the earlier dark backgrounds/shadows no longer apply. */
.wpwm-toast.is-success, .wpwm-toast.is-info, .wpwm-toast.is-warning, .wpwm-toast.is-error {
	background: var(--wpwm-toast-bg);
	box-shadow: 0 10px 28px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
}
.wpwm-toast .wpwm-toast-icon,
.wpwm-toast.is-success .wpwm-toast-icon,
.wpwm-toast.is-info .wpwm-toast-icon { background: var(--wpwm-toast-icon); color: #fff; }
.wpwm-toast.is-warning .wpwm-toast-icon { color: #000; } /* Bootstrap: dark text on yellow. */

/* Undo and × follow the alert's text colour. */
.wpwm-toast .wpwm-toast-action {
	color: var(--wpwm-toast-text); border-color: color-mix(in srgb, var(--wpwm-toast-text) 35%, transparent);
	background: rgba(255, 255, 255, .45);
}
.wpwm-toast .wpwm-toast-action:hover { background: rgba(255, 255, 255, .8); }
.wpwm-toast .wpwm-toast-close:hover,
.wpwm-toast .wpwm-toast-close:focus-visible { background: color-mix(in srgb, var(--wpwm-toast-text) 12%, transparent); }

@media (prefers-color-scheme: dark) {
	.wpwm-toast.is-success { --wpwm-toast-bg: #051b11; --wpwm-toast-text: #75b798; --wpwm-toast-border: #0f5132; }
	.wpwm-toast.is-info    { --wpwm-toast-bg: #032830; --wpwm-toast-text: #6edff6; --wpwm-toast-border: #087990; }
	.wpwm-toast.is-warning { --wpwm-toast-bg: #332701; --wpwm-toast-text: #ffda6a; --wpwm-toast-border: #997404; }
	.wpwm-toast.is-error   { --wpwm-toast-bg: #2c0b0e; --wpwm-toast-text: #ea868f; --wpwm-toast-border: #842029; }
	.wpwm-toast.is-success, .wpwm-toast.is-info, .wpwm-toast.is-warning, .wpwm-toast.is-error { box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
	.wpwm-toast .wpwm-toast-action { background: rgba(255, 255, 255, .06); }
	.wpwm-toast .wpwm-toast-action:hover { background: rgba(255, 255, 255, .12); }
}

/* =====================================================================
   Inline alerts (Bootstrap 5 colours, same as notifications), e.g. inside dialogs:
   <div class="wpwm-alert is-warning"><strong>Title</strong><ul class="wpwm-alert-list">…</ul></div>
   ===================================================================== */
.wpwm-alert { margin: 14px 0 0; padding: 12px 14px; border: 1px solid; border-radius: 8px; font-size: 13.5px; line-height: 1.5; }
.wpwm-alert[hidden] { display: none; }
.wpwm-alert strong { display: block; font-weight: 600; }
.wpwm-alert-list { margin: 6px 0 0; padding-left: 18px; }
.wpwm-alert-list li { margin: 3px 0; }
.wpwm-alert.is-success { background: #d1e7dd; color: #0a3622; border-color: #a3cfbb; }
.wpwm-alert.is-info    { background: #cff4fc; color: #055160; border-color: #9eeaf9; }
.wpwm-alert.is-warning { background: #fff3cd; color: #664d03; border-color: #ffe69c; }
.wpwm-alert.is-danger  { background: #f8d7da; color: #58151c; border-color: #f1aeb5; }
@media (prefers-color-scheme: dark) {
	.wpwm-alert.is-success { background: #051b11; color: #75b798; border-color: #0f5132; }
	.wpwm-alert.is-info    { background: #032830; color: #6edff6; border-color: #087990; }
	.wpwm-alert.is-warning { background: #332701; color: #ffda6a; border-color: #997404; }
	.wpwm-alert.is-danger  { background: #2c0b0e; color: #ea868f; border-color: #842029; }
}
/* Delete dialog in warning mode: amber top edge so the change is obvious. */
.wpwm-dialog.is-warning { border-top: 4px solid #ffc107; }

/* ---------- Dialogs (confirmations / warnings): top center, like notifications ---------- */
.wpwm-dialog {
	/* Browsers center a modal dialog vertically; pin it under the header bar instead. */
	margin: 76px auto auto;
	max-height: calc(100vh - 100px);
}
.wpwm-dialog .wpwm-form { max-height: calc(100vh - 102px); }
@media (max-width: 900px) {
	.wpwm-dialog { margin-top: 68px; max-height: calc(100vh - 84px); }
	.wpwm-dialog .wpwm-form { max-height: calc(100vh - 86px); }
}

/* Red badge (e.g. "Out of Stock"), Bootstrap danger colours like the alerts. */
.wpwm-badge.is-danger { background: #f8d7da; color: #b02a37; }
@media (prefers-color-scheme: dark) {
	.wpwm-badge.is-danger { background: #2c0b0e; color: #ea868f; }
}

/* Flagged value in a list cell (e.g. Available at or below the reorder level): coloured text, no badge. */
.wpwm-flagged { font-weight: 600; cursor: help; }
.wpwm-flagged.is-warning { color: var(--wpwm-warning); }
.wpwm-flagged.is-danger { color: #b02a37; }
@media (prefers-color-scheme: dark) {
	.wpwm-flagged.is-danger { color: #ea868f; }
}

/* Tabs (Settings sections): links, one per tab, current one underlined.
   Many tabs scroll sideways on small screens; never vertically. The baseline is an inset
   shadow (not a border + negative margin), so nothing spills below the bar. */
.wpwm-tabs {
	display: flex; gap: 4px;
	overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
	margin: -4px 0 20px; box-shadow: inset 0 -1px 0 var(--wpwm-border);
}
.wpwm-tabs::-webkit-scrollbar { display: none; }
.wpwm-tab {
	flex: none; padding: 10px 14px; white-space: nowrap;
	color: var(--wpwm-muted); font-weight: 500; text-decoration: none;
	border-bottom: 2px solid transparent;
}
.wpwm-tab:hover { color: var(--wpwm-text); }
.wpwm-tab.is-active { color: var(--wpwm-accent-ink); border-bottom-color: var(--wpwm-accent); font-weight: 600; }
.wpwm-tab:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: -2px; border-radius: 6px 6px 0 0; }
/* A tab that comes with an add-on not installed yet (links to the add-on's page): "Add on" badge. */
.wpwm-tab .wpwm-pro { margin-left: 6px; vertical-align: 1px; }

/* =====================================================================
   Product form → Variations (assets/js/pages/product-variations.js)
   ===================================================================== */
.wpwm-var-block + .wpwm-var-block { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--wpwm-border); }
.wpwm-var-block h3 { margin: 0 0 4px; font-size: 14px; font-weight: 650; }
.wpwm-var-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.wpwm-var-head .wpwm-count { color: var(--wpwm-muted); font-weight: 500; }
.wpwm-var-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wpwm-var-head .wpwm-var-actions { margin-top: 0; }

.wpwm-attr-list { display: grid; gap: 8px; margin-top: 10px; }
.wpwm-attr-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; }

/* The variations table can be wider than the form column: it scrolls sideways inside its section. */
.wpwm-var-wrap { overflow-x: auto; border: 1px solid var(--wpwm-border); border-radius: 8px; }
.wpwm-var-wrap > .wpwm-field-hint { margin: 0; padding: 14px; }
.wpwm-var-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wpwm-var-table th, .wpwm-var-table td { padding: 6px; border-bottom: 1px solid var(--wpwm-border); vertical-align: top; text-align: left; }
.wpwm-var-table th { background: var(--wpwm-table-head); color: var(--wpwm-table-head-text); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.wpwm-var-table th.num { text-align: right; }
.wpwm-var-table tbody tr:last-child td { border-bottom: 0; }
.wpwm-var-table .wpwm-input, .wpwm-var-table .wpwm-select { min-width: 84px; padding: 6px 8px; font-size: 13px; }
.wpwm-var-table .wpwm-input.mono { min-width: 130px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.wpwm-var-table .wpwm-input.num { min-width: 76px; text-align: right; }
.wpwm-var-table .actions { width: 1%; vertical-align: middle; }
.wpwm-var-table .wpwm-field-error:empty { display: none; }
.wpwm-var-table .wpwm-field-error { margin: 4px 0 0; font-size: 12px; white-space: normal; }

/* The Variations section puts its heading above and uses the full width of the sheet for its table. */
.wpwm-form-section[data-show-for="type:variable"] { grid-template-columns: 1fr; }
.wpwm-form-section[data-show-for="type:variable"] .wpwm-form-section-head p { max-width: 640px; }
.wpwm-form-section[data-show-for="type:variable"] .wpwm-form-section-body { max-width: none; }

@media (max-width: 600px) {
	.wpwm-attr-row { grid-template-columns: 1fr auto; }
	.wpwm-attr-row input:nth-child(2) { grid-column: 1; }
	.wpwm-attr-row button { grid-row: 1; grid-column: 2; }
}

/* Parts hidden by data-show-for (form.js): beats display: grid / flex on sections and fields. */
[data-show-for][hidden] { display: none !important; }
.wpwm-convert-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--wpwm-warning-soft); }

/* =====================================================================
   Searchable selects (app.js): button + dropdown with a search box.
   The real <select> stays underneath, invisible, for forms and scripts.
   ===================================================================== */
.wpwm-combo { position: relative; display: inline-block; min-width: 0; max-width: 100%; vertical-align: middle; }
.wpwm-field .wpwm-combo, .wpwm-var-table .wpwm-combo { display: block; width: 100%; }
.wpwm-combo-native {
	position: absolute !important; inset: 0; width: 100% !important; height: 100% !important;
	opacity: 0; pointer-events: none; margin: 0;
}
.wpwm-combo-button {
	display: flex; align-items: center; width: 100%; min-height: 38px; text-align: left; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b7685' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 10px center;
}
.wpwm-combo-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpwm-combo-button:disabled { cursor: default; opacity: .6; }
.wpwm-combo.is-open .wpwm-combo-button { border-color: var(--wpwm-accent); box-shadow: 0 0 0 3px var(--wpwm-accent-soft); }
.wpwm-var-table .wpwm-combo-button { min-height: 32px; padding: 6px 26px 6px 8px; background-position: right 8px center; }

.wpwm-combo-pop {
	position: fixed; z-index: 100000; display: flex; flex-direction: column; min-height: 0;
	inset: auto; margin: 0; overflow: visible; /* Undo the browser's popover defaults; place() sets top / left. */
	padding: 6px; background: var(--wpwm-surface); color: var(--wpwm-text);
	border: 1px solid var(--wpwm-border); border-radius: 10px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.wpwm-combo-search { flex: none; margin-bottom: 6px; padding: 7px 10px; font-size: 13.5px; }
.wpwm-combo-search:focus { outline: none; border-color: var(--wpwm-accent); box-shadow: 0 0 0 3px var(--wpwm-accent-soft); }
.wpwm-combo-list { flex: 1; min-height: 0; max-height: 260px; overflow-y: auto; margin: 0; padding: 0; list-style: none; overscroll-behavior: contain; }
.wpwm-combo-option {
	position: relative; padding: 7px 10px 7px 28px; border-radius: 6px; font-size: 13.5px; line-height: 1.35; cursor: pointer;
	overflow-wrap: anywhere;
}
.wpwm-combo-option.is-sub { padding-left: 44px; }
.wpwm-combo-option.is-active { background: var(--wpwm-accent-soft); }
.wpwm-combo-option[aria-selected="true"] { font-weight: 600; color: var(--wpwm-accent-ink); }
.wpwm-combo-option[aria-selected="true"]::before { content: "✓"; position: absolute; left: 10px; }
.wpwm-combo-option.is-disabled { opacity: .5; cursor: default; }
/* Second line under an option (data-meta), e.g. a sales order's status, date and amount to bill. */
.wpwm-combo-option[data-meta]:not([data-meta=""])::after {
	content: attr(data-meta); display: block; margin-top: 1px;
	color: var(--wpwm-muted); font-size: 12px; font-weight: 400;
}
.wpwm-combo-empty { padding: 10px; color: var(--wpwm-muted); font-size: 13px; text-align: center; }

/* Form section with a table (e.g. purchase order lines): heading above, full width. */
.wpwm-form-section.is-wide { grid-template-columns: 1fr; }
.wpwm-form-section.is-wide .wpwm-form-section-head p { max-width: 640px; }
.wpwm-form-section.is-wide .wpwm-form-section-body { max-width: none; }

/* =====================================================================
   Purchase / sales orders: status strip, order lines (assets/js/pages/order-lines.js)
   ===================================================================== */
.wpwm-doc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -4px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--wpwm-border); }
.wpwm-doc-number { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; font-weight: 650; }
.wpwm-doc-meta { color: var(--wpwm-muted); font-size: 13px; }

.wpwm-po-search { position: relative; margin-bottom: 12px; max-width: 640px; }
.wpwm-po-results {
	position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0;
	max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
	background: var(--wpwm-surface); border: 1px solid var(--wpwm-border); border-radius: 10px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.wpwm-po-results[hidden] { display: none; }
.wpwm-po-result { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.wpwm-po-result.is-active { background: var(--wpwm-accent-soft); }
.wpwm-po-result.is-empty { color: var(--wpwm-muted); cursor: default; text-align: center; }
.wpwm-po-result-name { font-weight: 600; font-size: 13.5px; }
.wpwm-po-result-meta { color: var(--wpwm-muted); font-size: 12px; }

.wpwm-po-table-wrap { overflow-x: auto; border: 1px solid var(--wpwm-border); border-radius: 8px; }
.wpwm-po-empty { margin: 0; padding: 18px 14px; text-align: center; }
.wpwm-po-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wpwm-po-table th, .wpwm-po-table td { padding: 8px 10px; border-bottom: 1px solid var(--wpwm-border); text-align: left; vertical-align: top; }
.wpwm-po-table th { background: var(--wpwm-table-head); color: var(--wpwm-table-head-text); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.wpwm-po-table .num { text-align: right; }
.wpwm-po-table tbody tr:last-child td { border-bottom: 0; }
.wpwm-po-table td.num:not(:has(input)) { padding-top: 10px; font-variant-numeric: tabular-nums; }
.wpwm-po-table .wpwm-input.num { width: 110px; padding: 6px 8px; text-align: right; }
/* Remove (×): a square button lined up with the row's inputs, × centred in it. */
.wpwm-po-table .actions { width: 1%; vertical-align: top; }
.wpwm-po-table .actions .wpwm-link-button {
	display: inline-flex; align-items: center; justify-content: center;
	width: 32px; height: 32px; padding: 0; font-size: 18px; line-height: 1;
}
.wpwm-po-table .wpwm-cell-sub { display: block; }
.wpwm-po-table .wpwm-field-error:empty { display: none; }
.wpwm-po-table .wpwm-field-error { margin: 4px 0 0; font-size: 12px; text-align: left; }
.wpwm-po-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; padding: 0 10px; color: var(--wpwm-muted); }
.wpwm-po-total-value { color: var(--wpwm-text); font-size: 18px; font-variant-numeric: tabular-nums; }

/* "Cancel order" sits on the left of the save bar, away from Complete. */
.wpwm-form-actions .wpwm-po-cancel { order: -1; margin-right: auto; color: var(--wpwm-critical); }

/* Short note beside a field label, e.g. "Optional". */
.wpwm-label-hint { margin-left: 6px; color: var(--wpwm-muted); font-size: 12px; font-weight: 400; opacity: .8; }

/* Editing a completed purchase order: stock effect per line and in the confirmation. */
.wpwm-po-stock-list .is-up { color: #146c43; }
.wpwm-po-stock-list .is-down { color: var(--wpwm-critical); }
.wpwm-po-stock-list { margin: 8px 0 0; padding-left: 18px; }
.wpwm-po-stock-list li { margin: 4px 0; }
@media (prefers-color-scheme: dark) { .wpwm-po-stock-list .is-up { color: #75b798; } }

/* Received vs ordered: "2 short" / "3 over" (purchase orders). */
.wpwm-po-diff { display: block; margin-top: 4px; color: var(--wpwm-warning); font-size: 12px; font-weight: 600; text-align: right; }
.wpwm-po-diff:empty { display: none; }

/* Purchase order discrepancies: list tag, banner, Variance column. */
.wpwm-badge-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wpwm-badge-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.wpwm-badge-icon { display: inline-grid; place-items: center; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 9px; font-weight: 800; line-height: 1; }
.wpwm-po-discrepancy { margin: -6px 0 18px; }
.wpwm-po-discrepancy-foot { margin: 8px 0 0; font-size: 12.5px; }
.wpwm-po-table .col-variance { white-space: nowrap; }
.wpwm-po-table td.col-variance { padding-top: 8px; }
.wpwm-po-variance-value { display: block; margin-top: 3px; color: var(--wpwm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.wpwm-po-table tr.is-short td { background: color-mix(in srgb, var(--wpwm-critical) 5%, transparent); }
.wpwm-po-table tr.is-over td { background: color-mix(in srgb, var(--wpwm-warning) 6%, transparent); }
.wpwm-po-received-value { margin-left: auto; }
.wpwm-po-received-value strong { color: var(--wpwm-text); font-variant-numeric: tabular-nums; }
.wpwm-po-notes:empty { display: none; }
.wpwm-po-receive { width: min(680px, calc(100vw - 32px)); }
.wpwm-po-receive .wpwm-po-table .wpwm-input.num { width: 110px; }
.wpwm-po-receive .wpwm-dialog-body > p { color: var(--wpwm-muted); font-size: 13.5px; }

/* Blue badge (e.g. "Partial delivery"). */
.wpwm-badge.is-info { background: #e0efff; color: #0a58ca; }
@media (prefers-color-scheme: dark) { .wpwm-badge.is-info { background: #0b2545; color: #8bb9fe; } }

/* ---------- Action menus (⋮) ---------- */
.wpwm-kebab {
	display: inline-flex; align-items: center; justify-content: center;
	width: 32px; height: 32px; border: 0; border-radius: 8px; background: none;
	color: var(--wpwm-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.wpwm-kebab:hover, .wpwm-kebab.is-open { background: var(--wpwm-bg); color: var(--wpwm-text); }
.wpwm-kebab:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 1px; }
.wpwm-menu {
	z-index: 1000; min-width: 160px; padding: 6px;
	background: var(--wpwm-surface); border: 1px solid var(--wpwm-border); border-radius: 10px;
	box-shadow: 0 12px 32px rgba(16, 24, 40, .16); text-align: left;
}
.wpwm-menu[hidden] { display: none; }
.wpwm-menu-item {
	display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 6px; background: none;
	color: var(--wpwm-text); font: inherit; font-size: 13.5px; text-align: left; text-decoration: none; cursor: pointer;
}
.wpwm-menu-item:hover, .wpwm-menu-item:focus-visible { background: var(--wpwm-bg); outline: none; }
.wpwm-menu-item.is-danger { color: var(--wpwm-critical); }
.wpwm-menu-item.is-danger:hover, .wpwm-menu-item.is-danger:focus-visible { background: var(--wpwm-critical-soft); }

/* Purchase order lines: the Total column keeps one width (room for large amounts) and uses
   same-width digits, so the other columns don't shift while quantities or costs are typed. */
.wpwm-po-table .col-total { width: 140px; min-width: 140px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Input with a unit inside on the right, e.g. quantity "24 PC" (purchase orders). */
.wpwm-input-suffix { position: relative; display: inline-block; }
.wpwm-input-suffix .wpwm-suffix {
	position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
	color: var(--wpwm-muted); font-size: 12px; font-weight: 600; pointer-events: none;
}
.wpwm-po-table .wpwm-input-suffix .wpwm-input.num { width: 140px; padding-right: 48px; } /* Right padding is fitted to the unit by JS. */
/* Hide the number spinners here: the unit sits where they would be. */
.wpwm-input-suffix input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.wpwm-input-suffix input[type="number"]::-webkit-inner-spin-button,
.wpwm-input-suffix input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* =====================================================================
   Sales orders & invoices
   ===================================================================== */
/* Invoices linked to a sales order, under its status strip. */
.wpwm-doc-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -6px 0 18px; }
.wpwm-doc-links-label { color: var(--wpwm-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wpwm-doc-link {
	display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px;
	border: 1px solid var(--wpwm-border); border-radius: 8px; color: var(--wpwm-text); font-size: 13px; text-decoration: none;
}
.wpwm-doc-link:hover { border-color: var(--wpwm-accent); }
.wpwm-doc-link .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }

/* "Create invoice" call to action on a sales order with lines left to bill. */
.wpwm-invoice-cta {
	display: flex; align-items: center; gap: 14px; margin: -6px 0 18px; padding: 14px 16px;
	border: 1px solid var(--wpwm-accent); border-left-width: 4px; border-radius: 10px;
	background: var(--wpwm-accent-soft);
}
.wpwm-invoice-cta-icon {
	display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px;
	border-radius: 50%; background: var(--wpwm-accent); color: var(--wpwm-on-accent);
}
.wpwm-invoice-cta-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13.5px; }
.wpwm-invoice-cta-text strong { font-size: 15px; font-weight: 600; color: var(--wpwm-text); }
.wpwm-invoice-cta-text span { color: var(--wpwm-muted); }
.wpwm-invoice-cta .wpwm-button { flex: none; padding: 10px 20px; }
@media (max-width: 600px) {
	.wpwm-invoice-cta { flex-wrap: wrap; }
	.wpwm-invoice-cta .wpwm-button { width: 100%; text-align: center; }
}
.wpwm-invoice-cta + .wpwm-doc-links { margin-top: 0; }

/* Invoice totals: Total / Paid / Balance / Due. */
.wpwm-invoice-sums { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 20px; }

/* New invoice: the chosen sales order's customer ("Bill to"), the order, and the items to invoice. */
.wpwm-inv-preview { margin-top: 16px; }
.wpwm-inv-preview:empty { display: none; }
.wpwm-inv-cards { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; margin-bottom: 18px; }
.wpwm-inv-card { padding: 14px 16px; border: 1px solid var(--wpwm-border); border-radius: var(--wpwm-radius); background: var(--wpwm-bg); }
.wpwm-inv-card h3, .wpwm-inv-preview-title { margin: 0 0 8px; color: var(--wpwm-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.wpwm-inv-preview-title { margin-bottom: 10px; }
.wpwm-inv-card-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.wpwm-inv-card-name a { color: var(--wpwm-accent-ink); text-decoration: none; }
.wpwm-inv-card-name a:hover { text-decoration: underline; }
.wpwm-inv-card-name .wpwm-cell-sub { display: inline; font-weight: 400; }
.wpwm-inv-card dl { display: grid; gap: 4px; margin: 0; font-size: 13.5px; }
.wpwm-inv-card dl > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; }
.wpwm-inv-card dt { color: var(--wpwm-muted); }
.wpwm-inv-card dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.wpwm-inv-card .wpwm-field-hint { margin: 0; }
@media (max-width: 720px) {
	.wpwm-inv-cards { grid-template-columns: 1fr; }
	.wpwm-inv-card dl > div { grid-template-columns: 1fr; gap: 0; }
}
.wpwm-invoice-sums .is-due dd { color: var(--wpwm-critical); }
@media (max-width: 700px) { .wpwm-invoice-sums { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.wpwm-invoice-payments h3 { margin: 22px 0 8px; font-size: 14px; font-weight: 650; }
.wpwm-invoice-payments .is-voided td { color: var(--wpwm-muted); text-decoration: line-through; }
.wpwm-invoice-payments .is-voided .wpwm-cell-sub { text-decoration: none; }

/* Record payment dialog. */
.wpwm-pay-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.wpwm-pay-fields label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.wpwm-pay-fields .wpwm-field-hint { margin: 4px 0 0; }
@media (max-width: 480px) { .wpwm-pay-fields { grid-template-columns: 1fr; } }
/* Text buttons in table action cells (e.g. "Void" on a payment) keep normal text size. */
.wpwm-po-table .actions .wpwm-link-button.is-text { width: auto; height: auto; padding: 4px 8px; font-size: 13px; }

/* Settings → General: payment methods list with on / off switches. */
.wpwm-method-list { display: grid; gap: 8px; max-width: 640px; margin: 0; padding: 0; list-style: none; }
.wpwm-method { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.wpwm-method.is-off .wpwm-input { color: var(--wpwm-muted); }
.wpwm-method-tools { display: inline-flex; align-items: center; gap: 2px; }
.wpwm-icon-button.is-small { width: 28px; height: 28px; font-size: 15px; }
.wpwm-icon-button:disabled { opacity: .35; cursor: default; }
.wpwm-switch-wrap { position: relative; display: inline-flex; cursor: pointer; }
.wpwm-switch { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.wpwm-switch-ui { width: 36px; height: 20px; border-radius: 999px; background: var(--wpwm-border); transition: background .15s; position: relative; }
.wpwm-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.wpwm-switch:checked + .wpwm-switch-ui { background: var(--wpwm-accent); }
.wpwm-switch:checked + .wpwm-switch-ui::after { transform: translateX(16px); }
.wpwm-switch:focus-visible + .wpwm-switch-ui { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }

/* =====================================================================
   Dashboard: Purchase Orders, Sales Orders, Invoices (assets/js/pages/dashboard.js)
   ===================================================================== */
.wpwm-fin {
	--wpwm-fin-po: #d97706; --wpwm-fin-po-soft: #fdf4e3;
	--wpwm-fin-so: #15803d; --wpwm-fin-so-soft: #e9f7ee;
	--wpwm-fin-inv: #2563eb; --wpwm-fin-inv-soft: #e8efff;
}
@media (prefers-color-scheme: dark) {
	.wpwm-fin {
		--wpwm-fin-po: #f0b35a; --wpwm-fin-po-soft: #2e2414;
		--wpwm-fin-so: #4ade80; --wpwm-fin-so-soft: #11281a;
		--wpwm-fin-inv: #7aa2ff; --wpwm-fin-inv-soft: #1c2740;
		}
}
.is-purchase_orders { --c: var(--wpwm-fin-po); --c-soft: var(--wpwm-fin-po-soft); }
.is-sales_orders    { --c: var(--wpwm-fin-so); --c-soft: var(--wpwm-fin-so-soft); }
.is-invoices        { --c: var(--wpwm-fin-inv); --c-soft: var(--wpwm-fin-inv-soft); }

.wpwm-fin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.wpwm-fin-bar .wpwm-select, .wpwm-fin-bar .wpwm-combo { min-width: 110px; }

/* Chart + summary. */
.wpwm-fin-overview { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; margin-bottom: 22px; }
.wpwm-fin-chart-col { min-width: 0; }
.wpwm-fin-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.wpwm-fin-chart-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.wpwm-fin-chart-head .wpwm-select, .wpwm-fin-chart-head .wpwm-combo { min-width: 110px; }
.wpwm-fin-chart { position: relative; min-width: 0; }
.wpwm-chart { display: block; width: 100%; height: auto; overflow: visible; }
.wpwm-chart text { font-size: 11.5px; fill: var(--wpwm-muted); font-family: inherit; }
.wpwm-chart-legend text { fill: var(--wpwm-text); font-size: 12.5px; }
.wpwm-chart-grid line { stroke: var(--wpwm-border); stroke-dasharray: 4 4; }
.wpwm-chart-grid line.is-zero { stroke-dasharray: none; }
.wpwm-chart-line { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linecap: round; }
.wpwm-chart-dot { fill: var(--c); stroke: var(--wpwm-surface); stroke-width: 1.5; }
.wpwm-chart-area { fill: var(--c); opacity: .06; }
.wpwm-chart-guide { stroke: var(--wpwm-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.wpwm-chart-tip {
	position: absolute; z-index: 2; pointer-events: none; display: grid; gap: 3px; min-width: 200px;
	padding: 9px 11px; border: 1px solid var(--wpwm-border); border-radius: 8px;
	background: var(--wpwm-surface); box-shadow: 0 6px 20px rgba(16, 24, 40, .12); font-size: 12.5px;
}
.wpwm-chart-tip[hidden] { display: none; }
.wpwm-chart-tip strong { font-size: 13px; margin-bottom: 2px; }
.wpwm-chart-tip span { display: flex; align-items: center; gap: 6px; color: var(--wpwm-muted); }
.wpwm-chart-tip b { margin-left: auto; padding-left: 12px; color: var(--wpwm-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.wpwm-chart-tip i, .wpwm-fin-swatch { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); display: inline-block; }

.wpwm-fin-summary { display: flex; flex-direction: column; gap: 10px; }
.wpwm-fin-summary-title { margin: 0 0 2px; font-size: 14px; font-weight: 600; }

/* Totals: summary boxes (tinted) and month cards (white, coloured top edge). Both link to the module. */
.wpwm-fin-box, .wpwm-fin-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 9px; color: var(--wpwm-text); text-decoration: none; }
.wpwm-fin-box { background: var(--c-soft); border: 1px solid transparent; transition: border-color .15s; }
.wpwm-fin-box:hover { border-color: var(--c); }
.wpwm-fin-label { display: flex; align-items: center; gap: 7px; color: var(--wpwm-text); font-size: 13px; font-weight: 600; }
.wpwm-fin-count { margin-left: auto; color: var(--wpwm-muted); font-size: 12px; font-weight: 500; }
.wpwm-fin-value { color: var(--c); font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.wpwm-fin-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--wpwm-muted); font-variant-numeric: tabular-nums; }
.wpwm-fin-sub .is-open { color: var(--wpwm-warning); }

.wpwm-fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.wpwm-fin-card {
	padding: 16px 18px; border: 1px solid var(--wpwm-border); border-top: 3px solid var(--c);
	border-radius: var(--wpwm-radius); background: var(--wpwm-surface); box-shadow: var(--wpwm-shadow);
	transition: transform .15s;
}
.wpwm-fin-card:hover { transform: translateY(-1px); }
.wpwm-fin-card .wpwm-fin-label { font-size: 14px; }
.wpwm-fin-card .wpwm-fin-value { font-size: 25px; }
.wpwm-fin-box:focus-visible, .wpwm-fin-card:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }

/* Month tables: one per module. */
.wpwm-fin-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
/* A single table (e.g. a driver's Sales Orders) fills the row. */
.wpwm-fin-table:only-child { grid-column: 1 / -1; }
.wpwm-fin-table { margin: 0; display: flex; flex-direction: column; }
/* Purchase Orders takes the full row; Sales Orders and Invoices sit side by side under it. */
.wpwm-fin-table.is-purchase_orders { grid-column: 1 / -1; }
.wpwm-fin-table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.wpwm-fin-table-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; }
.wpwm-fin-table-head .wpwm-button { text-decoration: none; }
.wpwm-fin-grid th { padding: 8px 10px; }
.wpwm-fin-grid td { padding: 9px 10px; }
.wpwm-fin-grid td a { font-weight: 500; text-decoration: none; }
.wpwm-fin-grid td a:hover { text-decoration: underline; }
.wpwm-fin-doc { display: block; color: var(--wpwm-muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wpwm-fin-date { color: var(--wpwm-muted); white-space: nowrap; }
.wpwm-fin-grid .wpwm-badge { white-space: nowrap; }
.wpwm-fin-grid tfoot td { border-bottom: 0; }
.wpwm-fin-total-label { text-align: right !important; font-weight: 600; color: var(--wpwm-muted); }
.wpwm-fin-empty { text-align: center !important; color: var(--wpwm-muted); padding: 22px 10px !important; }
.wpwm-fin-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--wpwm-border); color: var(--wpwm-muted); font-size: 13px; }
.wpwm-fin .is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

@media (max-width: 1100px) {
	.wpwm-fin-overview { grid-template-columns: 1fr; }
	.wpwm-fin-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
	.wpwm-fin-summary-title { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
	.wpwm-fin-tables { grid-template-columns: 1fr; }
	.wpwm-fin-card .wpwm-fin-value { font-size: 22px; }
}


/* Password field with a show / hide (eye) button */
.wpwm-password { position: relative; display: block; }
.wpwm-password .wpwm-input { padding-right: 44px; }
.wpwm-password-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--wpwm-muted); cursor: pointer; }
.wpwm-password-toggle:hover { color: var(--wpwm-text, inherit); background: var(--wpwm-bg); }
.wpwm-password-toggle:focus-visible { outline: 2px solid var(--wpwm-accent); outline-offset: 1px; }
.wpwm-password-toggle .wpwm-eye-off, .wpwm-password-toggle[aria-pressed="true"] .wpwm-eye { display: none; }
.wpwm-password-toggle[aria-pressed="true"] .wpwm-eye-off { display: block; }

/* Colour picker fields (e.g. Settings → General → Theme colour) */
.wpwm-input[type="color"] { width: 72px; height: calc(1.55em + 16px); padding: 3px; cursor: pointer; }

/* A field whose label is for screen readers only (form-fields 'label_hidden'):
   push the input down by a label's height so it lines up with the inputs beside it. */
.wpwm-field.has-hidden-label { padding-top: calc(13px * 1.55 + 5px); }
.wpwm-theme-reset { margin-top: 14px; }

/* Logo: in the menu (instead of the "W" mark) and on Settings → General → Logo */
.wpwm-brand-logo { display: block; max-width: 120px; max-height: 40px; width: auto; height: auto; flex-shrink: 0; object-fit: contain; }
.wpwm-logo-setting { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.wpwm-logo-preview {
	display: flex; align-items: center; justify-content: center; box-sizing: border-box;
	width: 120px; height: 72px; padding: 8px; flex-shrink: 0; overflow: hidden;
	border: 1px dashed var(--wpwm-border); border-radius: 10px; background: var(--wpwm-bg);
}
/* Fits inside the box (120 × 72 less the padding), whatever the image's own size. */
.wpwm-logo-preview img { display: block; width: auto; height: auto; max-width: 102px; max-height: 54px; object-fit: contain; }
.wpwm-logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex: 1; min-width: 220px; }
.wpwm-logo-actions .wpwm-field-hint, .wpwm-logo-actions .wpwm-field-error { flex-basis: 100%; margin: 0; }
.wpwm-logo-upload { cursor: pointer; }
.wpwm-logo-upload:focus-within { outline: 2px solid var(--wpwm-accent); outline-offset: 2px; }
.wpwm-logo-upload.is-busy { opacity: .6; pointer-events: none; }

/* Payment methods: a method payments use shows "In use" (instead of Remove) and why, under the row */
.wpwm-method-inuse { padding: 4px 8px; color: var(--wpwm-muted); font-size: 13px; white-space: nowrap; }
.wpwm-method-note { grid-column: 2 / -1; margin: -4px 0 0; }
.wpwm-method-tools > .wpwm-method-inuse, .wpwm-method-tools > .wpwm-link-button { min-width: 72px; text-align: center; box-sizing: border-box; }

/* ---------- Sign-in page (/wms/login/, templates/login.php) ---------- */
.wpwm-login {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
	min-height: 100vh; min-height: 100dvh; box-sizing: border-box; padding: 32px 16px;
	background: radial-gradient(120% 80% at 50% 0%, var(--wpwm-accent-soft), var(--wpwm-bg) 70%);
}
.wpwm-login-card {
	width: 100%; max-width: 400px; box-sizing: border-box; padding: 32px;
	background: var(--wpwm-surface); border: 1px solid var(--wpwm-border); border-radius: 14px;
	box-shadow: 0 12px 32px -12px rgba(16, 24, 40, .18);
}
/* Logo (or "W" mark) centred above the app and site name. */
.wpwm-login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; color: var(--wpwm-text); text-align: center; }
.wpwm-login-brand .wpwm-brand-text { align-items: center; max-width: 100%; }
.wpwm-login-brand .wpwm-brand-text small { color: var(--wpwm-muted); }
.wpwm-login-brand .wpwm-brand-mark { width: 44px; height: 44px; font-size: 18px; border-radius: 10px; }
.wpwm-login-logo { display: block; max-width: 200px; max-height: 64px; width: auto; height: auto; object-fit: contain; }
.wpwm-login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--wpwm-text); }
.wpwm-login-intro { margin: 0 0 22px; color: var(--wpwm-muted); font-size: 14px; }
.wpwm-login-form { display: grid; gap: 16px; }
.wpwm-login-form .wpwm-input { padding: 10px 12px; }
.wpwm-login-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.wpwm-login-label-row label { margin: 0; }
.wpwm-login-label-row a, .wpwm-login-back a { color: var(--wpwm-accent-ink); font-size: 13px; font-weight: 500; text-decoration: none; }
.wpwm-login-label-row a:hover, .wpwm-login-back a:hover { text-decoration: underline; }
.wpwm-login-remember { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--wpwm-text); cursor: pointer; }
.wpwm-login-remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--wpwm-accent); }
.wpwm-login-submit { width: 100%; padding: 11px 16px; font-size: 15px; margin-top: 4px; }
.wpwm-login-message {
	margin: 0 0 18px; padding: 10px 12px; border-radius: 8px; font-size: 14px;
	background: var(--wpwm-accent-soft); color: var(--wpwm-accent-ink);
}
.wpwm-login-message p { margin: 0; }
.wpwm-login-message p + p { margin-top: 4px; }
.wpwm-login-message.is-error { background: var(--wpwm-critical-soft); color: var(--wpwm-critical); }
.wpwm-login-back { margin: 0; }
@media (max-width: 480px) {
	.wpwm-login-card { padding: 24px 20px; }
}
