/**
 * ReliefMed Core styles.
 *
 * Everything is driven by custom properties so the Avada child theme can
 * re-skin these components from one place without overriding selectors.
 */

.rm-browser,
.rm-contracts,
.rm-brands,
.rm-contact,
.rm-compliance,
.rm-feed {
	--rm-ink: #16232e;
	--rm-ink-muted: #5b6b78;
	--rm-line: #dfe6ec;
	--rm-surface: #ffffff;
	--rm-surface-alt: #f5f8fa;
	--rm-accent: #0f7ba8;
	--rm-accent-ink: #ffffff;
	--rm-positive: #1f7a4d;
	--rm-negative: #a33131;
	--rm-radius: 8px;
	--rm-gap: 1.5rem;

	color: var(--rm-ink);
	font-size: 1rem;
	line-height: 1.55;
}

/* -------------------------------------------------- Buttons and badges */

.rm-button {
	display: inline-block;
	padding: 0.6em 1.4em;
	border-radius: var(--rm-radius);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rm-button--ghost {
	border: 1px solid var(--rm-accent);
	color: var(--rm-accent);
	background: transparent;
}

.rm-button--ghost:hover,
.rm-button--ghost:focus-visible {
	background: var(--rm-accent);
	color: var(--rm-accent-ink);
}

.rm-badge {
	display: inline-block;
	padding: 0.2em 0.7em;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.rm-badge--active {
	background: rgba(31, 122, 77, 0.12);
	color: var(--rm-positive);
}

.rm-badge--expired {
	background: rgba(163, 49, 49, 0.1);
	color: var(--rm-negative);
}

/* Awarded, but the contract period has not been captured yet. */
.rm-badge--unknown {
	background: rgba(91, 107, 120, 0.12);
	color: var(--rm-ink-muted);
}

.rm-empty {
	padding: 1.25rem;
	border: 1px dashed var(--rm-line);
	border-radius: var(--rm-radius);
	color: var(--rm-ink-muted);
}

/* -------------------------------------------------- Contract cards */

.rm-contracts {
	display: grid;
	gap: var(--rm-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.rm-contracts--cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.rm-contracts--cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.rm-contract-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 1.5rem;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	background: var(--rm-surface);
}

.rm-contract-card.is-expired {
	background: var(--rm-surface-alt);
}

.rm-contract-card__title {
	margin: 0.25rem 0 0;
	font-size: 1.25rem;
	line-height: 1.25;
}

.rm-contract-card__title a {
	color: inherit;
	text-decoration: none;
}

.rm-contract-card__title a:hover,
.rm-contract-card__title a:focus-visible {
	color: var(--rm-accent);
}

.rm-contract-card__number {
	margin: 0;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.875rem;
	color: var(--rm-ink-muted);
}

.rm-contract-card__period,
.rm-contract-card__meta {
	margin: 0;
	font-size: 0.9rem;
	color: var(--rm-ink-muted);
}

.rm-contract-card__excerpt {
	margin: 0.25rem 0;
}

.rm-contract-card .rm-button {
	margin-top: auto;
}

/* -------------------------------------------------- Line item browser */

.rm-browser__controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.rm-field {
	display: block;
}

.rm-field--grow {
	flex: 1 1 18rem;
}

.rm-browser input[type="search"],
.rm-browser select {
	width: 100%;
	padding: 0.65em 0.85em;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	background: var(--rm-surface);
	color: inherit;
	font: inherit;
}

.rm-browser input[type="search"]:focus-visible,
.rm-browser select:focus-visible {
	outline: 2px solid var(--rm-accent);
	outline-offset: 1px;
}

.rm-browser__status {
	margin: 0 0 0.75rem;
	font-size: 0.9rem;
	color: var(--rm-ink-muted);
}

.rm-browser__table-wrap {
	overflow-x: auto;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
}

.rm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.925rem;
}

.rm-table th,
.rm-table td {
	padding: 0.75rem 1rem;
	text-align: left;
	vertical-align: top;
}

.rm-table thead th {
	position: sticky;
	top: 0;
	background: var(--rm-surface-alt);
	border-bottom: 1px solid var(--rm-line);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.rm-table tbody tr + tr td {
	border-top: 1px solid var(--rm-line);
}

.rm-table tbody tr:hover td {
	background: var(--rm-surface-alt);
}

.rm-table__price {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.rm-table__name {
	display: block;
	font-weight: 600;
}

.rm-table__brand {
	display: block;
	margin-top: 0.15rem;
	font-size: 0.8rem;
	color: var(--rm-ink-muted);
}

.rm-browser__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin-top: 1rem;
}

.rm-pager__button {
	padding: 0.45em 0.85em;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	background: var(--rm-surface);
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.rm-pager__button:hover {
	border-color: var(--rm-accent);
	color: var(--rm-accent);
}

.rm-pager__button.is-current {
	background: var(--rm-accent);
	border-color: var(--rm-accent);
	color: var(--rm-accent-ink);
	font-weight: 700;
}

.rm-browser__note {
	margin-top: 1rem;
	font-size: 0.85rem;
	color: var(--rm-ink-muted);
}

/* Stack the table into cards on small screens rather than forcing a scroll. */
@media (max-width: 640px) {
	.rm-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.rm-table tbody tr {
		display: block;
		padding: 0.5rem 0;
	}

	.rm-table tbody tr + tr {
		border-top: 1px solid var(--rm-line);
	}

	.rm-table tbody tr + tr td {
		border-top: 0;
	}

	.rm-table td {
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		padding: 0.3rem 1rem;
		text-align: right;
	}

	.rm-table td::before {
		content: attr(data-label);
		font-size: 0.8rem;
		font-weight: 600;
		color: var(--rm-ink-muted);
		text-align: left;
	}

	/* The product cell holds two stacked spans. As a flex row the brand rides
	   up beside the name, so it becomes a small grid: label in the first
	   column, name over brand in the second. */
	.rm-table td[data-label="Product"] {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		gap: 0.15rem 1rem;
		align-items: start;
	}

	.rm-table td[data-label="Product"]::before {
		grid-column: 1;
		grid-row: 1;
	}

	.rm-table__name {
		grid-column: 2;
		grid-row: 1;
	}

	.rm-table__brand {
		grid-column: 2;
		grid-row: 2;
		margin-top: 0;
	}

	.rm-table__name,
	.rm-table__brand {
		text-align: right;
	}

	.rm-table__actions {
		padding-top: 0.6rem;
	}
}

/* -------------------------------------------------- Brands */

.rm-brands {
	display: grid;
	gap: var(--rm-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
	align-items: stretch;
}

.rm-brand {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.5rem;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	background: var(--rm-surface);
	text-align: center;
}

.rm-brand__link {
	text-decoration: none;
	color: inherit;
}

.rm-brand__logo {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 5rem;
}

.rm-brand__logo img {
	max-width: 100%;
	max-height: 5rem;
	height: auto;
	object-fit: contain;
}

.rm-brand__name {
	font-size: 1.1rem;
	font-weight: 700;
}

.rm-brand__blurb {
	font-size: 0.9rem;
	color: var(--rm-ink-muted);
}

.rm-brand__blurb p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------- Partner feed */

.rm-feed {
	overflow: hidden;
	padding: 1rem 0;
	/* Fade the logos out at both edges instead of cutting them dead. */
	mask-image: linear-gradient(to right, transparent, #000 6rem, #000 calc(100% - 6rem), transparent);
}

.rm-feed__track {
	display: flex;
	align-items: center;
	gap: 3rem;
	width: max-content;
	animation: rm-feed-scroll var(--rm-feed-duration, 40s) linear infinite;
}

.rm-feed:hover .rm-feed__track,
.rm-feed:focus-within .rm-feed__track {
	animation-play-state: paused;
}

.rm-feed__item img {
	max-height: 3.5rem;
	width: auto;
	object-fit: contain;
}

@keyframes rm-feed-scroll {
	from { transform: translateX(0); }
	/* The list is duplicated, so half a loop returns to an identical frame. */
	to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
	.rm-feed__track {
		animation: none;
		flex-wrap: wrap;
		justify-content: center;
		width: 100%;
	}
}

/* -------------------------------------------------- Contact & compliance */

.rm-contact {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.rm-contact__item {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.rm-contact__label {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--rm-ink-muted);
}

.rm-contact__item a {
	color: var(--rm-accent);
	font-size: 1.05rem;
	font-weight: 600;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.rm-contact__item a:hover,
.rm-contact__item a:focus-visible {
	text-decoration: underline;
}

.rm-compliance {
	margin: 1.5rem 0;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	overflow: hidden;
}

.rm-compliance__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	padding: 0.75rem 1.25rem;
	background: var(--rm-surface);
}

.rm-compliance__row + .rm-compliance__row {
	border-top: 1px solid var(--rm-line);
}

.rm-compliance dt {
	flex: 0 0 14rem;
	margin: 0;
	font-weight: 600;
	color: var(--rm-ink-muted);
}

.rm-compliance dd {
	flex: 1 1 12rem;
	margin: 0;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* -------------------------------------------------- Item detail dialog */

.rm-table__row.is-clickable {
	cursor: pointer;
}

.rm-table__actions {
	text-align: right;
	white-space: nowrap;
}

.rm-table__open {
	padding: 0.35em 0.9em;
	border: 1px solid var(--rm-line);
	border-radius: 999px;
	background: var(--rm-surface);
	color: var(--rm-accent);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rm-table__row:hover .rm-table__open,
.rm-table__open:focus-visible {
	border-color: var(--rm-accent);
	background: var(--rm-accent);
	color: #fff;
}

.rm-item {
	width: min(60rem, calc(100vw - 2rem));
	max-height: min(48rem, calc(100vh - 3rem));
	padding: 0;
	border: 0;
	border-radius: calc(var(--rm-radius) * 1.6);
	background: var(--rm-surface);
	color: var(--rm-ink);
	box-shadow: 0 24px 70px -20px rgba(10, 34, 70, 0.45);
	overflow: hidden;
}

.rm-item::backdrop {
	background: rgba(10, 34, 70, 0.55);
}

.rm-item__inner {
	display: flex;
	flex-direction: column;
	max-height: inherit;
}

.rm-item__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 2.25rem;
	height: 2.25rem;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rm-ink-muted);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.rm-item__close:hover,
.rm-item__close:focus-visible {
	background: var(--rm-surface-alt);
	color: var(--rm-ink);
}

.rm-item__head {
	flex: none;
	padding: 1.75rem 3.5rem 1.25rem 1.75rem;
	border-bottom: 1px solid var(--rm-line);
}

.rm-item__number {
	margin: 0 0 0.35rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--rm-accent);
}

.rm-item__title {
	margin: 0;
	font-size: 1.35rem;
	line-height: 1.25;
}

.rm-item__brand {
	margin: 0.35rem 0 0;
	font-size: 0.9rem;
	color: var(--rm-ink-muted);
}

.rm-item__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1.5rem 1.75rem 1.75rem;
}


.rm-item__section + .rm-item__section {
	margin-top: 1.75rem;
}

.rm-item__section h3 {
	margin: 0 0 0.6rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--rm-ink-muted);
}

/* The tender spec arrives with meaningful line breaks. */
.rm-item__spec {
	margin: 0;
	padding: 1rem 1.25rem;
	border-radius: var(--rm-radius);
	background: var(--rm-surface-alt);
	white-space: pre-line;
	line-height: 1.6;
}

.rm-item__gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	gap: 1rem;
	/* Figures stay stretched so the image can size to the cell; the inline
	   max-width on each one caps it at its natural width, and grid falls back
	   to start alignment for an item that cannot stretch. */
	align-items: start;
}

.rm-item__figure {
	display: block;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	overflow: hidden;
	background: var(--rm-surface);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rm-item__figure:hover,
.rm-item__figure:focus-visible {
	border-color: var(--rm-accent);
	box-shadow: 0 8px 24px -14px rgba(10, 34, 70, 0.5);
}

.rm-item__figure img {
	display: block;
	width: 100%;
	height: auto;
}

.rm-item__actions {
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--rm-line);
}

@media (max-width: 640px) {
	.rm-item__head {
		padding: 1.5rem 3rem 1rem 1.25rem;
	}

	.rm-item__body {
		padding: 1.25rem;
	}
}

/* Item details and multi-year pricing share one table treatment. */
.rm-item__table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius);
	overflow: hidden;
	font-size: 0.95rem;
}

.rm-item__table th,
.rm-item__table td {
	padding: 0.6rem 1rem;
	text-align: left;
	vertical-align: top;
}

.rm-item__table thead th {
	background: var(--rm-surface-alt);
	border-bottom: 1px solid var(--rm-line);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--rm-ink-muted);
}

.rm-item__table tbody tr + tr th,
.rm-item__table tbody tr + tr td {
	border-top: 1px solid var(--rm-line);
}

.rm-item__table tbody th {
	font-weight: 600;
}

/* The details table runs labels across the top with a single row of values,
   so it stays two lines deep however many facts an item carries. */
.rm-item__table-wrap {
	overflow-x: auto;
	border-radius: var(--rm-radius);
}

.rm-item__facts {
	font-size: 0.9rem;
}

/* Labels wrap so nine facts still fit the dialog without a sideways scroll;
   the values below them are what must stay on one line. */
.rm-item__facts th,
.rm-item__facts td {
	padding: 0.5rem 0.75rem;
}

.rm-item__facts thead th {
	white-space: normal;
	line-height: 1.3;
	vertical-align: bottom;
}

.rm-item__facts tbody td {
	font-weight: 600;
}

.rm-item__facts-whole {
	white-space: nowrap;
}

.rm-item__pricing-figure {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

