/* ==========================================================================
 * WBAMS Webmail
 * --------------------------------------------------------------------------
 * The tokens mirror the WBAMS admin design language ("Atelier"): an off-white
 * canvas, white cards with soft borders and a 16px radius, one accent used
 * sparingly, pill buttons, and comfortable spacing.
 *
 * Layout is a three column shell - folders, message list, reading pane - that
 * collapses to a single column below 900px. Which column is on screen at that
 * width is decided by [data-pane] on <body>, set by the server, so the right
 * one is painted first and stays correct with script disabled.
 * ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
	--wm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto,
		"Helvetica Neue", Arial, "Noto Sans", sans-serif;
	--wm-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--wm-canvas: #f7f5f0;
	--wm-panel: #fdfcfa;
	--wm-surface: #ffffff;
	--wm-surface-2: #f7f5f0;
	--wm-surface-3: #f1eee8;

	--wm-line: #e6e3dc;
	--wm-line-soft: #f0eee9;
	--wm-line-card: #ebe8e1;
	--wm-control-line: #dad8d1;

	--wm-ink: #2b2a33;
	--wm-ink-2: #6b6a75;
	--wm-ink-3: #9a99a3;

	--wm-accent: #4f56d9;
	--wm-accent-rgb: 79, 86, 217;
	--wm-accent-hover: #3a40b3;
	--wm-accent-tint: #ecebff;
	--wm-on-accent: #ffffff;

	--wm-ok: #1f7a4f;      --wm-ok-tint: #dff5e8;
	--wm-warn: #9a5a12;    --wm-warn-tint: #ffefd6;
	--wm-bad: #b3323a;     --wm-bad-tint: #ffe3e3;

	--wm-avatar: #ffd9c2;
	--wm-avatar-ink: #9a5a12;

	--wm-shadow-card: 0 1px 2px rgba(43, 42, 51, .03), 0 8px 24px rgba(43, 42, 51, .04);
	--wm-shadow-pop: 0 12px 32px rgba(43, 42, 51, .14);

	--wm-radius-card: 16px;
	--wm-radius-control: 12px;
	--wm-radius-pill: 999px;

	--wm-sidebar-w: 232px;
	--wm-list-w: 360px;
	--wm-top-h: 62px;

	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--wm-canvas: #1c1b22;
		--wm-panel: #22212a;
		--wm-surface: #26252e;
		--wm-surface-2: #2e2d38;
		--wm-surface-3: #34333d;

		--wm-line: #3a3944;
		--wm-line-soft: #302f39;
		--wm-line-card: #34333d;
		--wm-control-line: #4a4955;

		--wm-ink: #f0eef8;
		--wm-ink-2: #a09fac;
		--wm-ink-3: #8a8996;

		--wm-accent: #8b91ff;
		--wm-accent-rgb: 139, 145, 255;
		--wm-accent-hover: #b0b4ff;
		--wm-accent-tint: #33346a;
		--wm-on-accent: #1c1b22;

		--wm-ok: #7fe0ac;      --wm-ok-tint: #1f3d2e;
		--wm-warn: #ffc27a;    --wm-warn-tint: #3f2f17;
		--wm-bad: #ff9a9f;     --wm-bad-tint: #3f2226;

		--wm-avatar: #4a3a30;
		--wm-avatar-ink: #ffc27a;

		--wm-shadow-card: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .3);
		--wm-shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);

		color-scheme: dark;
	}
}

/* ---------- 2. Base ------------------------------------------------------ */

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

/*
	The hidden attribute has to win over a component's own display.

	The browser hides [hidden] with display:none from its own stylesheet, which any rule in this
	file outranks - so a component declared as display:flex stayed on screen while the markup said
	it was hidden. That is how the new-mail banner sat above every folder as an empty strip with a
	lone "Show" in it, and how the bulk bar advertised "0 selected, Mark read, Delete" over a list
	where nothing was selected. Both were correct in the HTML and wrong on the page.

	Declared once here rather than as a :not([hidden]) guard on each component, because the next
	component to grow a display rule would reintroduce it, and this cannot be forgotten.
*/
[hidden] { display: none !important; }

html, body { height: 100%; }

body.wm {
	margin: 0;
	background: var(--wm-canvas);
	color: var(--wm-ink);
	font: 15px/1.55 var(--wm-font);
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	overflow: hidden;
	/* The page is the window: header, ribbon and shell in a column, the shell taking
	   what is left. dvh so the mobile toolbars do not push the last row off. */
	display: flex; flex-direction: column;
	height: 100vh; height: 100dvh;
}
body.wm > .wm-top, body.wm > .wm-ribbon { flex: 0 0 auto; }

body.wm-centered { overflow: auto; display: block; height: auto; min-height: 100vh; min-height: 100dvh; }

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.011em; }

p { margin: 0; }

a { color: var(--wm-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
	outline: 2px solid var(--wm-accent);
	outline-offset: 2px;
	border-radius: 6px;
}

.wm-visually-hidden {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wm-skip {
	position: absolute; left: 12px; top: -60px; z-index: 60;
	background: var(--wm-surface); color: var(--wm-ink);
	border: 1px solid var(--wm-line); border-radius: var(--wm-radius-pill);
	padding: 9px 18px; box-shadow: var(--wm-shadow-pop);
	transition: top .15s ease;
}
.wm-skip:focus { top: 12px; }

/* ---------- 3. Controls -------------------------------------------------- */

.wm-button {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	border: 1px solid transparent; border-radius: var(--wm-radius-pill);
	padding: 8px 17px; font: inherit; font-weight: 550; font-size: 13.5px;
	line-height: 1.25; cursor: pointer; white-space: nowrap;
	background: var(--wm-surface-2); color: var(--wm-ink);
	border-color: var(--wm-line); text-decoration: none;
	transition: background .14s ease, border-color .14s ease, color .14s ease, transform .1s ease;
}
.wm-button:hover { background: var(--wm-surface-3); text-decoration: none; }
.wm-button:active { transform: translateY(1px); }

.wm-button-primary {
	background: var(--wm-accent); color: var(--wm-on-accent); border-color: transparent;
	box-shadow: 0 1px 2px rgba(var(--wm-accent-rgb), .28);
}
.wm-button-primary:hover { background: var(--wm-accent-hover); }

.wm-button-quiet { background: transparent; border-color: transparent; color: var(--wm-ink-2); }
.wm-button-quiet:hover { background: var(--wm-surface-2); color: var(--wm-ink); }

.wm-button-danger { background: transparent; border-color: transparent; color: var(--wm-bad); }
.wm-button-danger:hover { background: var(--wm-bad-tint); color: var(--wm-bad); }

.wm-button-block { width: 100%; padding: 11px 18px; font-size: 15px; }

/*
	The Microsoft button is deliberately not the primary one. The password field above it is what
	most mailboxes still use, and two buttons of equal weight make a person stop and choose before
	they know there is a choice to make. This reads as the second option it is, and it inherits the
	surface colours, so it follows the light and dark themes rather than carrying its own.
*/
.wm-signin-or {
	display: flex; align-items: center; gap: 10px;
	margin: 14px 0 10px; color: var(--wm-ink-3, var(--wm-ink-2));
	font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.wm-signin-or::before, .wm-signin-or::after {
	content: ""; flex: 1; height: 1px; background: var(--wm-line);
}

.wm-button-microsoft { background: var(--wm-surface-2); color: var(--wm-ink); border-color: var(--wm-line); }
.wm-button-microsoft:hover { background: var(--wm-surface-3); }

.wm-button.is-disabled { opacity: .45; pointer-events: none; }

/*
	padding: 0 is not tidiness. A button carries the browser's own "1px 6px", which leaves a 38px
	button with a 26px content box - and an icon wider than that is not centered in it but pushed to
	the start, because centering something larger than its area would hide the far edge of it. That
	is a 1.5px shift, which is invisible until the icon has a circle behind it and then is all you
	can see.
*/
.wm-icon-button {
	display: inline-grid; place-items: center; width: 38px; height: 38px;
	padding: 0; border: 0; border-radius: var(--wm-radius-pill); background: transparent;
	color: var(--wm-ink-2); cursor: pointer; flex: 0 0 auto;
}
.wm-icon-button:hover { background: var(--wm-surface-2); }

.wm-bars, .wm-bars::before, .wm-bars::after {
	display: block; width: 17px; height: 1.6px; border-radius: 2px;
	background: currentColor; content: "";
}
.wm-bars { position: relative; }
.wm-bars::before { position: absolute; top: -5.5px; }
.wm-bars::after { position: absolute; top: 5.5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
textarea, select {
	width: 100%; font: inherit; color: var(--wm-ink);
	background: var(--wm-surface);
	border: 1px solid var(--wm-control-line);
	border-radius: var(--wm-radius-control);
	padding: 9px 13px;
	transition: border-color .14s ease, box-shadow .14s ease;
}
input:focus, textarea:focus, select:focus {
	outline: none; border-color: var(--wm-accent);
	box-shadow: 0 0 0 3px rgba(var(--wm-accent-rgb), .16);
}
input::placeholder, textarea::placeholder { color: var(--wm-ink-3); }

textarea { resize: vertical; }

.wm-select {
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
		linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: right 15px center, right 10px center;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 32px; width: auto; min-width: 130px;
}

.wm-input-small { width: auto; min-width: 130px; padding: 6px 11px; font-size: 13.5px; }

.wm-field { margin-bottom: 16px; }
.wm-field label {
	display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 560;
	color: var(--wm-ink-2); letter-spacing: .005em;
}

.wm-check { display: flex; align-items: center; gap: 9px; margin: 4px 0 6px; cursor: pointer; }
/* The marks below carry their own size; nothing here needs to undo a width they never had. */

/*
	The marks: a switch for a setting, a box for a selection, a dot for a choice between options.

	They are the browser's own controls with the browser's own drawing removed, so they keep every
	behavior that comes with a real input - the label click, the keyboard, the form value, the
	indeterminate state - and gain the geometry WBAMS uses everywhere else: a 44x24 switch with a
	16px knob that travels 20px, and a 17px mark for the other two.

	Which one a control gets is a question about what it does, not what its type attribute says. An
	on/off setting is a switch, because that is what the rest of WBAMS puts in front of a setting.
	Picking rows out of a list is not a setting and never becomes a switch: a row of switches down
	the side of a message list is not something any mail client has ever shown anyone.
*/
input.wm-switch, input.wm-tick, input.wm-radio {
	appearance: none; -webkit-appearance: none;
	position: relative; flex: none; margin: 0;
	background: var(--wm-surface);
	border: 1px solid var(--wm-control-line);
	cursor: pointer;
	transition: background .18s ease, border-color .18s ease, box-shadow .14s ease;
}
input.wm-switch:focus-visible, input.wm-tick:focus-visible, input.wm-radio:focus-visible {
	outline: 2px solid var(--wm-accent); outline-offset: 2px;
}
input.wm-switch:disabled, input.wm-tick:disabled, input.wm-radio:disabled { opacity: .55; cursor: not-allowed; }

input.wm-switch {
	width: 44px; height: 24px; border-radius: var(--wm-radius-pill);
	background: var(--wm-surface-2);
	box-shadow: inset 0 1px 2px rgba(43, 42, 51, .1);
}
input.wm-switch::after {
	content: ""; position: absolute; top: 2px; left: 2px;
	width: 16px; height: 16px; border-radius: 50%;
	background: var(--wm-surface); box-shadow: 0 2px 5px rgba(24, 55, 80, .22);
	transition: transform .18s ease;
}
input.wm-switch:checked { background: var(--wm-accent); border-color: var(--wm-accent); }
input.wm-switch:checked::after { transform: translateX(20px); }

input.wm-tick { width: 17px; height: 17px; border-radius: 5px; border-width: 1.5px; }
input.wm-tick:hover { border-color: var(--wm-accent); }
input.wm-tick:checked, input.wm-tick:indeterminate { background: var(--wm-accent); border-color: var(--wm-accent); }
input.wm-tick:checked::after {
	content: ""; position: absolute; left: 4.5px; top: 1px;
	width: 4px; height: 8.5px;
	border: solid #fff; border-width: 0 2px 2px 0;
	transform: rotate(43deg);
}
/* Some of this page's rows are selected and some are not, which is neither on nor off. */
input.wm-tick:indeterminate::after {
	content: ""; position: absolute; left: 3px; top: 6.2px;
	width: 8px; height: 2px; border-radius: 1px; background: #fff;
}

input.wm-radio { width: 17px; height: 17px; border-radius: 50%; border-width: 1.5px; }
input.wm-radio:hover { border-color: var(--wm-accent); }
input.wm-radio:checked { border-color: var(--wm-accent); border-width: 5.5px; }

.wm-chip {
	display: inline-flex; align-items: center; padding: 4px 12px;
	border-radius: var(--wm-radius-pill); border: 1px solid var(--wm-line);
	font-size: 12.5px; font-weight: 540; color: var(--wm-ink-2);
	background: var(--wm-surface); text-decoration: none;
}
.wm-chip:hover { background: var(--wm-surface-2); text-decoration: none; }
.wm-chip.is-on {
	background: var(--wm-accent-tint); border-color: transparent; color: var(--wm-accent);
}

.wm-pill {
	display: inline-block; margin-left: 7px; padding: 1px 8px;
	border-radius: var(--wm-radius-pill); background: var(--wm-surface-3);
	color: var(--wm-ink-3); font-size: 11px; font-weight: 560; vertical-align: 1px;
}

.wm-quiet-link { color: var(--wm-ink-2); font-size: 13px; background: none; border: 0; cursor: pointer; padding: 0; font-family: inherit; }
.wm-quiet-link:hover { color: var(--wm-accent); }

.wm-card {
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-card);
	box-shadow: var(--wm-shadow-card);
	padding: 24px 26px;
}
.wm-card + .wm-card { margin-top: 18px; }
.wm-card h2 { font-size: 16px; margin-bottom: 6px; }
.wm-card-note { color: var(--wm-ink-2); font-size: 13.5px; margin-bottom: 18px; }
.wm-card-note-tight { margin: 4px 0 18px; }

.wm-flash {
	border-radius: var(--wm-radius-control); padding: 11px 16px; margin-bottom: 16px;
	font-size: 13.5px; border: 1px solid transparent;
}
.wm-flash-info { background: var(--wm-surface-2); color: var(--wm-ink-2); border-color: var(--wm-line); }
.wm-flash-ok   { background: var(--wm-ok-tint);   color: var(--wm-ok); }
.wm-flash-warn { background: var(--wm-warn-tint); color: var(--wm-warn); }
.wm-flash-bad  { background: var(--wm-bad-tint);  color: var(--wm-bad); }

/* ---------- 4. Sign in --------------------------------------------------- */

.wm-signin { min-height: 100vh; display: grid; place-items: center; padding: 28px 20px 56px; }
.wm-signin-card { width: min(400px, 100%); padding: 30px 32px 26px; }
.wm-signin-head { text-align: center; margin-bottom: 22px; }
.wm-signin-head h1 { font-size: 21px; margin: 12px 0 5px; }
.wm-signin-head p { color: var(--wm-ink-2); font-size: 13.5px; }
.wm-signin-foot { margin-top: 18px; text-align: center; color: var(--wm-ink-3); font-size: 12.5px; }
/*
	The reset link sits below the button rather than beside the password field. Beside the field it
	competes with the thing almost everyone is there to do; below the button it is where someone
	looks only once signing in has not worked.
*/
.wm-signin-aside { margin-top: 14px; text-align: center; font-size: 13px; }
.wm-signin-card .wm-flash { text-align: left; }
/* "Stay signed in" sits between the password and the button; its note lines up with the label, not the box. */
.wm-signin-stay { margin: 2px 0 4px; font-size: 14px; }
.wm-signin-stay-note { margin: 0 0 18px; padding-left: 26px; font-size: 12.5px; color: var(--wm-ink-3); }

.wm-brand-mark {
	display: inline-block; width: 22px; height: 22px; border-radius: 7px;
	background: linear-gradient(140deg, var(--wm-accent), var(--wm-accent-hover));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.wm-brand-mark-lg { width: 40px; height: 40px; border-radius: 12px; }

/* An uploaded logo replaces the gradient mark. Constrained rather than sized: a
   brand asset arrives at whatever dimensions it was drawn at, and the header has a
   fixed height, so the width follows the image and the height is capped. */
.wm-brand-logo {
	display: inline-block; width: auto; height: 22px; max-width: 160px;
	object-fit: contain; object-position: left center;
}
.wm-brand-logo-lg { height: 44px; max-width: 220px; object-position: center; }

/* ---------- 5. Shell ----------------------------------------------------- */

.wm-top {
	display: flex; align-items: center; gap: 14px;
	height: var(--wm-top-h); padding: 0 16px;
	background: var(--wm-panel);
	border-bottom: 1px solid var(--wm-line);
	position: relative; z-index: 30;
}

.wm-brand { display: flex; align-items: center; gap: 9px; color: var(--wm-ink); flex: 0 0 auto; }
.wm-brand:hover { text-decoration: none; }
.wm-brand-text { font-weight: 640; letter-spacing: -.01em; font-size: 15px; }

.wm-search { flex: 1 1 auto; max-width: 520px; position: relative; display: flex; }
.wm-search input {
	background: var(--wm-surface-2); border-color: transparent;
	border-radius: var(--wm-radius-pill); padding: 9px 42px 9px 16px;
}
.wm-search input:focus { background: var(--wm-surface); border-color: var(--wm-accent); }
.wm-search-go {
	position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
	width: 32px; height: 32px; border: 0; border-radius: var(--wm-radius-pill);
	background: transparent; color: var(--wm-ink-2); cursor: pointer; font-size: 15px;
}
.wm-search-go:hover { background: var(--wm-surface-3); }

.wm-account { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.wm-signout { display: contents; }

.wm-avatar {
	display: inline-grid; place-items: center; width: 34px; height: 34px;
	border-radius: var(--wm-radius-pill);
	background: var(--wm-avatar); color: var(--wm-avatar-ink);
	font-weight: 640; font-size: 14px; text-decoration: none; flex: 0 0 auto;
}
.wm-avatar:hover { text-decoration: none; filter: brightness(.97); }
.wm-avatar-lg { width: 42px; height: 42px; font-size: 16px; }

/*
	The shell takes the height the header and the ribbon leave, measured rather than
	guessed. It used to subtract two constants - 62px of header and 90px of ribbon -
	from the viewport, and a constant is wrong the moment the thing it describes changes
	size: a ribbon whose buttons wrap onto a second row at a narrower window, or a
	folded one, left the shell taller than the space it had. With body overflowing
	hidden, "taller than the space" means the bottom of the message list is simply not
	on screen - a mailbox of fifteen messages that showed twelve and would not scroll,
	because the list's own scroller had been given more height than the window.

	min-height: 0 on the shell and on its children is what lets the panes inside be
	shorter than their content. A grid item is min-height: auto by default, so a column
	holding a long list refuses to shrink to its track and overflows it instead, and the
	overflow-y: auto inside it never has anything to scroll.
*/
.wm-shell {
	display: grid;
	grid-template-columns: var(--wm-sidebar-w) var(--wm-list-w) minmax(0, 1fr);
	flex: 1 1 auto;
	min-height: 0;
}
.wm-shell > * { min-height: 0; }
/* Compose and settings drop the list column; the server says so on <body> so the
   grid does not depend on :has() being available. */
body[data-layout="wide"] .wm-shell { grid-template-columns: var(--wm-sidebar-w) minmax(0, 1fr); }

/* ---------- 6. Sidebar --------------------------------------------------- */

.wm-sidebar {
	background: var(--wm-panel);
	border-right: 1px solid var(--wm-line);
	padding: 16px 12px 12px;
	overflow-y: auto;
	display: flex; flex-direction: column; gap: 4px;
}

.wm-folders { display: flex; flex-direction: column; gap: 1px; }

.wm-folder {
	display: flex; align-items: center; gap: 9px;
	padding: 8px 12px 8px calc(12px + var(--wm-depth, 0) * 13px);
	border-radius: var(--wm-radius-pill);
	color: var(--wm-ink-2); font-size: 13.5px; font-weight: 520;
	text-decoration: none;
}
.wm-folder:hover { background: var(--wm-surface-2); color: var(--wm-ink); text-decoration: none; }
.wm-folder.is-current { background: var(--wm-accent-tint); color: var(--wm-accent); font-weight: 600; }
.wm-folder-icon { flex: 0 0 auto; width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.wm-folder-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wm-badge {
	flex: 0 0 auto; min-width: 20px; padding: 1px 7px; border-radius: var(--wm-radius-pill);
	background: var(--wm-accent); color: var(--wm-on-accent);
	font-size: 11px; font-weight: 640; text-align: center;
}
.wm-folder.is-current .wm-badge { background: var(--wm-accent); color: var(--wm-on-accent); }

.wm-sidebar-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--wm-line-soft); }
/*
	Three links stacked, not a row: at 232px a row of them wraps, and a wrapped row reads as one
	link that happens to have been broken in half. Stacked they are three destinations.
*/
.wm-sidebar-foot .wm-quiet-link { display: block; padding: 3px 0; }
.wm-sidebar-foot .wm-quiet-link.is-current { color: var(--wm-accent); font-weight: 600; }
.wm-address {
	margin-top: 6px; font-size: 11.5px; color: var(--wm-ink-3);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 7. Message list --------------------------------------------- */

.wm-list-column {
	border-right: 1px solid var(--wm-line);
	background: var(--wm-panel);
	display: flex; flex-direction: column; min-width: 0;
}

/* Title and count on the left, the filters level with them on the right: the filters were a third
   row under a heading two rows tall, which is 40-odd pixels of chrome above a list. */
.wm-list-head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-list-heading { min-width: 0; }
.wm-list-title { font-size: 17px; }
.wm-list-count { margin-top: 2px; font-size: 12.5px; color: var(--wm-ink-3); }
.wm-filters { display: flex; gap: 6px; flex: 0 0 auto; }

@media (max-width: 420px) {
	/* Three chips and a folder name do not share a line this narrow. */
	.wm-list-head { flex-wrap: wrap; }
	.wm-filters { flex: 1 0 100%; }
}

.wm-list-form { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

.wm-bulk {
	position: sticky; top: 0; z-index: 5;
	display: flex; align-items: center; gap: 4px;
	min-height: 44px; padding: 4px 8px 4px 12px; background: var(--wm-surface);
	border-bottom: 1px solid var(--wm-line-soft);
	box-shadow: 0 1px 0 rgba(43, 42, 51, .03);
}
/* The one action left here is destructive, so it says so on hover and sits at the right hand end. */
.wm-bulk-delete { width: 34px; height: 34px; }
.wm-bulk-delete:hover { color: var(--wm-bad); background: var(--wm-bad-tint, var(--wm-surface-2)); }
.wm-bulk-count { font-size: 12.5px; color: var(--wm-ink-2); margin-right: auto; padding-left: 4px; }

.wm-messages { display: flex; flex-direction: column; }

/*
	The day a run of messages arrived on. It sticks to the top of the list while that run scrolls
	past, so the answer to "when was this" is on screen for every row, not only the first.
*/
.wm-group {
	position: sticky; top: 0; z-index: 1;
	padding: 9px 14px 7px;
	font-size: 11.5px; font-weight: 640; letter-spacing: .04em; text-transform: uppercase;
	color: var(--wm-ink-3);
	background: var(--wm-surface-2);
	border-bottom: 1px solid var(--wm-line-soft);
}

.wm-row {
	display: flex; align-items: flex-start; gap: 2px;
	border-bottom: 1px solid var(--wm-line-soft);
	background: transparent;
	transition: background .12s ease;
}
.wm-row:hover { background: var(--wm-surface-2); }
.wm-row { position: relative; }
.wm-row.is-open { background: var(--wm-accent-tint); }
.wm-row.is-open .wm-row-subject, .wm-row.is-open .wm-row-from { color: var(--wm-accent); }

/*
	The initial and the tick box stack in one 34px square, so swapping between them moves nothing
	else in the row. The tick box is the one on top; which of the two is seen is decided below.
*/
.wm-row-check {
	position: relative; display: grid; place-items: center;
	width: 30px; height: 30px; margin: 12px 2px 0 12px; flex: 0 0 auto; cursor: pointer;
}
.wm-row-check input { margin: 0; }
.wm-row-check .wm-avatar { grid-area: 1 / 1; }
.wm-row-check input.wm-tick { grid-area: 1 / 1; z-index: 1; }

/*
	Pointed at, tabbed into, or already ticked: the tick box. Otherwise the initial. A ticked row
	keeps its box after the pointer leaves, or the selection would disappear from under the reader
	while it is still counted in the bar above.
*/
.wm-row-check input.wm-tick { opacity: 0; }
.wm-row:hover .wm-row-check input.wm-tick,
.wm-row:focus-within .wm-row-check input.wm-tick,
.wm-row-check input.wm-tick:checked,
.wm-row-check input.wm-tick:focus-visible { opacity: 1; }

.wm-row:hover .wm-row-check .wm-avatar,
.wm-row:focus-within .wm-row-check .wm-avatar,
.wm-row-check:has(input.wm-tick:checked) .wm-avatar { opacity: 0; }

/* Without :has(), a ticked row simply shows both - the box over the initial, which still reads. */
@supports not selector(:has(*)) {
	.wm-row-check:has(input.wm-tick:checked) .wm-avatar { opacity: 1; }
}

.wm-row-link {
	flex: 1 1 auto; min-width: 0; display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 1px 10px; padding: 9px 16px 10px 6px; color: inherit; text-decoration: none;
}
.wm-row-link:hover { text-decoration: none; }

.wm-row-from {
	font-size: 13.5px; font-weight: 540; color: var(--wm-ink);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wm-row-when { font-size: 11.5px; color: var(--wm-ink-3); text-align: right; white-space: nowrap; }
/* Column one, so the time can sit beside it in column two - the shape every mail client uses:
   sender and marks on the first line, subject and time on the second. */
.wm-row-subject {
	min-width: 0; font-size: 13.5px; color: var(--wm-ink-2);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Above the time, at the right hand end of the sender's line. */
.wm-row-marks {
	display: flex; align-items: center; justify-content: flex-end; gap: 6px;
	color: var(--wm-ink-3); white-space: nowrap;
}
.wm-row-marks:empty { display: none; }
.wm-row-marks .wm-icon { display: block; }

.wm-tag { font-size: 11px; }
/* The flag is the one mark that has to carry across a whole list of rows, so it is drawn at a
   size that can. At 11px it read as a smudge beside the date. */
.wm-tag-flag { color: var(--wm-bad); font-size: 15px; line-height: 1; }

.wm-row.is-unread .wm-row-from { font-weight: 700; }
.wm-row.is-unread .wm-row-subject { color: var(--wm-ink); font-weight: 600; }
.wm-row.is-unread { box-shadow: inset 3px 0 0 var(--wm-accent); }

.wm-empty-row { padding: 44px 20px; text-align: center; color: var(--wm-ink-3); font-size: 13.5px; }

.wm-pager {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 10px 14px; border-top: 1px solid var(--wm-line-soft); background: var(--wm-panel);
}
.wm-pager-state { font-size: 12.5px; color: var(--wm-ink-3); }

/* ---------- 7b. Row avatar, threads, preview ----------------------------- */

/*
	The row avatar is the same component as the one in the header, so it inherits that rule and
	only overrides what a dense list needs: a smaller box and a color taken from the sender
	rather than the fixed brand tint. The hue arrives as a number on --wm-hue from PHP, which is
	why the color is built here with hsl() instead of being written out as a hex value per row -
	an inline style carrying three colors per message would be a real weight on a 50 row page.

	The lightness pair is chosen so the letter clears WCAG AA against its own background at every
	hue on the wheel, which a fixed pair of saturations does not do.
*/
/*
	No margin and no self-alignment: the initial shares a square with the tick box now, and both are
	centered in it by the square. The offsets here were written for when it sat beside the tick box
	as a sibling, and inside the square they pushed it off center - a tick box that jumped 6px when
	it replaced the initial.
*/
.wm-row .wm-avatar {
	width: 30px; height: 30px; margin: 0; font-size: 12.5px; font-weight: 660;
	background: hsl(var(--wm-hue, 210) 62% 91%);
	color: hsl(var(--wm-hue, 210) 58% 30%);
}
@media (prefers-color-scheme: dark) {
	.wm-row .wm-avatar {
		background: hsl(var(--wm-hue, 210) 32% 28%);
		color: hsl(var(--wm-hue, 210) 70% 84%);
	}
}

/*
	The conversation count sits with the subject rather than out at the right edge, because it
	describes the subject - it is "4 messages about this", not a fourth piece of metadata. Keeping
	it inline also means it disappears with the subject when the subject is elided, instead of
	being left stranded against an empty row.
*/
.wm-thread-count {
	display: inline-block; min-width: 17px; margin-left: 6px; padding: 0 5px;
	border-radius: var(--wm-radius-pill);
	background: var(--wm-surface-3); color: var(--wm-ink-2);
	font-size: 10.5px; font-weight: 660; line-height: 16px; text-align: center;
	vertical-align: 1px;
}
.wm-row.is-unread .wm-thread-count { background: var(--wm-accent-tint); color: var(--wm-accent); }

/*
	The preview line is clamped rather than truncated with an ellipsis on one line, so that the
	two line setting is actually two lines of text. -webkit-line-clamp is the only property that
	does this across the browsers this has to run in; the width limit keeps the box honest if it
	is ever unsupported.

	The number of lines is a per mailbox preference, so the count comes from an attribute on the
	shell. Zero lines hides the element entirely rather than collapsing it to a zero height box,
	which would still take the row's grid gap.
*/
.wm-row-preview {
	grid-column: 1 / -1; margin-top: 2px;
	font-size: 12.5px; line-height: 1.45; color: var(--wm-ink-3);
	overflow: hidden; overflow-wrap: anywhere;
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1;
}
[data-wm-preview="0"] .wm-row-preview { display: none; }
[data-wm-preview="2"] .wm-row-preview { -webkit-line-clamp: 2; line-clamp: 2; }

/* ---------- 7c. Density -------------------------------------------------- */

/*
	Density changes the vertical rhythm only. Nothing is removed at compact and nothing is added
	at comfortable, so a person can switch between them without the list rearranging itself and
	losing their place - the same rows stay in the same order at a different height.
*/
[data-wm-density="compact"] .wm-row-link { padding-top: 7px; padding-bottom: 8px; }
[data-wm-density="compact"] .wm-row-check { width: 24px; height: 24px; margin-top: 8px; }
[data-wm-density="compact"] .wm-row .wm-avatar { width: 24px; height: 24px; font-size: 11px; }
[data-wm-density="compact"] .wm-row-meta { margin-top: 1px; }
[data-wm-density="compact"] .wm-row-from,
[data-wm-density="compact"] .wm-row-subject { font-size: 13px; }
[data-wm-density="compact"] .wm-row-preview { display: none; }

[data-wm-density="comfortable"] .wm-row-link { padding-top: 15px; padding-bottom: 16px; }
[data-wm-density="comfortable"] .wm-row-check { width: 36px; height: 36px; margin-top: 15px; }
[data-wm-density="comfortable"] .wm-row .wm-avatar { width: 36px; height: 36px; font-size: 14px; }

/* ---------- 7d. Reading pane position ------------------------------------ */

/*
	Three positions, one grid. The list and the pane are the same two elements in every case; only
	the track they sit in changes, so switching position never re-renders either of them.

	"bottom" puts the list above the pane inside the second column, which is why it needs rows as
	well as columns. The list keeps a fixed share rather than sizing to its content because a
	folder with three messages should not give the reading pane the whole window and then jump
	when a busier folder is opened.

	"off" removes the pane from the grid entirely. The pane is still in the document - it holds
	the open message when a row is clicked and the browser is narrow - so it is the grid that
	hides it, not the server, and no markup differs between the three settings.
*/
[data-wm-pane="bottom"] {
	grid-template-columns: var(--wm-sidebar-w) minmax(0, 1fr);
	grid-template-rows: minmax(0, 42%) minmax(0, 58%);
}
[data-wm-pane="bottom"] > .wm-sidebar { grid-row: 1 / span 2; }
[data-wm-pane="bottom"] > .wm-list-column { border-right: 0; border-bottom: 1px solid var(--wm-line); }
[data-wm-pane="bottom"] > .wm-list-column .wm-row-link { grid-template-columns: minmax(0, 1fr) auto; }

[data-wm-pane="off"] { grid-template-columns: var(--wm-sidebar-w) minmax(0, 1fr); }
[data-wm-pane="off"] > .wm-pane { display: none; }
/*
	With no pane the list is the whole window, and a 360px column of text in a 1400px window reads
	as a mistake. The row goes wide instead: sender, subject and date on one line, the way a list
	behaves when it is the only thing on screen.
*/
[data-wm-pane="off"] > .wm-list-column { border-right: 0; }
[data-wm-pane="off"] .wm-row-link {
	grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) auto;
	align-items: baseline; gap: 2px 14px;
}
[data-wm-pane="off"] .wm-row-from { grid-column: 1; }
[data-wm-pane="off"] .wm-row-subject { grid-column: 2; }
[data-wm-pane="off"] .wm-row-when { grid-column: 3; }
[data-wm-pane="off"] .wm-row-preview { grid-column: 2 / -1; -webkit-line-clamp: 1; line-clamp: 1; }
[data-wm-pane="off"] .wm-row-meta { grid-column: 2 / -1; }

/*
	Below the breakpoint there is one column of screen and the three settings stop meaning
	anything, so they are all reset to the single column behavior the shell already had. This
	has to come after the three blocks above to win on order alone, which is why the media query
	sits here rather than with the other responsive rules.
*/
@media (max-width: 900px) {
	.wm-shell,
	[data-wm-pane="bottom"],
	[data-wm-pane="off"] {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: minmax(0, 1fr);
	}
	[data-wm-pane="bottom"] > .wm-sidebar { grid-row: auto; }
	[data-wm-pane="off"] > .wm-pane { display: block; }
	[data-wm-pane="off"] .wm-row-link {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: stretch;
		gap: 1px 10px;
	}
	[data-wm-pane="off"] .wm-row-from { grid-column: 1; }
	[data-wm-pane="off"] .wm-row-subject,
	[data-wm-pane="off"] .wm-row-preview,
	[data-wm-pane="off"] .wm-row-meta { grid-column: 1 / -1; }
}

/* ---------- 8. Reading pane --------------------------------------------- */

.wm-pane { overflow-y: auto; padding: 20px 26px 40px; min-width: 0; }
.wm-pane-wide { padding: 20px clamp(20px, 5vw, 64px) 48px; }
.wm-pane-wide .wm-settings, .wm-pane-wide .wm-compose { max-width: 760px; margin: 0 auto; }

/*
	The flash belongs to the page it is about, so it holds the same column. Left to itself it
	spanned the whole pane while the page under it sat in a 760px column, which reads as a banner
	bolted to the window rather than a line about what just happened here.
*/
.wm-pane-wide .wm-flash { max-width: 760px; margin-left: auto; margin-right: auto; }

.wm-placeholder {
	height: 100%; display: flex; flex-direction: column; align-items: center;
	justify-content: center; gap: 8px; text-align: center; color: var(--wm-ink-3);
	padding: 40px 20px;
}
.wm-placeholder-mark {
	display: grid; place-items: center;
	width: 56px; height: 56px; border-radius: 16px; margin-bottom: 10px;
	background: var(--wm-accent-tint); border: 0; box-shadow: none;
	color: var(--wm-accent);
}
.wm-placeholder-mark svg { width: 26px; height: 26px; display: block; }
.wm-placeholder h2 { font-size: 16px; color: var(--wm-ink-2); }
.wm-placeholder p { font-size: 13.5px; }
.wm-placeholder-stats { display: flex; gap: 26px; margin: 18px 0 4px; }
.wm-placeholder-stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.wm-placeholder-stats dd { margin: 2px 0 0; font-size: 19px; font-weight: 620; color: var(--wm-ink); }
.wm-placeholder-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }

.wm-message-bar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin-bottom: 16px;
}
.wm-message-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.wm-inline-form { display: flex; align-items: center; gap: 4px; }

.wm-back {
	display: inline-flex; align-items: center; gap: 6px;
	color: var(--wm-ink-2); font-size: 13.5px; font-weight: 540;
}

.wm-message-head { padding-bottom: 16px; border-bottom: 1px solid var(--wm-line); }
.wm-subject { font-size: 21px; line-height: 1.3; margin-bottom: 14px; overflow-wrap: anywhere; }
.wm-from-row { display: flex; gap: 12px; align-items: flex-start; }
.wm-from-detail { min-width: 0; }
.wm-from-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.wm-from-email { font-weight: 400; color: var(--wm-ink-3); }
.wm-from-meta { font-size: 12.5px; color: var(--wm-ink-3); margin-top: 2px; }
.wm-dot { margin: 0 4px; }
.wm-recipients { font-size: 12.5px; color: var(--wm-ink-2); margin-top: 4px; overflow-wrap: anywhere; }
.wm-recipients span {
	display: inline-block; min-width: 20px; color: var(--wm-ink-3);
	font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
}

.wm-notice {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	margin: 16px 0 0; padding: 11px 14px;
	background: var(--wm-warn-tint); color: var(--wm-warn);
	border-radius: var(--wm-radius-control); font-size: 13px;
}
.wm-notice p { flex: 1 1 220px; }
.wm-notice .wm-button { background: rgba(255, 255, 255, .5); color: var(--wm-warn); }

.wm-body-frame {
	width: 100%; border: 0; margin-top: 18px; min-height: 220px;
	background: transparent; display: block;
	color-scheme: light dark;
}

/*
	An HTML message is the sender's own document, on the sender's own canvas: it carries
	its colors with it and, more often than not, a white background of its own. It is
	drawn on paper here rather than on the reading pane's surface, in both themes, so
	that the part of it the sender did not color cannot come out white on white - which
	is what the reader saw in dark mode, a message whose quoted rounds were readable and
	whose first paragraph was not there at all.

	A plain text message is markup this application wrote, so it keeps the pane's own
	surface and follows the theme.
*/
.wm-body-frame[data-wm-body="html"] {
	background: #ffffff;
	border-radius: var(--wm-radius-control);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	.wm-body-frame[data-wm-body="html"] { box-shadow: 0 0 0 1px rgba(255, 255, 255, .07); }
}

/*
	A meeting invitation, above the message it arrived in. The body of an invitation is usually the
	same words as the card and sometimes nothing at all, and the answer is what the reader came for.
*/
.wm-invite {
	margin: 0 0 16px; padding: 16px 18px;
	border: 1px solid var(--wm-line-card); border-left: 3px solid var(--wm-accent);
	border-radius: var(--wm-radius-control); background: var(--wm-surface);
}
.wm-invite.is-canceled { border-left-color: var(--wm-bad); }
.wm-invite-kind {
	font-size: 11.5px; font-weight: 640; letter-spacing: .04em; text-transform: uppercase;
	color: var(--wm-accent); margin-bottom: 4px;
}
.wm-invite.is-canceled .wm-invite-kind { color: var(--wm-bad); }
.wm-invite-title { font-size: 16px; font-weight: 620; margin: 0 0 12px; }
.wm-invite.is-canceled .wm-invite-title { text-decoration: line-through; color: var(--wm-ink-2); }

.wm-invite-facts { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.wm-invite-facts > div { display: flex; gap: 12px; align-items: baseline; }
.wm-invite-facts dt {
	flex: 0 0 72px; font-size: 12px; color: var(--wm-ink-3);
	text-transform: uppercase; letter-spacing: .04em;
}
.wm-invite-facts dd { margin: 0; font-size: 13.5px; color: var(--wm-ink); overflow-wrap: anywhere; }
.wm-invite-note { font-size: 12px; color: var(--wm-ink-3); }
.wm-invite-answered { font-size: 13px; color: var(--wm-ok); margin: 0 0 12px; }
.wm-invite-answers { display: flex; flex-wrap: wrap; gap: 8px; }
.wm-invite-answers form { display: contents; }

/*
	Directly under the header and above the body, where a reader sees it without scrolling. The
	rule underneath separates it from the message the same way the header's rule separates it from
	the addresses.
*/
.wm-attachments { margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--wm-line); }
.wm-attachments h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--wm-ink-3); margin-bottom: 10px; }
.wm-attachments ul { display: flex; flex-wrap: wrap; gap: 8px; }

.wm-attachment {
	display: flex; align-items: center; gap: 9px; max-width: 320px;
	padding: 9px 15px 9px 12px;
	background: var(--wm-surface); border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-pill); color: var(--wm-ink); text-decoration: none;
	box-shadow: var(--wm-shadow-card);
}
.wm-attachment:hover { border-color: var(--wm-accent); text-decoration: none; }
.wm-attachment-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.wm-attachment-name {
	font-size: 13px; font-weight: 540; overflow: hidden;
	text-overflow: ellipsis; white-space: nowrap;
}
.wm-attachment-meta { font-size: 11.5px; color: var(--wm-ink-3); white-space: nowrap; }

/*
	The rest of the conversation, under the open message. One row a message, and the row is a link
	to it: the reader can see the thread without leaving the message they are reading.
*/
.wm-thread { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--wm-line); }
.wm-thread h2 {
	font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
	color: var(--wm-ink-3); margin-bottom: 10px;
}
.wm-thread ul { display: flex; flex-direction: column; gap: 2px; }
.wm-thread-row {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 12px; border-radius: var(--wm-radius-control);
	color: var(--wm-ink); text-decoration: none;
}
.wm-thread-row:hover { background: var(--wm-surface-2); text-decoration: none; }
.wm-thread-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.wm-thread-from { font-size: 13.5px; font-weight: 540; }
.wm-thread-row.is-unread .wm-thread-from { font-weight: 700; }
.wm-thread-preview {
	font-size: 12.5px; color: var(--wm-ink-3);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wm-thread-when { margin-left: auto; font-size: 12px; color: var(--wm-ink-3); white-space: nowrap; }

/* ---------- 9. Compose --------------------------------------------------- */

/*
	The attached files, above the message the way every mail client shows them. One chip a file:
	the kind, the name over its size, and the control that takes it off again on the right.
*/
.wm-attach { padding: 14px 22px 0; }
.wm-attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wm-attach-item {
	display: flex; align-items: center; gap: 10px;
	min-width: 218px; max-width: 100%; padding: 8px 8px 8px 10px;
	border: 1px solid var(--wm-line-card); border-radius: var(--wm-radius-control);
	background: var(--wm-surface);
}
.wm-attach-kind {
	flex: none; display: grid; place-items: center;
	width: 34px; height: 34px; border-radius: 8px;
	background: color-mix(in srgb, var(--wm-accent) 12%, transparent);
	color: var(--wm-accent); font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.wm-attach-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.wm-attach-name {
	font-size: 13px; font-weight: 540; color: var(--wm-ink);
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wm-attach-size { font-size: 11.5px; color: var(--wm-ink-3); }
.wm-attach-warn { font-size: 11.5px; color: var(--wm-bad); }
.wm-attach-remove {
	flex: none; margin-left: auto; width: 26px; height: 26px;
	display: grid; place-items: center;
	border: 0; border-radius: 50%; background: transparent;
	color: var(--wm-ink-3); font-size: 11px; cursor: pointer;
}
.wm-attach-remove:hover { background: var(--wm-bad-tint); color: var(--wm-bad); }
.wm-attach-note { margin-top: 8px; font-size: 12px; color: var(--wm-ink-3); }

/* The autosave line beside the buttons, and the state the card takes while a file is over it. */
.wm-draft-status { font-size: 12px; color: var(--wm-ink-3); margin-right: 8px; }
.wm-draft-status.is-bad { color: var(--wm-bad); }
.wm-drop-note { flex: 1 0 100%; font-size: 12px; color: var(--wm-accent); }
.wm-compose.is-dropping .wm-compose-card { outline: 2px dashed var(--wm-accent); outline-offset: -2px; }


.wm-compose-title { font-size: 17px; }
.wm-compose-card { padding: 0; overflow: hidden; }

.wm-compose-row {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 20px; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-compose-label {
	flex: 0 0 58px; font-size: 12px; font-weight: 560; color: var(--wm-ink-3);
	text-transform: uppercase; letter-spacing: .05em;
}
.wm-compose-from { font-size: 13.5px; color: var(--wm-ink-2); overflow-wrap: anywhere; }
.wm-compose-input {
	flex: 1 1 auto; border: 0; padding: 4px 0; background: transparent;
	border-radius: 0; min-width: 0;
}
.wm-compose-input:focus { box-shadow: none; border-color: transparent; }
.wm-copies-toggle { flex: 0 0 auto; }

.wm-compose-body {
	width: 100%; border: 0; border-radius: 0; padding: 18px 20px;
	background: transparent; min-height: 300px; line-height: 1.6;
	font-family: var(--wm-font);
}
.wm-compose-body:focus { box-shadow: none; }

.wm-compose-foot {
	display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
	padding: 12px 18px; border-top: 1px solid var(--wm-line-soft);
	background: var(--wm-surface-2);
}
.wm-compose-hint { font-size: 12px; color: var(--wm-ink-3); margin-left: auto; }

.wm-file input[type="file"] {
	position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.wm-file { cursor: pointer; display: inline-block; position: relative; }
.wm-file input:focus-visible + span { outline: 2px solid var(--wm-accent); outline-offset: 2px; }

/* ---------- 10. Settings ------------------------------------------------- */

.wm-folder-admin { display: flex; flex-direction: column; margin-bottom: 22px; }
.wm-folder-admin li {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	padding: 9px 0; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-folder-admin-name {
	flex: 1 1 160px; font-size: 13.5px; font-weight: 540;
	padding-left: calc(var(--wm-depth, 0) * 13px);
}
.wm-folder-admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wm-newfolder { padding-top: 6px; }

/* ---------- 9b. Ribbon ---------------------------------------------------
   A tab strip and one toolbar row, the way Outlook lays out the top of a mailbox. The tabs are
   radio inputs and the panels are chosen with :has(), so a browser with no script still switches
   between them; the script only adds the remembered choice and the collapse. Everything in the
   row is one height and one shape - the row is the control, so nothing inside it gets a frame
   of its own. */

.wm-ribbon {
	display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
	padding: 0 12px;
	background: var(--wm-panel);
	border-bottom: 1px solid var(--wm-line);
}
.wm-ribbon-radio { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wm-ribbon-tab {
	position: relative; display: inline-flex; align-items: center; height: 36px; padding: 0 12px;
	border-radius: 9px 9px 0 0; color: var(--wm-ink-2);
	font-size: 13.5px; font-weight: 560; cursor: pointer; user-select: none;
}
.wm-ribbon-tab:hover { color: var(--wm-ink); background: var(--wm-surface-2); }
.wm-ribbon-radio:checked + .wm-ribbon-tab { color: var(--wm-accent); font-weight: 660; }
.wm-ribbon-radio:checked + .wm-ribbon-tab::after {
	content: ""; position: absolute; right: 12px; bottom: 0; left: 12px;
	height: 2px; border-radius: 2px 2px 0 0; background: var(--wm-accent);
}
.wm-ribbon-radio:focus-visible + .wm-ribbon-tab { outline: 2px solid var(--wm-accent); outline-offset: -2px; }

.wm-ribbon-fold {
	margin-left: auto; display: inline-grid; place-items: center; width: 32px; height: 32px;
	border: 0; border-radius: var(--wm-radius-pill); background: transparent;
	color: var(--wm-ink-3); cursor: pointer;
}
.wm-ribbon-fold:hover { background: var(--wm-surface-2); color: var(--wm-ink-2); }
.wm-ribbon-chevron {
	width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}
body.wm-ribbon-folded .wm-ribbon-chevron { transform: translateY(2px) rotate(-135deg); }
body.wm-ribbon-folded .wm-ribbon-panels { display: none; }

/* Full width, so it sits under the tabs rather than beside them. */
.wm-ribbon-panels {
	flex: 1 0 100%; margin: 0 -12px; padding: 7px 10px;
	border-top: 1px solid var(--wm-line-soft);
}
.wm-ribbon-panel { display: none; align-items: center; gap: 2px; flex-wrap: wrap; }
/* The checked tab picks its panel. Both are children of .wm-ribbon, so this is a plain sibling
   selector and needs nothing newer than CSS2 to work. */
#wm-ribbon-home:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="home"],
#wm-ribbon-view:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="view"],
#wm-ribbon-message:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="message"],
#wm-ribbon-insert:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="insert"],
#wm-ribbon-format:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="format"],
#wm-ribbon-options:checked ~ .wm-ribbon-panels > [data-wm-ribbon-panel="options"] { display: flex; }

.wm-ribbon-item {
	display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
	border: 0; border-radius: 9px; background: transparent; color: var(--wm-ink);
	font: inherit; font-size: 13px; font-weight: 540; text-decoration: none;
	cursor: pointer; white-space: nowrap; list-style: none;
}
.wm-ribbon-item::-webkit-details-marker { display: none; }
.wm-ribbon-item:hover { background: var(--wm-surface-2); text-decoration: none; color: var(--wm-ink); }
.wm-ribbon-item .wm-icon { color: var(--wm-ink-3); flex: 0 0 auto; }
.wm-ribbon-item:hover .wm-icon { color: var(--wm-ink-2); }
.wm-ribbon-item.is-primary { color: var(--wm-on-accent); background: var(--wm-accent); font-weight: 620; }
.wm-ribbon-item.is-primary .wm-icon, .wm-ribbon-item.is-primary:hover .wm-icon { color: currentColor; }
.wm-ribbon-item.is-primary:hover { background: var(--wm-accent-strong, var(--wm-accent)); color: var(--wm-on-accent); filter: brightness(.96); }
.wm-ribbon-item.is-danger:hover { color: var(--wm-danger, #b3261e); }
.wm-ribbon-item.is-danger:hover .wm-icon { color: currentColor; }
.wm-ribbon-item[disabled] { opacity: .4; cursor: default; }
.wm-ribbon-item[disabled]:hover { background: transparent; }

.wm-ribbon-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--wm-line); flex: 0 0 auto; }

.wm-ribbon-menu { position: relative; flex: 0 0 auto; }
.wm-ribbon-menu[open] > .wm-ribbon-item { background: var(--wm-surface-2); }
/* The pane hangs from the left of its menu here, not the right: these menus sit at the left hand
   end of a wide row, so opening rightwards is what keeps them on screen. */
.wm-ribbon-menu > .wm-more-pane { right: auto; left: 0; }
.wm-ribbon-menu > .wm-more-pane::before, .wm-ribbon-menu > .wm-more-pane::after { right: auto; left: 22px; }
.wm-more-item.is-on { color: var(--wm-accent); font-weight: 660; }
/* Formatting is real only once the rich editor exists; until then the plain-text note stands in
   its place, so the tab never offers a control that would do nothing. */
.wm-ribbon-rich { display: none; align-items: center; gap: 2px; }
body.wm-editor-live .wm-ribbon-rich { display: inline-flex; }
.wm-ribbon-plain { color: var(--wm-ink-3); font-size: 12.5px; padding: 0 6px; }
body.wm-editor-live .wm-ribbon-plain { display: none; }

/* An icon-only tool: square, so a row of them reads as a row rather than as pills of odd widths. */
.wm-ribbon-tool { padding: 0; width: 34px; justify-content: center; }
.wm-ribbon-tool[aria-pressed="true"] { background: var(--wm-accent-tint); color: var(--wm-accent); }
.wm-ribbon-tool[aria-pressed="true"] .wm-icon { color: currentColor; }

.wm-ribbon-select {
	width: auto; height: 34px; padding: 0 26px 0 10px;
	border: 1px solid var(--wm-line); border-radius: 9px;
	background-color: var(--wm-surface); color: var(--wm-ink);
	font: inherit; font-size: 13px; font-weight: 540; cursor: pointer;
}
.wm-ribbon-select.is-narrow { min-width: 72px; }

.wm-swatch {
	width: 14px; height: 14px; flex: 0 0 auto; border-radius: 4px;
	border: 1px solid rgba(20, 19, 26, .18);
}

.wm-ribbon-caret {
	width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
	transform: translateY(-2px) rotate(45deg); opacity: .6; flex: 0 0 auto;
}

/* ---------- 10b. Collapsed folder pane -----------------------------------
   The bars button in the header collapses the folder pane to a rail of icons and expands it
   again, the way Outlook does. Every destination stays on the rail - a collapsed pane that
   hides half the navigation is a pane you have to keep re-opening - so the labels go and the
   icons, the unread counts and the current-folder mark stay. The state lives on <html> so the
   inline script in the head can restore it before the first paint.

   Below 900px the pane is a drawer over the page instead, and the same button opens it: the
   narrow rules further down override these, so a phone never gets a rail it cannot widen. */

.wm-nav-link { display: flex; align-items: center; gap: 9px; }
.wm-sidebar-foot .wm-nav-link { display: flex; }
.wm-nav-icon { display: inline-grid; place-items: center; width: 16px; flex: 0 0 auto; opacity: .85; }

@media (min-width: 901px) {
	html.wm-nav-collapsed { --wm-sidebar-w: 64px; }
	html.wm-nav-collapsed .wm-sidebar { padding: 16px 8px 12px; align-items: stretch; }

	html.wm-nav-collapsed .wm-folder { justify-content: center; gap: 0; padding: 9px 0; position: relative; }
	html.wm-nav-collapsed .wm-folder-icon { opacity: 1; }
	html.wm-nav-collapsed .wm-nav-label,
	html.wm-nav-collapsed .wm-folder-name,
	html.wm-nav-collapsed .wm-address { display: none; }

	/* The count becomes a mark on the icon: the number itself needs room the rail does not have. */
	html.wm-nav-collapsed .wm-badge {
		position: absolute; top: 4px; right: 10px; min-width: 8px; width: 8px; height: 8px;
		padding: 0; font-size: 0; line-height: 0; overflow: hidden;
	}

	html.wm-nav-collapsed .wm-sidebar-foot { padding: 12px 0 4px; }
	/* .wm-sidebar-foot .wm-quiet-link sets display:block and outweighs .wm-nav-link on its own,
	   so the rail's version has to be written at the same depth or the icons stay left aligned. */
	html.wm-nav-collapsed .wm-sidebar-foot .wm-nav-link {
		display: flex; justify-content: center; padding: 9px 0; border-radius: var(--wm-radius-pill);
	}
	html.wm-nav-collapsed .wm-sidebar-foot .wm-nav-link:hover { background: var(--wm-surface-2); }
	html.wm-nav-collapsed .wm-sidebar-foot .wm-nav-link.is-current { background: var(--wm-accent-tint); }
}

/* ---------- 11. Narrow --------------------------------------------------- */

.wm-only-narrow { display: none; }

@media (max-width: 900px) {
	.wm-only-narrow { display: inline-flex; }

	.wm-shell,
	body[data-layout="wide"] .wm-shell { grid-template-columns: minmax(0, 1fr); }

	/* A phone gets the drawer, never the rail: reset anything the collapsed state set. */
	html.wm-nav-collapsed { --wm-sidebar-w: 232px; }

	.wm-sidebar {
		position: fixed; top: var(--wm-top-h); bottom: 0; left: 0; width: 264px;
		z-index: 40; transform: translateX(-100%);
		transition: transform .2s cubic-bezier(.32, .72, 0, 1);
		box-shadow: var(--wm-shadow-pop);
	}
	body.wm-sidebar-open .wm-sidebar { transform: none; }
	body.wm-sidebar-open::after {
		content: ""; position: fixed; inset: var(--wm-top-h) 0 0; z-index: 35;
		background: rgba(20, 19, 26, .38);
	}

	/* One column at a time; the server decides which, so the first paint is right. */
	body[data-pane="list"] .wm-pane { display: none; }
	body[data-pane="detail"] .wm-list-column { display: none; }

	.wm-list-column { border-right: 0; }
	.wm-pane { padding: 16px 16px 40px; }
	.wm-pane-wide { padding: 16px 16px 40px; }

	.wm-brand-text { display: none; }
	.wm-search { max-width: none; }
	.wm-signout .wm-button { display: none; }

	.wm-message-actions { width: 100%; margin-left: 0; }
	.wm-compose-label { flex-basis: 46px; }
	.wm-subject { font-size: 19px; }
}

@media (max-width: 560px) {
	.wm-account .wm-avatar { width: 32px; height: 32px; }
	.wm-card { padding: 20px 18px; border-radius: 14px; }
	.wm-placeholder-stats { gap: 18px; }
	.wm-attachment { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* New-mail line above the message list. Quiet by design: it is an offer, not an alert. */
.wm-new-mail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--wm-line, rgba(255,255,255,.08));
    background: var(--wm-accent-soft, rgba(99,102,241,.12));
    font-size: 13px;
    font-weight: 600;
}
.wm-new-mail button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--wm-accent, #6366f1);
    cursor: pointer;
    text-decoration: underline;
}

/* ---------- 12. Settings controls ------------------------------------- */

/* ==========================================================================
 * Pending: styles for the Reading card in Settings.
 * --------------------------------------------------------------------------
 * These belong in webmail.css, next to the control and .wm-field rules they
 * extend, but that file is being edited elsewhere, so they are parked here to
 * be folded in. Nothing links this file yet: layout.php loads webmail.css and
 * nothing else, so either move these three blocks across or add the link.
 *
 * The markup is written to survive that not happening. Without these rules a
 * radio still sits next to its own label (.wm-check already does that), the
 * group headings still read as their own line, and a number input is still
 * narrow - it just misses the shared control chrome.
 * ========================================================================== */

/*
 * The base control rule in webmail.css lists input types one by one so that it
 * cannot catch a checkbox or a radio, which means number was left out with
 * them. It wants the same chrome as a text field, so it is added rather than
 * folded into that selector list, where it would be easy to read as "every
 * input" and start restyling the marks.
 */
input[type="number"] {
	font: inherit; color: var(--wm-ink);
	background: var(--wm-surface);
	border: 1px solid var(--wm-control-line);
	border-radius: var(--wm-radius-control);
	padding: 9px 13px;
	transition: border-color .14s ease, box-shadow .14s ease;
}

/*
 * A field that holds at most two digits is sized for two digits. .wm-input-small
 * is the near neighbor but carries a 130px minimum meant for the folder rename
 * box, which on a number reads as an empty text field someone forgot to fill.
 */
.wm-input-number { width: 5.5em; padding: 6px 11px; font-size: 13.5px; }

/*
 * A group of radios, headed the way .wm-field heads a single input. The heading
 * is a span rather than a label because it names three controls and belongs to
 * none of them; .wm-field is not reused here because .wm-field label would win
 * against .wm-check and lay every option out as a block, putting each mark on
 * the line above its own words.
 */
.wm-choice { margin-bottom: 16px; }
.wm-choice-label {
	display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 560;
	color: var(--wm-ink-2); letter-spacing: .005em;
}

/* ---------- 13. Address book ------------------------------------------ */

/* ==========================================================================
 * WBAMS Webmail - address book, and the recipient suggestions in the composer.
 * --------------------------------------------------------------------------
 * Nothing here re-states a token or a component that webmail.css already
 * describes: buttons, fields, cards and the muted note text are the shared
 * ones, and what follows is only the arrangement those pieces take on this
 * page plus the one thing the base sheet has no equivalent of, the suggestion
 * pane.
 *
 * Rows are separated by a hairline rather than boxed. They already sit inside
 * a rounded card, and a border around each row would put a square frame inside
 * a round one - the same reason the folder list in settings is drawn this way.
 * ========================================================================== */

/* ---------- The page ----------------------------------------------------- */

/*
	The reading pane is the full width of the shell on this page, so the column
	is held to the same measure the settings and compose pages use. Long
	addresses are why it matters: text set the width of a desktop window is
	unreadable, and an address book is nothing but short lines.
*/
.wm-pane-wide .wm-contacts { max-width: 760px; margin: 0 auto; }

.wm-contacts-search {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin-bottom: 16px;
}
.wm-contacts-search input[type="search"] { flex: 1 1 220px; min-width: 0; }

/*
	Help text sits under the input it explains, never above: it answers a
	question the field has already raised, and read before the field it is just
	an obstacle between the label and the thing being labeled.
*/
.wm-field-help {
	margin: 6px 0 0; font-size: 12.5px; color: var(--wm-ink-3); line-height: 1.5;
}

.wm-contacts-empty {
	padding: 8px 0 20px; color: var(--wm-ink-3); font-size: 13.5px;
}
.wm-contacts-empty p + p { margin-top: 6px; }

/* ---------- Saved contacts ----------------------------------------------- */

.wm-contact-list, .wm-recent-list { display: flex; flex-direction: column; margin-bottom: 22px; }

.wm-contact-row, .wm-recent-row {
	display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
	padding: 10px 0; border-bottom: 1px solid var(--wm-line-soft);
}
/* The line between rows is between rows. Under the last one it is a rule across the card. */
.wm-contact-row:last-child, .wm-recent-row:last-child { border-bottom: 0; padding-bottom: 0; }
.wm-contact-list:last-child, .wm-recent-list:last-child { margin-bottom: 0; }

/*
	A row being edited grows from one line to a small form, so it stops trying
	to keep its actions on the same line as its content.
*/
.wm-contact-row.is-editing { align-items: flex-start; padding-bottom: 16px; }

.wm-contact-identity, .wm-recent-identity {
	display: flex; flex-direction: column; gap: 1px;
	flex: 1 1 220px; min-width: 0;
}

.wm-contact-name { font-size: 14px; font-weight: 560; overflow-wrap: anywhere; }
.wm-contact-address { font-size: 12.5px; color: var(--wm-ink-2); overflow-wrap: anywhere; }
.wm-contact-note { font-size: 12.5px; color: var(--wm-ink-3); margin-top: 3px; white-space: pre-line; }
.wm-recent-meta { font-size: 12px; color: var(--wm-ink-3); margin-top: 2px; }

/*
	Actions are pushed to the trailing edge, and Delete is last in the markup as
	well as in the layout: the destructive one is the one the hand should have
	to travel furthest to reach, and it must not move when the quiet actions
	beside it change.
*/
.wm-contact-actions {
	display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto;
}

.wm-contact-edit { flex: 1 1 100%; min-width: 0; padding-top: 4px; }
.wm-contact-edit .wm-field:last-of-type { margin-bottom: 10px; }
.wm-contact-edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.wm-contacts-add { padding-top: 6px; }

/* ---------- Recipient suggestions ---------------------------------------- */

/*
	The pane is a child of <body> and positioned by script, not by this sheet.
	It has to be: the composer card is overflow:hidden so it can clip its own
	rounded corners, and a pane positioned inside that card would be cut off at
	the first row it grew past. Fixed positioning also means the pane cannot be
	dragged out of place by the pane behind it scrolling - the script closes it
	instead.
*/
.wm-suggest {
	position: fixed; z-index: 60; margin: 0; padding: 5px;
	min-width: 220px; max-width: min(420px, calc(100vw - 24px));
	max-height: 302px; overflow-y: auto;
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-control);
	box-shadow: var(--wm-shadow-pop);
	list-style: none;
}

/*
	The caret. A pane that simply appears near a field belongs to nothing in
	particular; the caret says which control it is answering. --wm-caret-x is
	set by the script to the middle of the field, so the point still lands on
	the control when the pane has been nudged sideways to stay on screen.
*/
.wm-suggest::before, .wm-suggest::after {
	content: ""; position: absolute; left: var(--wm-caret-x, 22px);
	width: 0; height: 0; border: 7px solid transparent;
}
.wm-suggest::before { top: -14px; border-bottom-color: var(--wm-line-card); }
.wm-suggest::after { top: -12px; border-bottom-color: var(--wm-surface); }

/* Above the field instead, when there was no room below it. */
.wm-suggest.is-above::before { top: auto; bottom: -14px; border-bottom-color: transparent; border-top-color: var(--wm-line-card); }
.wm-suggest.is-above::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: var(--wm-surface); }

.wm-suggest-option {
	display: flex; flex-direction: column; gap: 1px;
	padding: 7px 11px; border-radius: 9px; cursor: pointer;
}

/*
	Highlighted by a class rather than by :hover alone. The keyboard and the
	mouse have to agree about which row Enter would take, and :hover cannot
	express what the arrow keys did.
*/
.wm-suggest-option.is-active { background: var(--wm-accent-tint); }
.wm-suggest-option.is-active .wm-suggest-name { color: var(--wm-accent); }

.wm-suggest-name { font-size: 13.5px; font-weight: 540; overflow-wrap: anywhere; }
.wm-suggest-address { font-size: 12px; color: var(--wm-ink-2); overflow-wrap: anywhere; }

@media (max-width: 560px) {
	.wm-contact-actions { margin-left: 0; }
	.wm-suggest { max-width: calc(100vw - 20px); }
}

/* ---------- 14. Rules ------------------------------------------------- */

/* ==========================================================================
 * WBAMS Webmail - the Rules page.
 * --------------------------------------------------------------------------
 * Parked here rather than written into webmail.css because that file is being
 * edited elsewhere. Nothing links this file yet: layout.php loads webmail.css
 * and nothing else, so these blocks either move across or the link is added.
 *
 * The page is built out of what the base sheet already describes - cards,
 * fields, selects, pill buttons, the muted note - and what follows is only the
 * arrangement those take here, plus the two things the base sheet has no
 * equivalent of: a card footer that sits flush, and the confirmation dialog.
 *
 * Rows are separated by a hairline and never boxed. A rule is a row inside a
 * rounded card, not a card of its own, and a border around each one would be a
 * square frame inside a round one.
 * ========================================================================== */

/* ---------- The page ----------------------------------------------------- */

/*
	Held to the same measure as settings and compose. A rule reads as a
	sentence, and a sentence set the width of a desktop window is not read, it
	is scanned.
*/
.wm-pane-wide .wm-rules { max-width: 760px; margin: 0 auto; }

/*
	The order form holds nothing but its token and its operation; every id and
	button in it belongs to a rule row and reaches it through a form attribute.
	Left as a block it would open a gap between the card heading and the list.
*/
.wm-rules form[data-wm-order] { display: contents; }

/* ---------- Card footer -------------------------------------------------- */

/*
	Flush: it is pulled out to the card's own edges by the padding the card
	sets, so the rule above it runs the full width and the footer sits in the
	corner rather than floating a few pixels inside it. The radius is the
	card's less its border, which is what keeps the tint from showing outside
	the curve.
*/
.wm-card-foot {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	margin: 22px -26px -24px; padding: 15px 26px;
	border-top: 1px solid var(--wm-line-soft);
	background: var(--wm-surface-2);
	border-radius: 0 0 15px 15px;
}
.wm-card-foot .wm-card-note { margin: 0; flex: 1 1 220px; }

/* ---------- The rules, in the order they run ----------------------------- */

.wm-rule-list { list-style: none; margin: 0; padding: 0; }

.wm-rule {
	display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
	padding: 12px 0; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-rule:last-child { border-bottom: 0; }

/*
	The position, stated rather than implied. Order is what decides which rule
	reaches a message first, so it is a number on the row and not a piece of
	knowledge the reader has to reconstruct by counting.
*/
.wm-rule-number {
	flex: 0 0 auto; min-width: 20px; padding-top: 3px;
	font-size: 12.5px; font-weight: 600; color: var(--wm-ink-3);
	font-variant-numeric: tabular-nums; text-align: right;
}

.wm-rule-power { display: flex; align-items: center; gap: 8px; padding-top: 1px; }
.wm-rule-power .wm-check { margin: 0; }

.wm-rule-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; min-width: 0; }
.wm-rule-name { font-size: 14px; font-weight: 560; overflow-wrap: anywhere; }
.wm-rule-sentence { font-size: 12.5px; color: var(--wm-ink-2); line-height: 1.5; overflow-wrap: anywhere; }

/* What a preview found for this rule, or why it could not be run. */
.wm-rule-count { font-size: 12.5px; color: var(--wm-accent); margin-top: 2px; }

/*
	A rule that is off keeps its place in the order - it has not stopped being
	the third rule - so it is dimmed rather than moved or hidden. The switch and
	the buttons keep their contrast, because they are what turns it back on.
*/
.wm-rule.is-off .wm-rule-name,
.wm-rule.is-off .wm-rule-sentence { color: var(--wm-ink-3); }

/*
	Actions on the trailing edge, delete last in the markup as well as in the
	layout: the destructive one should be the furthest for the hand to travel,
	and it must not move when the buttons beside it change.
*/
.wm-rule-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }

.wm-rule-move { width: 32px; height: 32px; font-size: 15px; }
.wm-rule-move[disabled] { opacity: .3; cursor: default; }
.wm-rule-move[disabled]:hover { background: transparent; }

/* ---------- The form ----------------------------------------------------- */

.wm-rule-rows { display: flex; flex-direction: column; }

/*
	One condition, or one action, per line. The controls wrap onto a second line
	on a narrow screen instead of shrinking to the point where the folder in a
	move action cannot be read.
*/
.wm-rule-row {
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	padding: 8px 0; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-rule-row:last-child { border-bottom: 0; }

.wm-rule-field { flex: 1 1 150px; min-width: 0; }
.wm-rule-comparator { flex: 0 1 auto; min-width: 92px; }
.wm-rule-value { flex: 2 1 180px; min-width: 0; display: block; }
.wm-rule-value select { width: 100%; }
.wm-rule-folder { flex: 1 1 180px; min-width: 0; margin-left: auto; }

/* Hidden by the script when the chosen field has no use for it, not disabled. */
.wm-rule-value[hidden], .wm-rule-folder[hidden] { display: none; }

.wm-rule-row .wm-check { flex: 1 1 200px; margin: 0; }

/* Removing a row is destructive in miniature, so it goes at the end of the row. */
.wm-rule-drop { margin-left: auto; width: 32px; height: 32px; color: var(--wm-ink-3); }
.wm-rule-drop:hover { background: var(--wm-bad-tint); color: var(--wm-bad); }

/* The operator list the script copies from. It has no name and posts nothing. */
.wm-rule-operator-source { display: none; }

/* ---------- Deleting a rule ---------------------------------------------- */

/*
	The application's own confirmation, because window.confirm() cannot say what
	the rule being deleted actually does, cannot be themed, and is not there at
	all with script off. This is a state of the page: a link puts it up, a form
	post answers it, and Cancel is a link back to the page without it.
*/
.wm-modal {
	position: fixed; inset: 0; z-index: 70;
	display: grid; place-items: center; padding: 20px;
	background: rgba(20, 19, 26, .38);
}

.wm-modal-card {
	width: min(420px, 100%);
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-card);
	box-shadow: var(--wm-shadow-pop);
	padding: 24px 26px;
}
.wm-modal-card h2 { font-size: 16px; margin-bottom: 8px; }

/* Cancel first, delete on the right, where every destructive action here sits. */
.wm-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }

@media (max-width: 560px) {
	/* The card's padding changes at this width, so the flush footer follows it. */
	.wm-card-foot { margin: 20px -18px -20px; padding: 14px 18px; border-radius: 0 0 13px 13px; }
	.wm-modal-card { padding: 20px 18px; border-radius: 14px; }
	.wm-rule-tools { margin-left: 0; }
	.wm-rule-folder { margin-left: 0; }
}

/* ---------- 15. Keyboard cursor and help ------------------------------ */

/* ==========================================================================
 * WBAMS Webmail - keyboard cursor and the shortcuts panel.
 *
 * Two things only: the state that says "the keyboard is here", and the dialog
 * that lists the keys. Both are built from the existing tokens, so they follow
 * the accent set in Setup and turn dark with the rest of the app; the panel is
 * a themed surface rather than a browser dialog, for the same reason every
 * other pop in this app is - a system alert would arrive in system colors,
 * with system typography, in the middle of a page that is neither.
 * ========================================================================== */

/* ---------- the cursor --------------------------------------------------- */

/*
	The row already has two states this must not be confused with: hover, which is a soft fill,
	and is-open, which is the accent tint marking the message in the reading pane. The cursor is
	therefore drawn as a line around the row rather than another fill, so it reads clearly on top
	of either of them - a row can be open and under the cursor at once, or open while the cursor
	is three rows further down, and both must be legible at a glance.

	It is an outline rather than a box-shadow because is-unread already spends the row's
	box-shadow on its accent bar down the left edge, and the two would fight.
*/
.wm-row.is-cursor {
	outline: 2px solid var(--wm-accent);
	outline-offset: -2px;
	border-radius: 8px;
	background: var(--wm-surface-3);
}

.wm-row.is-cursor.is-open {
	background: var(--wm-accent-tint);
}

/* One ring, not two: real focus lands on this row, and the cursor is already drawing it. */
.wm-row.is-cursor:focus,
.wm-row.is-cursor:focus-visible {
	outline: 2px solid var(--wm-accent);
	outline-offset: -2px;
}

/* ---------- the shortcuts panel ------------------------------------------ */

.wm-keys {
	position: fixed; inset: 0; z-index: 80;
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
	background: rgba(20, 19, 26, .38);
}

.wm-keys-pane {
	width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto;
	background: var(--wm-surface);
	color: var(--wm-ink);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-card);
	box-shadow: var(--wm-shadow-pop);
	padding: 22px 24px 18px;
}

.wm-keys-title { font-size: 16px; margin-bottom: 14px; }

/*
	A description list, because that is what this is: a key and what it does. The grid keeps the
	keys in their own column so the eye can run down them without reading the labels.
*/
.wm-keys-list {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 8px 16px;
	margin: 0;
	align-items: baseline;
}

.wm-keys-list dt { white-space: nowrap; font-size: 11.5px; color: var(--wm-ink-3); }
.wm-keys-list dd { margin: 0; font-size: 13.5px; color: var(--wm-ink-2); }

.wm-key {
	display: inline-block; min-width: 20px; text-align: center;
	padding: 2px 6px;
	font: inherit; font-size: 12px; font-weight: 600;
	color: var(--wm-ink);
	background: var(--wm-surface-2);
	border: 1px solid var(--wm-control-line);
	border-bottom-width: 2px;
	border-radius: 6px;
}

.wm-keys-close { display: block; margin: 18px 0 0 auto; }

@media (max-width: 560px) {
	.wm-keys { padding: 14px; }
	.wm-keys-pane { padding: 18px 16px 14px; }
}

/* ---------- dark ---------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
	/*
		The tokens have already flipped, so only two things need saying again. The cursor fill is
		too close to the row behind it once every surface is dark, so it is tinted with the accent
		instead; and the surround is darkened, because a dim overlay that worked over an off-white
		page does almost nothing over a dark one.
	*/
	.wm-row.is-cursor {
		background: rgba(var(--wm-accent-rgb), .14);
	}

	.wm-keys {
		background: rgba(0, 0, 0, .6);
	}

	.wm-key {
		background: var(--wm-surface-3);
	}
}

/* ---------- 16. Rich composer ----------------------------------------- */

/* ==========================================================================
 * WBAMS Webmail - the rich text composer.
 * --------------------------------------------------------------------------
 * Parked here rather than written into webmail.css because that file is being
 * edited elsewhere. Nothing links this file yet: layout.php loads webmail.css
 * and nothing else, so these blocks either move across or the link is added.
 *
 * The editor takes the place of the composer's textarea and inherits its
 * measurements, so that swapping one for the other when script runs does not
 * move anything on the page.
 *
 * The toolbar is part of the editor and not a control sitting inside one: it
 * has no border, no fill and no corners of its own. What separates it from the
 * writing area is the same hairline that separates the address rows above it,
 * which is what keeps the whole card reading as one surface rather than as a
 * box with more boxes in it.
 * ========================================================================== */

/* ---------- The editor --------------------------------------------------- */

.wm-editor { display: flex; flex-direction: column; min-width: 0; }

/*
	A display rule of any kind overrules the hidden attribute, and the editor is
	hidden in the markup until script has taken over. Without this line the
	toolbar would sit there with script switched off, doing nothing.
*/
.wm-editor[hidden] { display: none; }

.wm-editor-tools {
	display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
	padding: 7px 14px;
	border-bottom: 1px solid var(--wm-line-soft);
}

/*
	A button with no edge of its own until it is being used. Eight of them in a
	row, each in its own outline, would be eight small frames inside a rounded
	card; the state a writer actually needs to see is which ones are on, and
	that is said with the accent tint alone.
*/
.wm-editor-tool {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 30px; height: 30px; padding: 0 7px;
	border: 0; border-radius: 9px; background: transparent;
	color: var(--wm-ink-2); font: inherit; font-size: 13.5px; line-height: 1;
	cursor: pointer;
	transition: background .14s ease, color .14s ease, transform .1s ease;
}
.wm-editor-tool:hover { background: var(--wm-surface-2); color: var(--wm-ink); }
.wm-editor-tool:active { transform: translateY(1px); }
.wm-editor-tool[aria-pressed="true"] { background: var(--wm-accent-tint); color: var(--wm-accent); }
.wm-editor-tool:focus-visible { outline: 2px solid var(--wm-accent); outline-offset: 1px; }

/*
	The toolbar draws from the same line art as the message bar, rather than setting letters as
	text: a B in the page's own font is a letter that happens to be bold, and at 13px next to a
	paperclip and a chain link it reads as a typo rather than a control.
*/
.wm-editor-tool .wm-icon { display: block; }

/* A hairline between groups, which is a separation rather than a frame. */
.wm-editor-sep { width: 1px; height: 17px; margin: 0 6px; background: var(--wm-line); }

.wm-editor-body {
	padding: 18px 20px; min-height: 300px; line-height: 1.6;
	overflow-wrap: anywhere; outline: 0;
}
.wm-editor-body:focus, .wm-editor-body:focus-visible { outline: 0; box-shadow: none; }

/*
	Drawn on a class rather than on :empty, because an editable region keeps a
	stray line break the moment anything has been typed into it and taken out
	again, and :empty would stop matching for good at that point.
*/
.wm-editor-body.is-empty::before {
	content: attr(data-placeholder); display: block;
	color: var(--wm-ink-3); pointer-events: none;
}

/*
	How the message reads while it is being written. It is close to what a mail
	client will do with the same markup, but it is not a preview and does not
	pretend to be: the reader's client decides the font and the measure.
*/
.wm-editor-body > :first-child { margin-top: 0; }
.wm-editor-body > :last-child { margin-bottom: 0; }
.wm-editor-body p { margin: 0 0 12px; }
.wm-editor-body ul, .wm-editor-body ol { margin: 0 0 12px; padding-left: 26px; }
.wm-editor-body li { margin: 2px 0; }
.wm-editor-body blockquote {
	margin: 0 0 12px 1px; padding-left: 13px;
	border-left: 2px solid var(--wm-line); color: var(--wm-ink-2);
}
.wm-editor-body blockquote blockquote { margin: 8px 0; }
.wm-editor-body blockquote > :first-child { margin-top: 0; }
.wm-editor-body blockquote > :last-child { margin-bottom: 0; }
.wm-editor-body a { color: var(--wm-accent); }

/* ---------- The link pane ------------------------------------------------ */

/*
	A child of <body>, positioned by script, for the same reason the recipient
	suggestions are: the composer card is overflow:hidden so it can clip its own
	rounded corners, and a pane positioned inside it would be cut off at the
	first edge it grew past.
*/
.wm-linkpop {
	position: fixed; z-index: 60; display: none;
	width: min(330px, calc(100vw - 24px));
	padding: 13px 14px 14px;
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-control);
	box-shadow: var(--wm-shadow-pop);
}
.wm-linkpop.is-open { display: block; }

/*
	The caret, which says which button the pane is answering. --wm-caret-x is
	set by the script to the middle of that button, so the point still lands on
	it when the pane has been nudged sideways to stay on screen.
*/
.wm-linkpop::before, .wm-linkpop::after {
	content: ""; position: absolute; left: var(--wm-caret-x, 22px);
	width: 0; height: 0; border: 7px solid transparent;
}
.wm-linkpop::before { top: -14px; border-bottom-color: var(--wm-line-card); }
.wm-linkpop::after { top: -12px; border-bottom-color: var(--wm-surface); }

/* Below the button instead, when there was no room above it. */
.wm-linkpop.is-above::before { top: auto; bottom: -14px; border-bottom-color: transparent; border-top-color: var(--wm-line-card); }
.wm-linkpop.is-above::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: var(--wm-surface); }

.wm-linkpop input { font-size: 13.5px; padding: 8px 12px; }
.wm-linkpop .wm-field-help { margin-top: 7px; }

/* Cancel first, then apply, and the one that takes something away on the right. */
.wm-linkpop-actions {
	display: flex; align-items: center; justify-content: flex-end;
	gap: 8px; flex-wrap: wrap; margin-top: 13px;
}

@media (max-width: 700px) {
	.wm-editor-tools { padding: 6px 10px; }
	.wm-editor-body { padding: 16px 16px; }
}

@media (max-width: 560px) {
	.wm-editor-sep { margin: 0 3px; }
	.wm-linkpop { width: calc(100vw - 20px); }
}

/* ---------- 17. Message actions --------------------------------------- */

/* ==========================================================================
 * WBAMS Webmail - the reading pane's action bar.
 * --------------------------------------------------------------------------
 * Parked here rather than written into webmail.css because that file is being
 * edited elsewhere. Nothing links this file yet: layout.php loads webmail.css
 * and nothing else, so these blocks either move across or the link is added.
 *
 * The bar is one row at every width and never two. Three things keep it that
 * way: the labels drop out when the pane is narrow and leave the icons, the
 * secondary actions live in a menu instead of on the bar, and nothing in the
 * row is allowed to wrap.
 * ========================================================================== */

/* ---------- The row ------------------------------------------------------ */

/*
	nowrap is the whole point of this block. The base sheet lets the actions
	wrap, which is what produces the ragged second row this replaces; here the
	row either fits or the labels come off, and it always fits after that.
*/
.wm-message-actions {
	flex-wrap: nowrap;
	gap: 2px;
	min-width: 0;
}

/*
	One button shape for the bar. It is the quiet pill from the base sheet with
	the padding tightened, because six of them sit side by side in a column that
	can be 300px wide, and it carries an icon that inherits the text color.
*/
.wm-action {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	flex: 0 0 auto;
	border: 1px solid transparent; border-radius: var(--wm-radius-pill);
	padding: 8px 13px; font: inherit; font-weight: 550; font-size: 13.5px;
	line-height: 1.25; white-space: nowrap; cursor: pointer;
	background: transparent; color: var(--wm-ink-2); text-decoration: none;
	transition: background .14s ease, color .14s ease, transform .1s ease;
}
.wm-action:hover { background: var(--wm-surface-2); color: var(--wm-ink); text-decoration: none; }
.wm-action:active { transform: translateY(1px); }

.wm-action-icon, .wm-icon { flex: 0 0 auto; display: block; }

.wm-action-danger { color: var(--wm-bad); }
.wm-action-danger:hover { background: var(--wm-bad-tint); color: var(--wm-bad); }

/* A form is a layout accident here; it must not take part in the spacing. */
.wm-action-form { display: contents; }

/*
	Delete last and hard right, with a gap that says it is not one of the group
	to its left. Every destructive action in this application sits on the right
	and this is the reading pane's.
*/
.wm-action-delete { margin-left: 8px; }

/*
	The labels go when the pane is narrow, and "narrow" is two ranges rather
	than one: below 900px the pane is the whole phone, and between 900 and
	1240px the sidebar and the message list have already taken 592px of the
	window, which leaves the pane narrower than the phone did. Between those two
	ranges - and above 1240px - there is room for words.
*/
@media (max-width: 620px), (min-width: 901px) and (max-width: 1240px) {
	.wm-action-text { display: none; }
	.wm-action { padding: 8px 10px; }
}

/* ---------- The More menu ------------------------------------------------ */

.wm-more { position: relative; flex: 0 0 auto; }

/* The disclosure triangle is replaced by the icon inside the summary. */
.wm-more-summary { list-style: none; }
.wm-more-summary::-webkit-details-marker { display: none; }
.wm-more[open] > .wm-more-summary { background: var(--wm-surface-2); color: var(--wm-ink); }

/*
	The pane hangs from the right hand end of the summary because the summary is
	near the right hand end of the pane; opening leftwards is what keeps it on
	screen. It is a popover, not a card - so it has the popover shadow and no
	second border inside it.
*/
.wm-more-pane {
	position: absolute; z-index: 60; top: calc(100% + 10px); right: 0;
	min-width: 236px; padding: 6px;
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-control);
	box-shadow: var(--wm-shadow-pop);
	text-align: left;
}

/*
	The caret. A pane that simply appears near a control belongs to nothing in
	particular; the caret says which control it is answering. It sits under the
	middle of the summary, which is 21px in from the right once the label has
	gone and further in when it has not - so it is measured from the right and
	the icon-only case is the one it is aligned to.
*/
.wm-more-pane::before, .wm-more-pane::after {
	content: ""; position: absolute; right: var(--wm-caret-x, 15px);
	width: 0; height: 0; border: 7px solid transparent;
}
.wm-more-pane::before { top: -14px; border-bottom-color: var(--wm-line-card); }
.wm-more-pane::after { top: -12px; border-bottom-color: var(--wm-surface); }

.wm-more-form { display: block; }

/*
	A menu row is a button that fills the pane. It is not a pill: a pill inside
	a popover reads as a control inside a control, and the row is the control
	here.
*/
.wm-more-item {
	display: flex; align-items: center; gap: 10px; width: 100%;
	padding: 8px 11px; border: 0; border-radius: 9px;
	font: inherit; font-size: 13.5px; font-weight: 540; text-align: left;
	background: transparent; color: var(--wm-ink); cursor: pointer;
}
.wm-more-item:hover { background: var(--wm-surface-2); }
.wm-more-item .wm-icon { color: var(--wm-ink-3); }
.wm-more-item:hover .wm-icon { color: var(--wm-ink-2); }

/* ---------- Move to ------------------------------------------------------ */

/* The one place in the pane that is not a row, so it is fenced off by a line. */
.wm-more-move { margin-top: 6px; padding: 10px 11px 4px; border-top: 1px solid var(--wm-line-soft); }

.wm-more-move-label {
	display: block; margin-bottom: 6px;
	font-size: 12.5px; font-weight: 560; color: var(--wm-ink-2);
}

.wm-more-move-row { display: flex; align-items: center; gap: 8px; }

/* The select takes the room; the button takes what it needs. */
.wm-move-select { flex: 1 1 auto; min-width: 0; font-size: 13.5px; padding: 7px 30px 7px 11px; }
.wm-move-go { flex: 0 0 auto; padding: 7px 15px; }

/* Help under the input, where the answer to "and then what" belongs. */
.wm-more-help {
	margin: 7px 0 4px; font-size: 12px; line-height: 1.45; color: var(--wm-ink-3);
}

/* ---------- Printing ----------------------------------------------------- */

/*
	Print the message and nothing else. The shell - folders, list, action bar,
	search - is navigation, and navigation on paper is a wasted page. The frame
	has already been sized to its content by the base script, so the body prints
	in full rather than being cut off at the frame's height.
*/
@media print {
	/* The ribbon is chrome too. It arrived after this block was written, so a printed
	   message carried a row of buttons nobody can press across the top of the page. */
	.wm-top, .wm-sidebar, .wm-list-column, .wm-message-bar, .wm-ribbon,
	.wm-modal, .wm-skip { display: none !important; }

	.wm-pane, .wm-pane-wide { padding: 0 !important; overflow: visible !important; }

	/* The shell is a full height grid on screen; on paper it is one column that runs as long as
	   the message does. */
	body.wm { display: block !important; height: auto !important; overflow: visible !important; }
	.wm-shell { display: block !important; height: auto !important; overflow: visible !important; }

	/*
		Not height: auto. An iframe does not grow to fit what is inside it - auto is the
		default 150px box with the message scrolling inside - so this rule, meant to let
		the body run as long as it needed, was the thing that cut it down to a scrollable
		window on paper. The frame carries a fitted height in a style attribute, measured
		from the content and re-measured before printing; leaving that alone is what lets
		a long thread paginate instead of ending at the first page with a scrollbar.
	*/
	.wm-body-frame { min-height: 0; }
	.wm-message-head { border-bottom: 1px solid #ccc; }
	.wm-attachment { box-shadow: none; }
}

/* ---------- 18. Advanced search --------------------------------------- */

/* ==========================================================================
 * WBAMS Webmail - the Search page.
 * --------------------------------------------------------------------------
 * These belong in webmail.css, next to the settings controls and the rule list
 * they are built out of, but that file is being edited elsewhere, so they are
 * parked here to be folded in. Nothing links this file yet: layout.php loads
 * webmail.css and nothing else, so either move these blocks across or add the
 * link.
 *
 * The markup is written to survive that not happening. Without these rules the
 * boxes stack one per line instead of pairing, the composed line is an ordinary
 * text input rather than a monospaced one, and a saved search is a name, a line
 * and two buttons in source order - which is the order they are wanted in
 * anyway. Nothing becomes unusable and nothing becomes untrue.
 *
 * Nothing here re-states a card, a button, a field or the muted note text: they
 * are the shared ones. Rows are separated by a hairline rather than boxed, for
 * the same reason the rule list and the folder list are - they already sit
 * inside a rounded card, and a border around each row would put a square frame
 * inside a round one.
 * ========================================================================== */

/* ---------- The form ----------------------------------------------------- */

/*
 * Two related boxes on one line where there is room for two, one per line
 * where there is not. From and To, Cc and Bcc, the two dates and the two sizes
 * are each a pair of the same question, and reading them side by side is what
 * makes the pairing obvious without a heading saying so.
 */
.wm-search-pair { display: flex; gap: 16px; flex-wrap: wrap; }
.wm-search-pair > .wm-field { flex: 1 1 220px; min-width: 0; }

/*
 * A date and a size are short values, so their boxes are short: a full width
 * field for "2 MB" reads as a box someone forgot to finish filling in. The
 * pair stops growing to match, which is what keeps the two of them together on
 * the left rather than stretched across the card.
 */
.wm-search-pair-tight > .wm-field { flex: 0 1 auto; }

.wm-input-date { width: 11em; }
.wm-input-size { width: 8em; }

/* ---------- The line the boxes build ------------------------------------- */

/*
 * Monospaced, because this is the one piece of text on the page that is meant
 * to be read character by character and typed back in somewhere else. It is
 * read only rather than disabled: a disabled input is skipped by the keyboard
 * and cannot be selected, and selecting it is the whole point.
 */
.wm-search-compiled {
	font-family: var(--wm-mono);
	font-size: 13px;
	background: var(--wm-surface-2);
	color: var(--wm-ink);
}

/* The one note that is a warning rather than an aside: the reading is behind. */
.wm-search-stale { color: var(--wm-warn); }

/*
 * A heading inside a card that already has one. It is a third level rather than
 * a second so the card keeps a single title, and it is quiet enough that the
 * lines under it are what the eye lands on.
 */
.wm-search-subhead {
	margin: 18px 0 8px; font-size: 13px; font-weight: 600;
	color: var(--wm-ink-2); letter-spacing: .005em;
}

/*
 * The reading of the query, one clause per line. Every line has to be true at
 * once, so they are a list rather than a sentence with "and" in it - a sentence
 * of six clauses is a sentence nobody finishes.
 */
.wm-search-reading {
	list-style: none; margin: 0; padding: 0;
	font-size: 13.5px; color: var(--wm-ink);
}
.wm-search-reading li {
	padding: 5px 0 5px 18px; position: relative;
	border-bottom: 1px solid var(--wm-line-soft);
	overflow-wrap: anywhere;
}
.wm-search-reading li:last-child { border-bottom: 0; }
.wm-search-reading li::before {
	content: ""; position: absolute; left: 4px; top: 12px;
	width: 5px; height: 5px; border-radius: 50%; background: var(--wm-accent);
}

.wm-search-reading-empty { font-size: 13.5px; color: var(--wm-ink-2); margin: 0; }

/*
 * What could not be read. These carry the reader's own words back to them, so
 * they wrap anywhere rather than pushing the card wider than the column.
 */
.wm-search-warnings {
	list-style: none; margin: 0; padding: 0;
	font-size: 13.5px; color: var(--wm-ink);
}
.wm-search-warnings li {
	padding: 5px 0 5px 12px;
	border-left: 2px solid var(--wm-warn);
	margin-bottom: 6px;
	overflow-wrap: anywhere;
}

.wm-search-extra {
	font-family: var(--wm-mono); font-size: 12.5px;
	color: var(--wm-ink); overflow-wrap: anywhere;
}

/* ---------- Saved searches ----------------------------------------------- */

.wm-saved-list { list-style: none; margin: 0; padding: 0; }

.wm-saved {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	padding: 10px 0; border-bottom: 1px solid var(--wm-line-soft);
}
.wm-saved:last-child { border-bottom: 0; }

.wm-saved-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; min-width: 0; }

/*
 * The name is the link that runs the search, because running it is what a
 * saved search is for and the name is the largest thing on the row.
 */
.wm-saved-name { font-size: 14px; font-weight: 560; color: var(--wm-ink); overflow-wrap: anywhere; }
.wm-saved-name:hover { color: var(--wm-accent); }

/*
 * The line itself, in the same face as the box that builds it, so a saved
 * search teaches the syntax every time it is looked at.
 */
.wm-saved-query {
	font-family: var(--wm-mono); font-size: 12px; color: var(--wm-ink-2);
	overflow-wrap: anywhere;
}

/*
 * Actions on the trailing edge, delete last in the markup as well as in the
 * layout: the destructive one should be the furthest for the hand to travel,
 * and it must not move when the button beside it changes.
 */
.wm-saved-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }

@media (max-width: 560px) {
	.wm-saved-tools { margin-left: 0; }
}

/* ---------- 13. Screen recording ----------------------------------------
   The recorder's dialog. It is wider than the other modals because it holds a preview of what is
   being shared, and a preview small enough to fit a 420px card tells you nothing about what your
   colleagues are about to see. */

.wm-record-card { width: min(680px, 100%); padding: 20px 22px 18px; }

.wm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wm-modal-head h2 { margin: 0; }

.wm-record-stage {
	margin: 14px 0 12px; aspect-ratio: 16 / 9; overflow: hidden;
	border-radius: var(--wm-radius-control);
	background: var(--wm-surface-2);
	display: grid; place-items: center;
}
.wm-record-stage video { width: 100%; height: 100%; object-fit: contain; background: #14131a; }

.wm-record-status { margin: 0; color: var(--wm-ink-2); font-size: 13px; }

/* ---------- 14. Composer actions ----------------------------------------
   Send, Save draft and Discard, in that order, with Discard held to the right where every
   destructive action in this application sits. Send carries the accent and an icon so the eye
   lands on it first; Save draft is quiet because saving is what the composer already does by
   itself, and the line beside it says when it last did. */

.wm-compose-actions { gap: 8px; }
.wm-compose-actions .wm-button { display: inline-flex; align-items: center; gap: 7px; }
.wm-compose-actions .wm-send { padding-right: 20px; padding-left: 18px; font-weight: 640; }
.wm-compose-actions .wm-discard { margin-left: 6px; }
.wm-compose-actions .wm-button .wm-icon { flex: 0 0 auto; }

/* The draft line sits before the buttons and pushes them right, so it never moves them about as
   its text changes from "Saving…" to "Draft saved at 17:12". */
.wm-compose-actions .wm-draft-status { margin-right: auto; margin-left: 0; }

@media (max-width: 700px) {
	/* Three buttons and a status line do not fit on one row at this width; the status goes above. */
	.wm-compose-actions { width: 100%; }
	.wm-compose-actions .wm-draft-status { flex: 1 0 100%; margin: 0 0 4px; }
	.wm-compose-actions .wm-discard { margin-left: auto; }
}

/* A ribbon control that is holding a setting says so with the accent, the way a pressed tool does. */
.wm-ribbon-item.is-set,
.wm-ribbon-item .is-set { color: var(--wm-accent); font-weight: 620; }
.wm-ribbon-item.is-set .wm-icon { color: currentColor; }

/* The emoji pane is a grid, not a list: twenty rows of one emoji each is a scroll, not a choice. */
.wm-emoji-pane { display: grid; grid-template-columns: repeat(5, 36px); gap: 2px; min-width: 0; padding: 8px; }
.wm-emoji {
	width: 36px; height: 34px; padding: 0; border: 0; border-radius: 8px;
	background: transparent; cursor: pointer; font-size: 17px; line-height: 1;
}
.wm-emoji:hover { background: var(--wm-surface-2); }

/* A table written into a message reads as a table in the composer too. */
.wm-editor-body table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.wm-editor-body th, .wm-editor-body td {
	border: 1px solid var(--wm-line); padding: 6px 9px; text-align: left; font-size: 13.5px;
}
.wm-editor-body th { background: var(--wm-surface-2); font-weight: 640; }

/* ---------- 15. Confirming a destructive action -------------------------
   The application's own dialog in place of window.confirm(), which cannot be themed, cannot name
   the action on its button, and puts the confirming button where the eye is trained to find
   Cancel. Title, then the question in plain words, then Cancel and the named action - the action
   on the right, where every destructive control here sits. */

.wm-confirm-card { width: min(460px, 100%); }
.wm-confirm-title { margin: 0 0 10px; font-size: 17px; font-weight: 700; color: var(--wm-ink); }
.wm-confirm-text { margin: 0; color: var(--wm-ink-2); font-size: 14px; line-height: 1.5; }
.wm-confirm .wm-modal-actions { margin-top: 22px; }
.wm-confirm .wm-button { min-width: 92px; justify-content: center; }

/* ---------- 16. Row actions ---------------------------------------------
   What the row can do to itself, shown when the pointer is over it. They are drawn over the right
   hand end of the row rather than in a column of their own: a column reserved for them would be
   empty on every row that is not being pointed at, and would push the date in from the edge for
   the whole list. Focus counts as pointing - a keyboard reaching one of these has to see it. */

/*
	On the sender's line, at the right hand end - the line the marks were on, which is why they are
	the only thing that has to step aside. No pill and no shadow: the row is the surface, and a
	panel floating on top of it to hold three icons was a control inside a control.
*/
/*
	Hidden with opacity rather than display, because display:none takes an element out of the tab
	order altogether - a keyboard could never reach these to focus them, so the focus-within rule
	that reveals them could never fire. Invisible and untouchable until the row is pointed at or
	tabbed into; the pointer passes straight through to the message underneath.
*/
.wm-row-actions {
	position: absolute; top: 7px; right: 10px;
	display: flex; align-items: center; gap: 2px;
	opacity: 0; pointer-events: none;
	transition: opacity .12s ease;
}
.wm-row:hover .wm-row-actions,
.wm-row:focus-within .wm-row-actions { opacity: 1; pointer-events: auto; }

/*
	The marks share that line, so they go while the actions are up - keeping their space rather
	than losing it, so nothing in the row moves as the pointer crosses. The width is held open
	underneath as well, or a long sender name would run on under the icons instead of ellipsising
	short of them. The time is a line below and is left alone.
*/
.wm-row:hover .wm-row-marks,
.wm-row:focus-within .wm-row-marks { visibility: hidden; min-width: 78px; }

.wm-row-action {
	display: inline-grid; place-items: center; width: 24px; height: 24px;
	padding: 0; border: 0; border-radius: var(--wm-radius-pill); background: transparent;
	color: var(--wm-ink-2); cursor: pointer;
}
.wm-row-action:hover { background: var(--wm-surface-2); color: var(--wm-ink); }
.wm-row-action.is-on { color: var(--wm-bad); }
.wm-row-action.is-danger:hover { color: var(--wm-bad); background: var(--wm-bad-tint); }
.wm-row-action:focus-visible { outline: 2px solid var(--wm-accent); outline-offset: -2px; }

/*
	A touch screen has no hover. Rather than parking three buttons on every row - which is the
	tap target for opening the message, three times over - the row keeps its date and its marks,
	and the actions stay where the ribbon and the row's tick box already put them.
*/
@media (hover: none) {
	.wm-row-actions { display: none; }
	.wm-row:hover .wm-row-marks { visibility: visible; min-width: 0; }
}

/* ---------- 19. New mail alerts ---------------------------------------
   The card that says who a new message is from, inside the page; the one-time offer to turn on
   desktop pop-ups above the inbox; and the Settings panel that says what this browser allows.
   The desktop pop-up itself is drawn by the system, not here. */

.wm-toasts {
	position: fixed; right: 22px; bottom: 22px; z-index: 65;
	display: flex; flex-direction: column; align-items: stretch; gap: 10px;
	width: min(372px, calc(100vw - 32px));
	pointer-events: none;
}

.wm-toast {
	position: relative; overflow: hidden; pointer-events: auto;
	background: var(--wm-surface);
	border: 1px solid var(--wm-line-card);
	border-radius: var(--wm-radius-card);
	box-shadow: var(--wm-shadow-pop), 0 0 0 1px rgba(var(--wm-accent-rgb), .06);
	animation: wm-toast-in .34s cubic-bezier(.2, .9, .3, 1.15) both;
}
.wm-toast.is-leaving { animation: wm-toast-out .22s ease-in both; }

/* The accent edge says "new" before any word is read. */
.wm-toast::before {
	content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
	background: linear-gradient(180deg, var(--wm-accent), var(--wm-accent-hover));
}

.wm-toast-open {
	display: flex; align-items: flex-start; gap: 12px;
	padding: 14px 44px 16px 18px;
	color: inherit; text-decoration: none;
	transition: background .14s ease;
}
.wm-toast-open:hover { background: var(--wm-surface-2); text-decoration: none; }
.wm-toast-open:focus-visible { outline: 2px solid var(--wm-accent); outline-offset: -2px; border-radius: var(--wm-radius-card); }

.wm-toast-face {
	flex: 0 0 auto; display: grid; place-items: center;
	width: 40px; height: 40px; border-radius: var(--wm-radius-pill);
	font-weight: 660; font-size: 15px;
	background: hsl(var(--wm-hue, 210) 62% 91%);
	color: hsl(var(--wm-hue, 210) 58% 30%);
}
@media (prefers-color-scheme: dark) {
	.wm-toast-face {
		background: hsl(var(--wm-hue, 210) 32% 28%);
		color: hsl(var(--wm-hue, 210) 70% 84%);
	}
}
.wm-toast-face.is-mark {
	background: linear-gradient(140deg, var(--wm-accent), var(--wm-accent-hover));
	color: var(--wm-on-accent);
	box-shadow: 0 4px 12px rgba(var(--wm-accent-rgb), .35);
}

.wm-toast-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.wm-toast-label {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 11.5px; font-weight: 640; letter-spacing: .02em; color: var(--wm-accent);
}
.wm-toast-label::before {
	content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
	box-shadow: 0 0 0 3px rgba(var(--wm-accent-rgb), .18);
}
.wm-toast-from, .wm-toast-subject {
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wm-toast-from { font-size: 14.5px; font-weight: 650; color: var(--wm-ink); }
/* The count card names up to three senders: they wrap rather than lose the last name. */
.wm-toast.is-many .wm-toast-subject {
	white-space: normal;
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.wm-toast-subject { font-size: 13.5px; color: var(--wm-ink); }
.wm-toast-preview {
	font-size: 12.5px; color: var(--wm-ink-2); margin-top: 1px;
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}

.wm-toast-close {
	position: absolute; top: 9px; right: 9px;
	display: grid; place-items: center; width: 28px; height: 28px;
	padding: 0; border: 0; border-radius: var(--wm-radius-pill);
	background: transparent; color: var(--wm-ink-3); cursor: pointer;
}
.wm-toast-close:hover { background: var(--wm-surface-3); color: var(--wm-ink); }
.wm-toast-close:focus-visible { outline: 2px solid var(--wm-accent); outline-offset: 0; }

/* Runs out over the card's time; held while the card is pointed at or focused. */
.wm-toast-clock {
	position: absolute; left: 4px; right: 0; bottom: 0; height: 3px;
	background: rgba(var(--wm-accent-rgb), .55);
	transform-origin: left center;
	animation: wm-toast-clock 9s linear forwards;
}
.wm-toast:hover .wm-toast-clock,
.wm-toast:focus-within .wm-toast-clock { animation-play-state: paused; }

@keyframes wm-toast-in {
	from { opacity: 0; transform: translateY(16px) scale(.97); }
	to { opacity: 1; transform: none; }
}
@keyframes wm-toast-out {
	to { opacity: 0; transform: translateX(28px); }
}
@keyframes wm-toast-clock {
	from { transform: scaleX(1); }
	to { transform: scaleX(0); }
}

/* On a phone the cards drop in under the header, newest first, the way the phone's own do. */
@media (max-width: 560px) {
	.wm-toasts {
		top: calc(var(--wm-top-h) + 8px); bottom: auto; left: 12px; right: 12px; width: auto;
		flex-direction: column-reverse;
	}
	.wm-toast { animation-name: wm-toast-drop; }
	.wm-toast.is-leaving { animation-name: wm-toast-lift; }
	.wm-toast-open { padding: 12px 42px 14px 16px; }
	.wm-toast-face { width: 36px; height: 36px; font-size: 14px; }
}
@keyframes wm-toast-drop {
	from { opacity: 0; transform: translateY(-14px); }
	to { opacity: 1; transform: none; }
}
@keyframes wm-toast-lift {
	to { opacity: 0; transform: translateY(-14px); }
}

/* The one-time offer, above the inbox's heading. */
.wm-alerts-ask {
	display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
	margin: 12px 14px 4px; padding: 12px 14px;
	border-radius: var(--wm-radius-control);
	background:
		linear-gradient(120deg, rgba(var(--wm-accent-rgb), .12), rgba(var(--wm-accent-rgb), .04) 70%),
		var(--wm-surface);
	border: 1px solid rgba(var(--wm-accent-rgb), .22);
	animation: wm-toast-drop .3s ease both;
}
.wm-alerts-ask.is-leaving { animation: wm-toast-lift .22s ease-in both; }
.wm-alerts-ask-bell {
	flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px;
	border-radius: var(--wm-radius-pill);
	background: linear-gradient(140deg, var(--wm-accent), var(--wm-accent-hover));
	color: var(--wm-on-accent);
	box-shadow: 0 4px 12px rgba(var(--wm-accent-rgb), .3);
}
.wm-alerts-ask-text { flex: 1 1 180px; font-size: 13.5px; color: var(--wm-ink); }
.wm-alerts-ask-actions { display: flex; gap: 6px; margin-left: auto; }
.wm-alerts-ask-actions .wm-button { padding: 7px 14px; font-size: 13px; }
.wm-alerts-ask.is-done { background: var(--wm-ok-tint); border-color: transparent; }
.wm-alerts-ask.is-done .wm-alerts-ask-bell { background: var(--wm-ok); color: var(--wm-surface); box-shadow: none; }
.wm-alerts-ask.is-done .wm-alerts-ask-text { color: var(--wm-ok); font-weight: 560; }

/* Settings: what this browser allows. */
.wm-alerts-browser {
	display: flex; align-items: flex-start; gap: 14px;
	margin: 4px 0 20px; padding: 16px 18px;
	border-radius: var(--wm-radius-control);
	background: var(--wm-surface-2);
	border: 1px solid var(--wm-line);
	transition: opacity .15s ease;
}
.wm-alerts-browser.is-muted { opacity: .55; }
.wm-alerts-bell {
	flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px;
	border-radius: var(--wm-radius-pill);
	background: var(--wm-accent-tint); color: var(--wm-accent);
}
.wm-alerts-browser[data-state="granted"] .wm-alerts-bell { background: var(--wm-ok-tint); color: var(--wm-ok); }
.wm-alerts-browser[data-state="denied"] .wm-alerts-bell { background: var(--wm-warn-tint); color: var(--wm-warn); }
.wm-alerts-bell.is-ringing .wm-icon { animation: wm-bell-ring .9s ease; transform-origin: 50% 12%; }
.wm-alerts-state { min-width: 0; flex: 1 1 auto; }
.wm-alerts-heading { font-size: 13.5px; font-weight: 620; color: var(--wm-ink); margin-bottom: 2px; }
.wm-alerts-state p:not(.wm-alerts-heading) { font-size: 13.5px; color: var(--wm-ink-2); }
.wm-alerts-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@keyframes wm-bell-ring {
	0%, 100% { transform: rotate(0); }
	15% { transform: rotate(16deg); }
	30% { transform: rotate(-14deg); }
	45% { transform: rotate(10deg); }
	60% { transform: rotate(-6deg); }
	75% { transform: rotate(3deg); }
}

@media (max-width: 560px) {
	.wm-alerts-browser { padding: 14px; gap: 12px; }
	.wm-alerts-ask { margin: 10px 10px 4px; }
	.wm-alerts-ask-actions { margin-left: 46px; }
}

@media print {
	.wm-toasts, .wm-alerts-ask { display: none !important; }
}

/*
	The next page on its way (webmail.js). Every click here asks the mail server for a whole new
	page, and on a slow one - Microsoft 365 above all - a second or more went by with nothing on
	screen to say the click was taken. A bar across the top from the moment of the click, and the
	message clicked marked as opening, until the page arrives.
*/
.wm-loading {
	position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
	height: 3px; pointer-events: none;
	transform: scaleX(0); transform-origin: 0 50%; opacity: 0;
	background: linear-gradient(90deg, rgba(var(--wm-accent-rgb), .45), var(--wm-accent));
	box-shadow: 0 0 10px rgba(var(--wm-accent-rgb), .55);
	transition: opacity .2s ease;
}
.wm-loading.is-on { opacity: 1; animation: wm-loading 14s cubic-bezier(.05, .75, .25, 1) forwards; }
@keyframes wm-loading {
	0% { transform: scaleX(0); }
	6% { transform: scaleX(.3); }
	30% { transform: scaleX(.66); }
	100% { transform: scaleX(.94); }
}
body[aria-busy="true"] .wm-row-link { cursor: progress; }
.wm-row.is-opening { background: var(--wm-accent-tint); }
.wm-row.is-opening::after {
	content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
	background: var(--wm-accent);
	animation: wm-opening .8s ease-in-out infinite alternate;
}
@keyframes wm-opening {
	from { opacity: .3; }
	to { opacity: 1; }
}
@media print {
	.wm-loading { display: none !important; }
}

/*
	On a phone the Home ribbon shows its tools as icons alone, in one row: with their words they
	wrapped onto a second line that pushed the list down. New mail keeps its words - it is the one
	thing on the row that is not about the messages ticked below. The words stay for screen
	readers (clipped, not removed) and as the tooltip. The tools share what is left of the row, so
	it fits a 320px screen as well as a large phone.
*/
@media (max-width: 560px) {
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] { flex-wrap: nowrap; gap: 0; }
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] .wm-ribbon-item:not(.is-primary) {
		flex: 1 1 38px; min-width: 26px; max-width: 46px; height: 38px; padding: 0; justify-content: center;
	}
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] .wm-ribbon-item:not(.is-primary) .wm-icon { width: 18px; height: 18px; }
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] .wm-ribbon-item:not(.is-primary) > span {
		position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
		overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
	}
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] .wm-ribbon-item.is-primary { flex: 0 0 auto; margin-right: auto; }
	.wm-ribbon-panel[data-wm-ribbon-panel="home"] .wm-ribbon-sep { margin: 0 2px; }
}
