/*
 * MUNISH resolution panel.
 *
 * Built on the theme's palette (theme.json --wp--preset--color--*) and fonts,
 * with fallbacks so it still reads if the theme changes. Everything is scoped
 * to .mr-panel. Lists are full-width rows with thin rules, like the
 * Committees page; boxes only where boxing earns it (the document "paper",
 * the next-step box, form cards).
 *
 * Status colours (text on tint, all WCAG AA or better):
 *   draft      #4A5559 on #E4EAED  6.1:1
 *   submitted  #005474 on #EAF6FB  7.7:1
 *   review     #8A4B00 on #FFF4E2  6.3:1  (theme's caution pair)
 *   approved   #1D6B3A on #E5F4EA  5.8:1
 *   rejected   #A3262A on #FBE9E9  6.3:1
 *   published  #FFFFFF on #005474  8.6:1  (solid: Adopted, it's final)
 *   live       #FFFFFF on #A3262A  6.9:1  (solid: Debating now, on air)
 *
 * A published resolution's stage: On the agenda = approved, Debating now =
 * live, Adopted = published, Not adopted = draft grey (an outcome, not an error).
 */

.mr-panel {
	--mr-ink: #1f2b30;
	--mr-body: var(--wp--preset--color--body, #444);
	--mr-muted: #5e6b71;
	--mr-line: #d5dee2;
	--mr-line-strong: rgba(0, 102, 153, 0.35);
	--mr-paper: var(--wp--preset--color--white, #fff);
	--mr-blue: var(--wp--preset--color--primary, #006699);
	--mr-blue-dark: var(--wp--preset--color--primary-dark, #003d55);
	--mr-focus: var(--wp--preset--color--un-blue-dark, #007eaf);
	--mr-cool: var(--wp--preset--color--surface-cool, #eaf6fb);
	--mr-surface: var(--wp--preset--color--surface, #e4eaed);

	--mr-draft: #4a5559;
	--mr-draft-bg: #e4eaed;
	--mr-submitted: #005474;
	--mr-submitted-bg: #eaf6fb;
	--mr-review: var(--wp--preset--color--caution, #8a4b00);
	--mr-review-bg: var(--wp--preset--color--caution-tint, #fff4e2);
	--mr-approved: #1d6b3a;
	--mr-approved-bg: #e5f4ea;
	--mr-rejected: #a3262a;
	--mr-rejected-bg: #fbe9e9;
	--mr-published: var(--wp--preset--color--un-blue-deep, #005474);

	--mr-radius: 4px;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--mr-body);
}

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

.mr-panel :where(p, ul, ol, dl, dd, blockquote, fieldset, figure) {
	margin: 0;
}

.mr-panel :where(ul, ol) {
	list-style: none;
	padding: 0;
}

.mr-panel a {
	color: var(--mr-blue);
}

.mr-panel a:hover {
	color: var(--mr-blue-dark);
}

.mr-panel :focus-visible {
	outline: 2px solid var(--mr-focus);
	outline-offset: 2px;
}

.mr-panel code {
	font-size: 0.85em;
	background: var(--mr-surface);
	padding: 0.05em 0.35em;
	border-radius: 2px;
}

/* Small uppercase label, same voice as the site's h5/h6 */
.mr-eyebrow,
.mr-label,
.mr-side-block__title,
.mr-card__title,
.mr-doc__header dt {
	font-family: var(--wp--preset--font-family--open-sans, sans-serif);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--steel, #426b7b);
}

.mr-eyebrow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.9rem;
	margin-bottom: 0.4rem;
}

.mr-eyebrow a {
	text-decoration: none;
}

.mr-hint {
	font-size: 0.85rem;
	color: var(--mr-muted);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.mr-none {
	padding: 1.5rem 0;
	color: var(--mr-muted);
}

/* ---------------------------------------------------------------------------
 * Tab bar
 * ------------------------------------------------------------------------- */

.mr-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	border-bottom: 1px solid var(--mr-line);
	margin-bottom: 2rem;
}

.mr-tabs {
	/* Positioned, so the absolutely placed screen-reader text in a tab ("unread")
	   is clipped by this scroller instead of widening the whole page on a phone */
	position: relative;
	display: flex;
	gap: 0.25rem;
	overflow-x: auto;
	scrollbar-width: none;
	margin-bottom: -1px; /* the active tab's rule sits on the bar's rule */
}

.mr-tab {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.8rem 0.9rem;
	border-bottom: 3px solid transparent;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
	text-decoration: none;
	color: var(--mr-muted) !important;
}

.mr-tab:hover {
	color: var(--mr-ink) !important;
	border-bottom-color: var(--mr-line);
}

.mr-tab[aria-current="page"] {
	color: var(--mr-blue) !important;
	border-bottom-color: var(--mr-blue);
}

.mr-count {
	min-width: 1.35rem;
	padding: 0 0.4rem;
	border-radius: 2px;
	background: var(--mr-rejected);
	color: #fff;
	font-size: 0.72rem;
	line-height: 1.35rem;
	text-align: center;
	letter-spacing: 0;
}

.mr-bar__side {
	margin-left: auto; /* stays right when there are no tabs (public view) */
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	padding-bottom: 0.6rem;
}

.mr-bar__user {
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-bar__user a {
	margin-left: 0.5rem;
}

/* The sign-in button spaces itself from the label with the label's margin,
 * so it sits flush left when the two wrap onto separate lines on a phone. */
.mr-bar__hint {
	margin-right: 0.75rem;
}

.mr-bar__user .mr-btn {
	margin-left: 0;
}

.mr-role {
	display: inline-block;
	margin-left: 0.4rem;
	padding: 0 0.45rem;
	border: 1px solid var(--mr-line);
	border-radius: 2px;
	font-size: 0.72rem;
	font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * Buttons: theme's button voice (uppercase, tracked), sized for a tool
 * ------------------------------------------------------------------------- */

.mr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.75rem; /* 44px touch target */
	padding: 0.55rem 1.2rem;
	border: 1px solid var(--mr-line-strong);
	border-radius: 2px;
	background: var(--mr-paper);
	color: var(--mr-blue) !important;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color var(--wp--custom--transition, 0.2s ease), border-color var(--wp--custom--transition, 0.2s ease);
}

.mr-btn:hover {
	border-color: var(--mr-blue);
	background: var(--mr-cool);
}

.mr-btn--primary {
	background: var(--mr-blue);
	border-color: var(--mr-blue);
	color: #fff !important;
}

.mr-btn--primary:hover {
	background: var(--mr-blue-dark);
	border-color: var(--mr-blue-dark);
}

.mr-btn--approve {
	background: var(--mr-approved);
	border-color: var(--mr-approved);
	color: #fff !important;
}

.mr-btn--approve:hover {
	background: #14512b;
	border-color: #14512b;
}

.mr-btn--reject {
	border-color: var(--mr-rejected);
	color: var(--mr-rejected) !important;
}

.mr-btn--reject:hover {
	background: var(--mr-rejected-bg);
	border-color: var(--mr-rejected);
}

.mr-btn--quiet {
	border-color: transparent;
	background: transparent;
}

.mr-btn--link {
	min-height: 0;
	padding: 0;
	border: 0;
	background: none;
	font-size: 0.85rem;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: underline;
}

.mr-btn--link:hover {
	background: none;
}

.mr-btn--small {
	min-height: 2.25rem;
	padding: 0.35rem 0.8rem;
	font-size: 0.72rem;
}

.mr-btn--large {
	min-height: 3.25rem;
	padding: 0.7rem 2rem;
	font-size: 0.9rem;
}

.mr-inline-form {
	display: inline;
}

.mr-button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * Status badges and chips
 * ------------------------------------------------------------------------- */

/* The word carries the status; colour only repeats it */
.mr-badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 2px;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.4;
	white-space: nowrap;
	color: var(--mr-draft);
	background: var(--mr-draft-bg);
}

.mr-badge--submitted { color: var(--mr-submitted); background: var(--mr-submitted-bg); }
.mr-badge--review    { color: var(--mr-review);    background: var(--mr-review-bg); }
.mr-badge--approved  { color: var(--mr-approved);  background: var(--mr-approved-bg); }
.mr-badge--rejected  { color: var(--mr-rejected);  background: var(--mr-rejected-bg); }
.mr-badge--agenda    { color: var(--mr-approved);  background: var(--mr-approved-bg); }
.mr-badge--debate    { color: #fff;                background: var(--mr-rejected); }
.mr-badge--adopted   { color: #fff;                background: var(--mr-published); }
.mr-badge--not-adopted { color: var(--mr-draft);   background: var(--mr-draft-bg); }
.mr-badge--comment   { color: var(--mr-blue);      background: var(--mr-cool); }

/* ---------------------------------------------------------------------------
 * Alerts
 * ------------------------------------------------------------------------- */

.mr-alert {
	margin-bottom: 1.5rem;
	padding: 0.85rem 1.1rem;
	border-left: 4px solid var(--mr-approved);
	border-radius: 2px;
	background: var(--mr-approved-bg);
	color: var(--mr-ink);
}

.mr-alert--error {
	border-left-color: var(--mr-rejected);
	background: var(--mr-rejected-bg);
}

.mr-alert[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Sections and list rows
 * ------------------------------------------------------------------------- */

.mr-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem 2rem;
	margin-bottom: 1.25rem;
}

.mr-panel .mr-section__title {
	margin: 0;
	font-size: clamp(1.6rem, 3vw, 2rem);
}

.mr-panel .mr-section__title--small {
	font-size: 1.4rem;
	margin-bottom: 1rem;
}

.mr-summary {
	margin-top: 0.3rem;
	color: var(--mr-muted);
}

.mr-summary strong {
	color: var(--mr-ink);
}

.mr-filter {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	width: min(100%, 20rem);
}

.mr-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.mr-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--mr-line);
	border-radius: 2px;
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--mr-body) !important;
	background: var(--mr-paper);
}

.mr-filter-chip:hover {
	border-color: var(--mr-blue);
}

.mr-filter-chip[aria-current="true"] {
	border-color: var(--mr-blue);
	background: var(--mr-blue);
	color: #fff !important;
}

.mr-filter-chip__count {
	font-weight: 400;
	opacity: 0.85;
}

.mr-rows {
	border-top: 1px solid var(--mr-line);
}

/* Published tab: Debating now, On the agenda, Adopted, Not adopted, each under its own heading */
.mr-group + .mr-group {
	margin-top: 2.5rem;
}

.mr-row {
	display: grid;
	/* Wide enough for the longest badge, "On the agenda": narrower and it runs over the title */
	grid-template-columns: 9.5rem minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.5rem 1.25rem;
	padding: 1rem 0.25rem;
	border-bottom: 1px solid var(--mr-line);
	transition: background-color 0.15s ease;
}

.mr-row:hover {
	background: rgba(234, 246, 251, 0.6);
}

/* Public committee index: a name and a count, no status column */
.mr-row--committee {
	grid-template-columns: minmax(0, 1fr) auto;
}

.mr-row__title {
	font-family: var(--wp--preset--font-family--eb-garamond, serif);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.25;
	text-decoration: none;
	color: var(--mr-ink) !important;
}

.mr-row__title:hover {
	color: var(--mr-blue) !important;
	text-decoration: underline;
}

/* Whole row is the link's hit area on touch screens */
.mr-row {
	position: relative;
}

.mr-row__title::after {
	content: "";
	position: absolute;
	inset: 0;
}

.mr-row__side form,
.mr-row__side .mr-btn {
	position: relative; /* above the stretched link */
	z-index: 1;
}

.mr-row__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0 0.9rem;
	margin-top: 0.2rem;
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-row__meta span + span::before {
	content: "·";
	margin-right: 0.9rem;
}

.mr-row__side {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 0.5rem 0.75rem;
	text-align: right;
}

.mr-next-step {
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-next-step.is-action {
	font-weight: 700;
	color: var(--mr-blue);
}

.mr-next-step.is-action::after {
	content: " \2192";
}

@media (max-width: 720px) {
	/* Wrapped meta lines would start with a stray dot */
	.mr-row__meta span + span::before {
		content: none;
	}

	.mr-row {
		grid-template-columns: minmax(0, 1fr);
		gap: 0.4rem;
		padding: 1rem 0;
	}

	.mr-row__side {
		justify-content: flex-start;
		text-align: left;
	}
}

/* Empty states and sign-in */
.mr-empty,
.mr-login {
	max-width: 34rem;
	margin: 1rem auto;
	padding: 2.5rem 2rem;
	text-align: center;
	background: var(--mr-paper);
	border: 1px solid var(--mr-line);
	border-top: 3px solid var(--mr-blue);
	border-radius: var(--mr-radius);
}

.mr-panel .mr-empty__title,
.mr-panel .mr-login__title {
	margin: 0 0 0.75rem;
	font-size: 1.6rem;
}

.mr-empty p + p,
.mr-login > p {
	margin-top: 1rem;
}

.mr-login form {
	margin-top: 1.5rem;
	text-align: left;
}

.mr-login form p {
	margin-bottom: 1rem;
}

.mr-login label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--mr-ink);
}

.mr-login .login-remember label {
	display: inline;
	font-weight: 400;
}

.mr-login input[type="text"],
.mr-login input[type="password"] {
	width: 100%;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--mr-line-strong);
	border-radius: 2px;
	font: inherit;
}

.mr-login input[type="submit"] {
	width: 100%;
	min-height: 2.75rem;
	border: 0;
	border-radius: 2px;
	background: var(--mr-blue);
	color: #fff;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.mr-login input[type="submit"]:hover {
	background: var(--mr-blue-dark);
}

.mr-login__help {
	font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
 * Resolution page
 * ------------------------------------------------------------------------- */

.mr-detail__head {
	margin-bottom: 1.5rem;
}

.mr-panel .mr-detail__title {
	margin: 0.2rem 0 0.6rem;
	font-size: clamp(1.75rem, 3.5vw, 2.5rem);
	line-height: 1.15;
}

.mr-detail__kicker {
	display: block;
	font-family: var(--wp--preset--font-family--open-sans, sans-serif);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--mr-muted);
	margin-bottom: 0.2rem;
}

.mr-detail__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1rem;
	font-size: 0.9rem;
}

.mr-detail__meta strong {
	color: var(--mr-ink);
}

/* Progress: four segments (five after a rejection); labels under each (only the current one on phones) */
.mr-progress {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: 0.35rem;
	margin-bottom: 1.5rem;
}

.mr-progress__step {
	padding-top: 0.65rem;
	border-top: 4px solid var(--mr-line);
	font-size: 0.8rem;
	color: var(--mr-muted);
}

.mr-progress__step.is-done {
	border-top-color: var(--mr-blue);
}

.mr-progress__step.is-current {
	border-top-color: var(--mr-blue);
	color: var(--mr-ink);
	font-weight: 700;
}

.mr-detail--review .mr-progress__step.is-current { border-top-color: var(--mr-review); }
.mr-progress__step.is-rejected { border-top-color: var(--mr-rejected); color: var(--mr-rejected); }
.mr-detail--agenda .mr-progress__step.is-current { border-top-color: var(--mr-approved); }
.mr-detail--debate .mr-progress__step.is-current { border-top-color: var(--mr-rejected); }
.mr-detail--adopted .mr-progress__step.is-current { border-top-color: var(--mr-published); }
.mr-detail--not-adopted .mr-progress__step.is-current { border-top-color: var(--mr-draft); }

.mr-progress__label,
.mr-progress__time {
	display: block;
}

.mr-progress__time {
	font-weight: 400;
	color: var(--mr-muted);
	font-size: 0.75rem;
}

@media (max-width: 600px) {
	.mr-progress__step:not(.is-current) .mr-progress__label,
	.mr-progress__step:not(.is-current) .mr-progress__time {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	/* The current label may be wider than its share of the bar */
	.mr-progress__step.is-current {
		white-space: nowrap;
	}

	.mr-progress__step.is-current:nth-child(n + 4) {
		direction: rtl;
	}
}

/* Next-step box: coloured by status so it reads before any word does */
.mr-nextbox {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	margin-bottom: 2rem;
	padding: 1.25rem 1.5rem;
	background: var(--mr-paper);
	border: 1px solid var(--mr-line);
	border-left: 5px solid var(--mr-draft);
	border-radius: var(--mr-radius);
	box-shadow: 0 1px 3px rgba(31, 43, 48, 0.06);
}

.mr-nextbox--submitted { border-left-color: var(--mr-submitted); }
.mr-nextbox--review    { border-left-color: var(--mr-review); }
.mr-nextbox--rejected  { border-left-color: var(--mr-rejected); }
.mr-nextbox--agenda    { border-left-color: var(--mr-approved); }
.mr-nextbox--debate    { border-left-color: var(--mr-rejected); }
.mr-nextbox--adopted   { border-left-color: var(--mr-published); }

.mr-nextbox__text {
	flex: 1 1 22rem;
}

.mr-panel .mr-nextbox__title {
	margin: 0 0 0.3rem;
	font-size: 1.35rem;
}

.mr-nextbox__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	flex: 0 1 auto;
}

/* The decision and vote forms need the full width under the text */
.mr-nextbox:has(.mr-decision, .mr-vote) .mr-nextbox__actions {
	flex: 1 1 100%;
	flex-direction: column;
	align-items: stretch;
}

.mr-decision {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.mr-field-error {
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--mr-rejected);
}

.mr-input[aria-invalid="true"] {
	border-color: var(--mr-rejected);
}

.mr-reason {
	margin-top: 0.9rem;
	padding: 0.75rem 1rem;
	border-left: 3px solid var(--mr-rejected);
	background: var(--mr-rejected-bg);
}

.mr-reason__label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--mr-rejected);
}

.mr-detail__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem;
}

@media (min-width: 960px) {
	.mr-detail__grid {
		grid-template-columns: minmax(0, 1fr) 20rem;
		gap: 2.5rem;
	}
}

.mr-side-block + .mr-side-block {
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--mr-line);
}

.mr-panel .mr-side-block__title {
	margin: 0 0 0.75rem;
	font-size: 0.72rem;
	letter-spacing: 0.1em;
}

.mr-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.mr-tags li {
	padding: 0.1rem 0.55rem;
	border-radius: 2px;
	background: var(--mr-surface);
	font-size: 0.85rem;
}

.mr-file {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 0.8rem;
	border: 1px solid var(--mr-line);
	border-radius: var(--mr-radius);
	background: var(--mr-paper);
	text-decoration: none;
}

.mr-file:hover {
	border-color: var(--mr-blue);
}

.mr-file__type {
	flex: none;
	padding: 0.2rem 0.4rem;
	border-radius: 2px;
	background: var(--mr-blue);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
}

.mr-file__name {
	overflow-wrap: anywhere;
	font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
 * The document: paper, THIMUN layout, clause comments
 * ------------------------------------------------------------------------- */

.mr-doc {
	background: var(--mr-paper);
	border: 1px solid var(--mr-line);
	border-radius: var(--mr-radius);
	box-shadow: 0 1px 3px rgba(31, 43, 48, 0.06);
}

.mr-doc__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	padding: 0.9rem 1.5rem;
	border-bottom: 1px solid var(--mr-line);
	background: #fbfcfd;
	border-radius: var(--mr-radius) var(--mr-radius) 0 0;
}

.mr-panel .mr-doc__bar-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--open-sans, sans-serif);
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--mr-ink);
}

.mr-doc__header {
	display: grid;
	gap: 0.3rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px dashed var(--mr-line);
}

.mr-doc__header div {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	gap: 1rem;
}

.mr-doc__header dt {
	padding-top: 0.2rem;
}

.mr-doc__header dd {
	color: var(--mr-ink);
}

@media (max-width: 540px) {
	.mr-doc__header div {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}
}

.mr-doc__opening {
	padding: 1.25rem 1.5rem 0.25rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--mr-ink);
}

.mr-doc > .mr-none {
	padding: 1.25rem 1.5rem;
}

.mr-clauses {
	padding: 0.5rem 0 1rem;
}

.mr-clause {
	position: relative;
	padding: 0.55rem 1.5rem 0.55rem calc(1.5rem + var(--mr-indent, 0rem));
	border-left: 3px solid transparent;
}

.mr-clause:hover {
	background: #f7fafb;
}

.mr-clause:target {
	background: var(--mr-cool);
	border-left-color: var(--mr-blue);
}

.mr-clause--depth-1 { --mr-indent: 2.25rem; }
.mr-clause--depth-2 { --mr-indent: 4.5rem; }

/* A gap between the preamble and the first operative clause */
.mr-clause--pre + .mr-clause--op {
	margin-top: 0.9rem;
}

.mr-clause.has-comments {
	border-left-color: var(--mr-review);
}

.mr-clause__row {
	display: grid;
	grid-template-columns: 2rem minmax(0, 1fr);
	gap: 0.5rem;
}

.mr-clause--pre .mr-clause__row {
	grid-template-columns: minmax(0, 1fr);
}

.mr-clause--pre .mr-clause__num {
	display: none;
}

.mr-clause__num {
	font-weight: 700;
	color: var(--mr-ink);
	text-align: right;
}

.mr-clause__text {
	color: var(--mr-ink);
}

/* The same in the document and in the editor, so one looks like the other */
:is(.mr-clause__text, .mr-doc__opening, .mr-editor__text) i {
	font-style: italic;
}

:is(.mr-clause__text, .mr-doc__opening, .mr-editor__text) b {
	font-weight: 700;
}

:is(.mr-clause__text, .mr-doc__opening, .mr-editor__text) u {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.mr-comments,
.mr-comment-form {
	margin: 0.5rem 0 0 2.5rem;
}

.mr-clause--pre :is(.mr-comments, .mr-comment-form) {
	margin-left: 0;
}

.mr-comments {
	display: grid;
	gap: 0.5rem;
}

.mr-comment {
	padding: 0.6rem 0.85rem;
	border-radius: var(--mr-radius);
	background: var(--mr-review-bg);
	font-size: 0.92rem;
}

.mr-comment__meta {
	font-size: 0.8rem;
	color: var(--mr-review);
}

.mr-comment__text {
	color: var(--mr-ink);
}

.mr-comment-form summary {
	display: inline-block;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--mr-blue);
	cursor: pointer;
	list-style: none;
}

.mr-comment-form summary::-webkit-details-marker {
	display: none;
}

.mr-comment-form summary::before {
	content: "+ ";
}

.mr-comment-form[open] summary::before {
	content: "\2212  ";
}

/* With a mouse, the Comment link floats at the clause's right edge and stays
   quiet until the clause is hovered or focused, so the text keeps its rhythm.
   On touch screens it sits under each clause, always visible. */
@media (hover: hover) {
	.mr-doc--commentable .mr-clause {
		padding-right: 7.5rem;
	}

	.mr-clause .mr-comment-form:not([open]) {
		position: absolute;
		top: 0.55rem;
		right: 1.25rem;
		margin: 0;
	}

	.mr-clause .mr-comment-form:not([open]) summary {
		opacity: 0;
		transition: opacity 0.15s ease;
	}

	.mr-clause:hover .mr-comment-form summary,
	.mr-clause:focus-within .mr-comment-form summary,
	.mr-clause.has-comments .mr-comment-form summary {
		opacity: 1;
	}
}

.mr-comment-form form {
	display: grid;
	gap: 0.5rem;
	justify-items: start;
	margin-top: 0.5rem;
}

.mr-doc__general {
	padding: 1.25rem 1.5rem;
	border-top: 1px dashed var(--mr-line);
}

.mr-panel .mr-doc__general-title {
	margin: 0 0 0.5rem;
	font-family: var(--wp--preset--font-family--open-sans, sans-serif);
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0;
}

.mr-doc__general :is(.mr-comments, .mr-comment-form) {
	margin-left: 0;
}

/* ---------------------------------------------------------------------------
 * Vote form: optional counts, one button per result
 * ------------------------------------------------------------------------- */

.mr-vote {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem 1.25rem;
}

.mr-vote__counts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	padding: 0;
	border: 0;
}

.mr-vote__counts legend {
	width: 100%;
	margin-bottom: 0.25rem;
}

.mr-vote__count {
	display: grid;
	gap: 0.15rem;
	font-size: 0.85rem;
}

.mr-vote__count .mr-input {
	width: 6rem;
}

.mr-vote__result {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * The amendment being debated, shown on the text: like suggestions in a
 * shared document. Not colour alone: struck through, and underlined from below.
 * ------------------------------------------------------------------------- */

.mr-del {
	color: var(--mr-rejected);
	background: var(--mr-rejected-bg);
	text-decoration: line-through;
	text-decoration-thickness: 2px;
}

.mr-ins {
	color: var(--mr-approved);
	background: var(--mr-approved-bg);
	text-decoration: none;
	box-shadow: inset 0 -2px 0 var(--mr-approved);
}

.mr-doc__amending {
	margin: 1.25rem 1.5rem 0;
	padding: 0.75rem 1rem;
	border: 1px solid var(--mr-line);
	border-radius: var(--mr-radius);
	background: var(--mr-cool);
	font-size: 0.92rem;
	color: var(--mr-ink);
}

.mr-clause.is-removed .mr-clause__num {
	text-decoration: line-through;
	color: var(--mr-rejected);
}

.mr-clause.is-added {
	background: rgba(229, 244, 234, 0.5);
}

/* ---------------------------------------------------------------------------
 * Amendments
 * ------------------------------------------------------------------------- */

.mr-amendments {
	margin-top: 2.5rem;
}

.mr-amendment-list {
	border-top: 1px solid var(--mr-line);
}

.mr-amendment {
	padding: 1rem 0.25rem;
	border-bottom: 1px solid var(--mr-line);
}

/* The amendment on the floor, boxed whole: while a second-degree amendment
   to it is debated, that one sits inside the box */
.mr-amendment.is-floor {
	padding: 1rem;
	border: 2px solid var(--mr-rejected);
	border-radius: var(--mr-radius);
	background: var(--mr-paper);
	margin: 0.5rem 0;
}

/* Second-degree amendments, under the amendment they change */
.mr-amendment-list--second {
	margin: 0.9rem 0 0 1.5rem;
}

.mr-amendment-list--second .mr-amendment:last-child {
	border-bottom: 0;
}

.mr-amendment--second.is-live {
	padding: 0.75rem;
	background: var(--mr-rejected-bg);
}

.mr-amendment__caption {
	margin-top: 0.6rem;
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-amendment__note {
	margin-top: 0.5rem;
	font-size: 0.88rem;
	color: var(--mr-muted);
}

.mr-amendment .mr-hint {
	margin-top: 0.75rem;
}

.mr-amendment .mr-vote {
	margin-top: 0.75rem;
}

.mr-propose--second {
	margin-top: 0.9rem;
}

.mr-amendment__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.75rem;
}

.mr-amendment__title {
	color: var(--mr-ink);
}

.mr-amendment__meta {
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-amendment__text {
	margin-top: 0.6rem;
	padding: 0.6rem 0.9rem;
	border-left: 3px solid var(--mr-line-strong);
	background: #fbfcfd;
	color: var(--mr-ink);
}

.mr-amendment__decide,
.mr-amendment .mr-inline-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.mr-amendment__decide .mr-input {
	flex: 1 1 14rem;
	width: auto;
}

.mr-propose {
	margin-top: 1.25rem;
	border: 1px solid var(--mr-line);
	border-radius: var(--mr-radius);
	background: var(--mr-paper);
}

.mr-propose summary {
	padding: 0.9rem 1.25rem;
	font-weight: 700;
	color: var(--mr-blue);
	cursor: pointer;
}

.mr-propose .mr-form {
	padding: 0 1.25rem 1.25rem;
}

/* "Debating now" banner on the Committee tab */
.mr-live {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-bottom: 1.5rem;
	padding: 1rem 1.25rem;
	border: 2px solid var(--mr-rejected);
	border-radius: var(--mr-radius);
	background: var(--mr-paper);
	color: var(--mr-ink) !important;
	text-decoration: none;
}

.mr-live:hover {
	background: var(--mr-rejected-bg);
}

.mr-live__label {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--mr-rejected);
}

/* ---------------------------------------------------------------------------
 * History, inbox
 * ------------------------------------------------------------------------- */

.mr-history {
	display: grid;
	gap: 0.85rem;
	padding-left: 1rem;
	border-left: 2px solid var(--mr-line);
}

.mr-history__item {
	position: relative;
	font-size: 0.85rem;
	line-height: 1.45;
}

.mr-history__item::before {
	content: "";
	position: absolute;
	left: calc(-1rem - 5px);
	top: 0.35rem;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--mr-paper);
	box-shadow: 0 0 0 2px var(--mr-line-strong);
}

.mr-history__item--status::before {
	background: var(--mr-blue);
	box-shadow: 0 0 0 2px var(--mr-blue);
}

.mr-history__item--comment::before {
	background: var(--mr-review-bg);
	box-shadow: 0 0 0 2px var(--mr-review);
}

.mr-history__what {
	color: var(--mr-ink);
}

.mr-history__msg {
	color: var(--mr-muted);
	font-style: italic;
}

.mr-history__when {
	color: var(--mr-muted);
	font-size: 0.78rem;
}

.mr-history-more {
	margin-top: 0.75rem;
}

.mr-history-more summary {
	font-size: 0.85rem;
	color: var(--mr-blue);
	cursor: pointer;
	margin-bottom: 0.75rem;
}

.mr-side-block > .mr-hint {
	margin-top: 0.75rem;
}

.mr-inbox {
	border-top: 1px solid var(--mr-line);
}

.mr-inbox__item {
	display: grid;
	grid-template-columns: 8.5rem minmax(0, 1fr);
	align-items: start;
	gap: 0.4rem 1.25rem;
	padding: 1rem 0.25rem;
	border-bottom: 1px solid var(--mr-line);
}

.mr-inbox__item.is-unread {
	background: var(--mr-cool);
	padding-left: 0.75rem;
	border-left: 3px solid var(--mr-blue);
}

.mr-inbox__link {
	font-weight: 600;
	text-decoration: none;
}

.mr-inbox__meta {
	font-size: 0.85rem;
	color: var(--mr-muted);
}

.mr-inbox__quote {
	margin-top: 0.35rem;
	font-size: 0.9rem;
	font-style: italic;
}

@media (max-width: 600px) {
	.mr-inbox__item {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------------------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------------------- */

.mr-form__head {
	margin-bottom: 1.5rem;
}

.mr-form__head .mr-hint {
	margin-top: 0.4rem;
}

.mr-form__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem;
}

@media (min-width: 960px) {
	.mr-form__grid {
		grid-template-columns: minmax(0, 1fr) 20rem;
		gap: 2.5rem;
	}
}

.mr-card {
	padding: 1.25rem 1.5rem 1.5rem;
	border: 1px solid var(--mr-line);
	border-radius: var(--mr-radius);
	background: var(--mr-paper);
}

.mr-card + .mr-card {
	margin-top: 1.5rem;
}

.mr-card__title {
	float: left; /* legend: sit inside the card, not on its border */
	width: 100%;
	margin-bottom: 1rem;
	padding: 0;
}

.mr-card__title + * {
	clear: both;
}

.mr-field {
	display: grid;
	gap: 0.35rem;
	margin-bottom: 1.1rem;
	border: 0;
	padding: 0;
	min-width: 0;
}

.mr-field:last-child {
	margin-bottom: 0;
}

.mr-field-row {
	display: grid;
	align-items: start;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 0 1.25rem;
}

.mr-label {
	display: block;
}

.mr-input {
	width: 100%;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--mr-line-strong);
	border-radius: 2px;
	background: var(--mr-paper);
	color: var(--mr-ink);
	font: inherit;
	font-size: 1rem; /* 16px: stops iOS zooming into the field */
	line-height: 1.5;
}

.mr-input:focus {
	border-color: var(--mr-focus);
	outline: 2px solid var(--mr-focus);
	outline-offset: 1px;
}

.mr-input::placeholder {
	color: #7b878c;
}

select.mr-input {
	appearance: none;
	padding-right: 2.25rem;
	background-image: linear-gradient(45deg, transparent 50%, var(--mr-muted) 50%), linear-gradient(135deg, var(--mr-muted) 50%, transparent 50%);
	background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%;
	background-size: 0.35rem 0.35rem;
	background-repeat: no-repeat;
}

textarea.mr-input {
	resize: vertical;
}

.mr-input--doc {
	min-height: 22rem;
	margin-top: 0.75rem;
	font-size: 0.98rem;
	line-height: 1.65;
	tab-size: 4;
}

/* ---------------------------------------------------------------------------
 * The resolution editor (assets/editor.js). Same indents and number column
 * as the document on the resolution page (.mr-clause), so what is typed
 * looks like what delegates will read.
 * ------------------------------------------------------------------------- */

.mr-editor__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin-top: 0.75rem;
}

.mr-editor__bar .mr-hint {
	flex: 1 1 14rem;
}

.mr-editor__group {
	display: flex;
	gap: 0.25rem;
}

/* Bold, Italic, Underline: each label in its own format, not the buttons' capitals */
.mr-editor__mark {
	font-size: 0.85rem;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.mr-editor__mark[aria-pressed="true"] {
	border-color: var(--mr-blue);
	background: var(--mr-cool);
	box-shadow: inset 0 0 0 1px var(--mr-blue);
}

.mr-editor__text {
	--mr-step: 2.25rem; /* one level of indent */
	--mr-num: 2rem;     /* the column the number sits in */
	position: relative;
	padding-block: 0.75rem;
	cursor: text;
}

.mr-editor__text.is-empty::before {
	content: attr(data-placeholder);
	position: absolute;
	color: #7b878c;
	pointer-events: none;
}

.mr-panel .mr-editor__text p {
	position: relative;
	margin: 0;
	padding: 0.3rem 0 0.3rem var(--mr-pad, 0rem);
	white-space: pre-wrap; /* typed spaces stay spaces: the browser's stand-in for them is a code */
	overflow-wrap: anywhere;
}

/* The number or letter: drawn from data-mark, so it can't be selected or edited */
.mr-editor__text p::before {
	content: attr(data-mark);
	position: absolute;
	left: calc(var(--mr-pad, 0rem) - var(--mr-num) - 0.5rem);
	width: var(--mr-num);
	font-weight: 700;
	text-align: right;
	white-space: nowrap;
}

.mr-editor__text p[data-level="1"] { --mr-pad: calc(var(--mr-num) + 0.5rem); }
.mr-editor__text p[data-level="2"] { --mr-pad: calc(var(--mr-num) + 0.5rem + var(--mr-step)); }
.mr-editor__text p[data-level="3"] { --mr-pad: calc(var(--mr-num) + 0.5rem + 2 * var(--mr-step)); }

/* A gap between the preamble and the first clause, as on the resolution page */
.mr-editor__text p[data-level="0"] + p[data-level="1"] {
	margin-top: 0.9rem;
}

@media (max-width: 600px) {
	.mr-editor__text {
		--mr-step: 1.25rem;
		--mr-num: 1.6rem;
	}
}

.mr-input--file {
	padding: 0.5rem;
	border-style: dashed;
	background: #fbfcfd;
	cursor: pointer;
}

.mr-upload {
	margin-top: 1.25rem;
}

.mr-static {
	padding: 0.4rem 0;
	color: var(--mr-ink);
}

.mr-checkbox {
	margin-left: 0.75rem;
	font-size: 0.9rem;
}

.mr-segmented {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.mr-segmented label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.45rem 0.8rem;
	border: 1px solid var(--mr-line-strong);
	border-radius: 2px;
	font-size: 0.9rem;
	cursor: pointer;
}

.mr-segmented label:has(:checked) {
	border-color: var(--mr-blue);
	background: var(--mr-cool);
	font-weight: 600;
}

.mr-form__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.mr-feedback {
	display: grid;
	gap: 0.5rem;
	font-size: 0.88rem;
}

.mr-feedback li,
.mr-reason-inline {
	padding: 0.5rem 0.75rem;
	border-radius: 2px;
	background: var(--mr-review-bg);
	color: var(--mr-ink);
}

.mr-reason-inline {
	margin-bottom: 0.5rem;
	background: var(--mr-rejected-bg);
	font-size: 0.88rem;
}

.mr-side-block--feedback + .mr-side-block {
	margin-top: 1.75rem;
}

@media (max-width: 600px) {
	.mr-form__actions .mr-btn,
	.mr-nextbox__actions,
	.mr-nextbox__actions .mr-btn,
	.mr-nextbox__actions form {
		width: 100%;
	}

	.mr-nextbox {
		padding: 1rem 1.1rem;
	}

	.mr-doc__bar,
	.mr-doc__header,
	.mr-doc__opening,
	.mr-doc__general {
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.mr-clause {
		padding-left: calc(1rem + var(--mr-indent, 0rem) / 2);
		padding-right: 1rem;
	}

	.mr-comments,
	.mr-comment-form {
		margin-left: 0;
	}
}

/* ---------------------------------------------------------------------------
 * The page's own title (from the theme template): tool-sized, and lined up
 * with the panel's wide column instead of the 760px text column
 * ------------------------------------------------------------------------- */

main:has(.mr-panel) > .wp-block-post-title {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-bottom: 1rem;
	font-size: clamp(2rem, 4vw, 2.75rem);
}
