/* SM Metal Prices */

.smmp {
	--smmp-bg: #1a1c1d;
	--smmp-text: #ffffff;
	--smmp-soft: rgba(255, 255, 255, 0.86);
	--smmp-muted: #8d8a84;
	--smmp-accent: #b08d5b;
	--smmp-accent-text: #c9a26a;
	--smmp-accent-hover: #977748;
	--smmp-rule: rgba(176, 141, 91, 0.55);
	--smmp-live: #34c46a;
	--smmp-delayed: #e0a33a;
	--smmp-up: #34c46a;
	--smmp-down: #e5484d;
	--smmp-value-size: 1.95rem;
	--smmp-pad-x: clamp(20px, 4vw, 56px);
	--smmp-pad-y: clamp(28px, 3.5vw, 44px);
	--smmp-max: 1800px;

	box-sizing: border-box;
	color: var(--smmp-text);
	background-color: var(--smmp-bg);
	font-family: inherit;
	font-weight: 400;
	line-height: 1.35;
	container-type: inline-size;
}

.smmp *,
.smmp *::before,
.smmp *::after {
	box-sizing: inherit;
}

/* Stop theme paragraph and span weights (e.g. Divi bold body text) bleeding in. */
.smmp .smmp__text,
.smmp .smmp__updated,
.smmp .smmp__unit,
.smmp .smmp__value,
.smmp .smmp__label {
	font-weight: 400;
}

.smmp p,
.smmp ul,
.smmp h2,
.smmp h3,
.smmp h4 {
	margin: 0;
	padding: 0;
}

.smmp--light {
	--smmp-bg: #f6f3ee;
	--smmp-text: #1b1b1b;
	--smmp-soft: #3a3835;
	--smmp-muted: #7b766e;
	--smmp-accent-text: #8c6a3c;
	--smmp-rule: rgba(140, 106, 60, 0.4);
	--smmp-live: #1f9a4d;
}

/* ------------------------------------------------------------------
 * Panel
 * --------------------------------------------------------------- */

.smmp--panel {
	background-image:
		linear-gradient(180deg, rgba(14, 15, 16, 0.78), rgba(14, 15, 16, 0.88)),
		var(--smmp-bg-image, none);
	background-size: cover;
	background-position: center;
}

.smmp--light.smmp--panel {
	background-image: none;
}

.smmp__inner {
	display: grid;
	grid-template-columns: minmax(200px, 250px) minmax(0, 1fr) auto;
	grid-template-areas: "intro items cta";
	align-items: stretch;
	max-width: var(--smmp-max);
	margin: 0 auto;
	padding: var(--smmp-pad-y) var(--smmp-pad-x);
	--smmp-value-size: clamp(1.4rem, 1.45cqi, 2rem);
}

.smmp__intro {
	grid-area: intro;
	padding-right: 28px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.smmp__rule {
	display: block;
	width: 52px;
	height: 2px;
	margin-bottom: 18px;
	background: var(--smmp-accent);
}

.smmp .smmp__heading {
	color: var(--smmp-accent-text);
	font-family: inherit;
	font-size: 1.05rem;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	margin-bottom: 8px;
}

.smmp__text {
	color: var(--smmp-soft);
	font-size: 0.95rem;
	line-height: 1.55;
	max-width: 30ch;
}

.smmp__status {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-top: 22px !important;
	font-size: 0.85rem;
}

.smmp__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--smmp-live);
	box-shadow: 0 0 0 0 rgba(52, 196, 106, 0.6);
	animation: smmp-pulse 2.4s ease-out infinite;
}

.smmp__status-label {
	color: var(--smmp-live);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	margin-right: 8px;
}

.smmp__updated {
	color: var(--smmp-muted);
	font-size: 0.8rem;
}

.smmp__status[data-smmp-status="delayed"] .smmp__dot,
.smmp__status[data-smmp-status="unknown"] .smmp__dot {
	background: var(--smmp-delayed);
	animation: none;
}

.smmp__status[data-smmp-status="delayed"] .smmp__status-label,
.smmp__status[data-smmp-status="unknown"] .smmp__status-label {
	color: var(--smmp-delayed);
}

.smmp__status[data-smmp-status="closed"] .smmp__dot {
	background: var(--smmp-muted);
	animation: none;
}

.smmp__status[data-smmp-status="closed"] .smmp__status-label {
	color: var(--smmp-muted);
}

@keyframes smmp-pulse {
	0% { box-shadow: 0 0 0 0 rgba(52, 196, 106, 0.55); }
	70% { box-shadow: 0 0 0 8px rgba(52, 196, 106, 0); }
	100% { box-shadow: 0 0 0 0 rgba(52, 196, 106, 0); }
}

/* Items */

.smmp--panel .smmp__items {
	grid-area: items;
	display: grid;
	grid-template-columns: repeat(var(--smmp-n, 4), minmax(0, 1fr));
	list-style: none;
}

.smmp--panel .smmp__item {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding: 4px clamp(16px, 1.6vw, 32px);
	border-left: 1px solid var(--smmp-rule);
	min-width: 0;
}

.smmp__icon {
	flex: 0 0 auto;
	width: clamp(56px, 4.2cqi, 80px);
	aspect-ratio: 5 / 3;
	margin-top: 2px;
}

.smmp__icon img,
.smmp__svg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.smmp__body {
	flex: 1 1 auto;
	min-width: 0;
}

.smmp--panel .smmp__name {
	font-size: 0.95rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--smmp-text);
	margin-bottom: 18px;
	white-space: nowrap;
}

.smmp--panel .smmp__unit {
	margin-left: 6px;
	color: var(--smmp-muted);
	font-size: 0.85em;
	text-transform: none;
	letter-spacing: 0.02em;
}

.smmp--panel .smmp__row {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 2px;
	min-width: 0;
}

.smmp--panel .smmp__row--buy {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--smmp-rule);
}

.smmp--panel .smmp__label {
	color: var(--smmp-muted);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
}

.smmp--panel .smmp__row--buy .smmp__label {
	color: var(--smmp-accent-text);
	opacity: 0.8;
}

.smmp--panel .smmp__value {
	font-size: var(--smmp-value-size);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -0.005em;
	font-variant-numeric: tabular-nums lining-nums;
	color: var(--smmp-text);
	white-space: nowrap;
	border-radius: 2px;
}

.smmp--panel .smmp__row--buy .smmp__value {
	color: var(--smmp-accent-text);
}

.smmp__cta {
	grid-area: cta;
	display: flex;
	align-items: center;
	padding-left: clamp(16px, 2vw, 32px);
	border-left: 1px solid var(--smmp-rule);
}

.smmp .smmp__button {
	display: inline-block;
	padding: 15px 26px;
	background: var(--smmp-accent);
	color: #fff;
	font-size: 0.9rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.smmp .smmp__button:hover {
	background: var(--smmp-accent-hover);
	color: #fff;
}

.smmp a:focus-visible {
	outline: 2px solid var(--smmp-accent-text);
	outline-offset: 3px;
}

/* Today's direction arrow (arrows="yes") */

.smmp__dir {
	display: none;
}

.smmp--arrows .smmp__dir {
	display: inline-block;
	margin-left: 8px;
	font-size: 0.75em;
	line-height: 1;
}

.smmp--arrows [data-dir="up"] .smmp__dir::before {
	content: "▲";
	color: var(--smmp-up);
}

.smmp--arrows [data-dir="down"] .smmp__dir::before {
	content: "▼";
	color: var(--smmp-down);
}

/* Brief highlight when a figure changes */

.smmp-flash--up {
	animation: smmp-flash-up 1.6s ease-out;
}

.smmp-flash--down {
	animation: smmp-flash-down 1.6s ease-out;
}

@keyframes smmp-flash-up {
	0% { background-color: rgba(52, 196, 106, 0.28); }
	100% { background-color: transparent; }
}

@keyframes smmp-flash-down {
	0% { background-color: rgba(229, 72, 77, 0.28); }
	100% { background-color: transparent; }
}

/* Panel: no room for everything in one row. Intro and button share the top row. */

@container (max-width: 1640px) {
	.smmp__inner {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"intro cta"
			"items items";
		--smmp-value-size: clamp(1.45rem, 2.1cqi, 2rem);
	}

	.smmp__intro {
		display: grid;
		grid-template-columns: auto auto;
		justify-content: start;
		align-items: end;
		gap: 6px 40px;
		padding: 0 0 26px;
	}

	.smmp__intro .smmp__rule,
	.smmp__intro .smmp__heading {
		grid-column: 1 / -1;
	}

	.smmp__text {
		max-width: 56ch;
	}

	.smmp__status {
		margin-top: 0 !important;
	}

	.smmp__cta {
		padding: 0 0 26px 24px;
		border-left: 0;
		align-items: end;
	}

	.smmp--panel .smmp__items {
		border-top: 1px solid var(--smmp-rule);
		padding-top: 28px;
	}

	.smmp--panel .smmp__item:first-child {
		padding-left: 0;
		border-left: 0;
	}
}

/* Narrower: illustration sits above the figures. */

@container (max-width: 1240px) {
	.smmp--panel .smmp__item {
		flex-direction: column;
		gap: 14px;
	}

	.smmp__icon {
		width: 60px;
	}

	.smmp--panel .smmp__name {
		margin-bottom: 12px;
	}
}

/* Tablet: two prices per row. */

@container (max-width: 860px) {
	.smmp__intro {
		grid-template-columns: 1fr;
	}

	.smmp--panel .smmp__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: 32px;
	}

	.smmp--panel .smmp__item:nth-child(odd) {
		padding-left: 0;
		border-left: 0;
	}

	.smmp--panel .smmp__item {
		flex-direction: row;
		gap: 16px;
	}
}

/* Phones: one price per row, button last. */

@container (max-width: 600px) {
	.smmp__inner {
		grid-template-columns: 1fr;
		grid-template-areas:
			"intro"
			"items"
			"cta";
		--smmp-value-size: 1.55rem;
	}

	.smmp__intro {
		display: block;
	}

	.smmp__status {
		margin-top: 16px !important;
	}

	.smmp--panel .smmp__items {
		grid-template-columns: 1fr;
		row-gap: 0;
		padding-top: 0;
	}

	.smmp--panel .smmp__item,
	.smmp--panel .smmp__item:nth-child(odd),
	.smmp--panel .smmp__item:nth-child(even) {
		padding: 22px 0;
		border-left: 0;
		border-bottom: 1px solid var(--smmp-rule);
	}

	.smmp--panel .smmp__body {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		align-items: stretch;
		column-gap: 16px;
	}

	.smmp--panel .smmp__name {
		grid-column: 1 / -1;
	}

	.smmp--panel .smmp__row--buy {
		margin-top: 0;
		padding-top: 0;
		padding-left: 16px;
		border-top: 0;
		border-left: 1px solid var(--smmp-rule);
	}

	.smmp__icon {
		width: 48px;
	}

	.smmp__cta {
		padding: 24px 0 0;
	}

	.smmp .smmp__button {
		display: block;
		width: 100%;
		text-align: center;
	}
}

@container (max-width: 400px) {
	.smmp__inner {
		--smmp-value-size: 1.3rem;
	}

	.smmp__icon {
		display: none;
	}
}

/* ------------------------------------------------------------------
 * Ticker
 * --------------------------------------------------------------- */

.smmp--ticker {
	--smmp-bg: #000;
	font-size: 0.875rem;
	border-bottom: 1px solid var(--smmp-rule);
}

.smmp--ticker .smmp__track {
	display: flex;
	align-items: center;
	gap: 28px;
	max-width: var(--smmp-max);
	margin: 0 auto;
	padding: 12px var(--smmp-pad-x);
	overflow-x: auto;
	scrollbar-width: none;
	white-space: nowrap;
	justify-content: safe center;
}

.smmp--ticker .smmp__track::-webkit-scrollbar {
	display: none;
}

.smmp--ticker .smmp__status {
	margin: 0 !important;
	flex: 0 0 auto;
	flex-wrap: nowrap;
	gap: 8px;
}

.smmp--ticker .smmp__dot {
	width: 8px;
	height: 8px;
}

.smmp--ticker .smmp__status-label {
	margin-right: 0;
}

.smmp--ticker .smmp__updated {
	display: none;
}

.smmp--ticker .smmp__items {
	display: flex;
	gap: 24px;
	list-style: none;
}

.smmp--ticker .smmp__item {
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding-left: 24px;
	border-left: 1px solid var(--smmp-rule);
}

.smmp--ticker .smmp__item:first-child {
	padding-left: 0;
	border-left: 0;
}

.smmp--ticker .smmp__name {
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-right: 2px;
}

.smmp--ticker .smmp__unit {
	text-transform: none;
	color: var(--smmp-muted);
	font-weight: 400;
}

.smmp--ticker .smmp__dir {
	margin: 0 2px 0 0;
}

.smmp--ticker .smmp__label {
	color: var(--smmp-muted);
}

.smmp--ticker .smmp__label--buy {
	margin-left: 8px;
}

.smmp--ticker .smmp__value {
	font-variant-numeric: tabular-nums;
	color: var(--smmp-text);
	border-radius: 2px;
}

.smmp--ticker .smmp__value--buy {
	color: var(--smmp-accent-text);
}

.smmp--ticker .smmp__link {
	flex: 0 0 auto;
	color: var(--smmp-accent-text);
	text-decoration: none;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 0.8rem;
}

.smmp--ticker .smmp__link:hover {
	text-decoration: underline;
}

@container (max-width: 1500px) {
	.smmp--ticker .smmp__label:not(.smmp__label--buy) {
		display: none;
	}
}

/* ------------------------------------------------------------------
 * Compact panel: [sm_metal_prices layout="compact"]
 * No intro column, status line on top, spot and buy-back side by side.
 * --------------------------------------------------------------- */

.smmp--compact .smmp__inner {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"top"
		"items";
	padding-top: 12px;
	padding-bottom: 14px;
	--smmp-value-size: 18px;
}

.smmp__topbar {
	grid-area: top;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.smmp--compact .smmp__status {
	margin: 0 !important;
	font-size: 0.8rem;
}

.smmp--compact .smmp__dot {
	width: 8px;
	height: 8px;
}

.smmp .smmp__toplink {
	color: var(--smmp-accent-text);
	font-size: 0.8rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
}

.smmp .smmp__toplink:hover {
	text-decoration: underline;
}

.smmp--compact .smmp__items,
.smmp--compact.smmp--panel .smmp__items {
	grid-template-columns: repeat(var(--smmp-n, 4), minmax(0, 1fr));
	border-top: 0;
	padding-top: 0;
	row-gap: 20px;
}

.smmp--compact .smmp__item,
.smmp--compact.smmp--panel .smmp__item {
	flex-direction: row;
	align-items: center;
	gap: 14px;
	padding: 0 clamp(14px, 1.5vw, 28px);
	border-left: 1px solid var(--smmp-rule);
}

.smmp--compact.smmp--panel .smmp__item:first-child {
	padding-left: 0;
	border-left: 0;
}

.smmp--compact .smmp__icon {
	width: clamp(40px, 3cqi, 54px);
	align-self: center;
}

.smmp--compact.smmp--panel .smmp__name {
	margin-bottom: 4px;
	font-size: 0.85rem;
}

.smmp--compact.smmp--panel .smmp__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	/* Name pinned to the top, prices pinned to the bottom. All four columns are
	   the same height, so names and prices line up even if one label wraps. */
	grid-template-rows: auto 1fr;
	align-items: stretch;
	align-self: stretch;
	column-gap: 14px;
	flex: 1 1 auto;
}

.smmp--compact.smmp--panel .smmp__name {
	grid-column: 1 / -1;
}

.smmp--compact.smmp--panel .smmp__row--buy {
	margin-top: 0;
	padding-top: 0;
	padding-left: 14px;
	border-top: 0;
	border-left: 1px solid var(--smmp-rule);
}

.smmp--compact.smmp--panel .smmp__label {
	font-size: 12px;
	line-height: 1.25;
}

.smmp--compact.smmp--panel .smmp__value {
	line-height: 1.1;
}

/* status="side": Live indicator as a narrow first column instead of a row on top. */
.smmp--status-side .smmp__inner {
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas: "top items";
	align-items: center;
}

.smmp--status-side .smmp__topbar {
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	margin: 0;
	padding-right: clamp(14px, 1.5vw, 28px);
	border-right: 1px solid var(--smmp-rule);
	align-self: stretch;
	justify-content: center;
}

.smmp--status-side .smmp__status {
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.smmp--status-side .smmp__status .smmp__dot {
	display: none;
}

.smmp--status-side .smmp__status-label::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-right: 6px;
	border-radius: 50%;
	background: currentColor;
	vertical-align: 1px;
}

.smmp--status-side .smmp__updated {
	white-space: nowrap;
}

.smmp--status-side.smmp--panel .smmp__item:first-child {
	padding-left: clamp(14px, 1.5vw, 28px);
}

@container (max-width: 1080px) {
	.smmp--status-side .smmp__inner {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"top"
			"items";
	}

	.smmp--status-side .smmp__topbar {
		flex-direction: row;
		align-items: center;
		margin-bottom: 8px;
		padding-right: 0;
		border-right: 0;
	}

	.smmp--status-side .smmp__status {
		flex-direction: row;
		align-items: center;
		gap: 10px;
	}

	.smmp--status-side.smmp--panel .smmp__item:first-child {
		padding-left: 0;
	}
}

/* Not enough room for four with illustrations: drop the illustrations. */
@container (max-width: 1360px) {
	.smmp--compact .smmp__icon {
		display: none;
	}
}

/* Two per row. */
@container (max-width: 1080px) {
	.smmp--compact .smmp__items,
	.smmp--compact.smmp--panel .smmp__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.smmp--compact .smmp__icon {
		display: block;
	}

	.smmp--compact.smmp--panel .smmp__item:nth-child(odd) {
		padding-left: 0;
		border-left: 0;
	}
}

/* One per row on phones. */
@container (max-width: 600px) {
	.smmp--compact .smmp__items,
	.smmp--compact.smmp--panel .smmp__items {
		grid-template-columns: 1fr;
		row-gap: 0;
	}

	.smmp--compact.smmp--panel .smmp__item,
	.smmp--compact.smmp--panel .smmp__item:nth-child(odd),
	.smmp--compact.smmp--panel .smmp__item:nth-child(even) {
		padding: 14px 0;
		border-left: 0;
		border-bottom: 1px solid var(--smmp-rule);
	}

	.smmp--compact.smmp--panel .smmp__item:last-child {
		border-bottom: 0;
	}

	.smmp--compact.smmp--panel .smmp__body {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.smmp--compact .smmp__icon {
		width: 40px;
	}
}

@container (max-width: 400px) {
	.smmp--compact .smmp__icon {
		display: none;
	}
}

/* ------------------------------------------------------------------
 * Buy-back calculator: [sm_buyback_calculator]
 * --------------------------------------------------------------- */

.smmp-calc {
	--smmp-field-bg: rgba(255, 255, 255, 0.04);
	--smmp-field-border: rgba(255, 255, 255, 0.18);
	--smmp-card-bg: rgba(255, 255, 255, 0.035);
	--smmp-card-border: var(--smmp-rule);
	--smmp-row-rule: rgba(255, 255, 255, 0.1);
	--smmp-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c9a26a' stroke-width='1.6'/%3E%3C/svg%3E");
}

.smmp-calc.smmp--light {
	--smmp-bg: #f7f4ef;
	--smmp-field-bg: #ffffff;
	--smmp-field-border: #d9d2c6;
	--smmp-card-bg: #ffffff;
	--smmp-card-border: #e3dccf;
	--smmp-row-rule: #e6e0d5;
	--smmp-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238c6a3c' stroke-width='1.6'/%3E%3C/svg%3E");
}

.smmp-calc__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
	grid-template-areas:
		"head summary"
		"main summary";
	gap: 28px clamp(24px, 3vw, 48px);
	align-items: start;
	max-width: 1200px;
	margin: 0 auto;
	padding: clamp(28px, 4vw, 56px) clamp(20px, 4vw, 48px);
}

.smmp-calc__head {
	grid-area: head;
}

.smmp .smmp-calc__heading {
	color: var(--smmp-text);
	font-family: inherit;
	font-size: clamp(1.6rem, 2.4vw, 2.2rem);
	font-weight: 400;
	line-height: 1.2;
	margin-bottom: 10px;
}

.smmp .smmp-calc__text {
	color: var(--smmp-soft);
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.55;
	max-width: 90ch;
}

.smmp-calc .smmp__status {
	margin-top: 14px !important;
}

/* Rows */

.smmp-calc__main {
	grid-area: main;
	min-width: 0;
	container-type: inline-size;
	container-name: smmp-calc-rows;
}

.smmp-calc__labels,
.smmp-calc__row {
	display: grid;
	grid-template-columns: minmax(110px, 1.2fr) minmax(80px, 0.8fr) minmax(110px, 1fr) minmax(120px, 1.1fr) minmax(110px, 1fr) 40px;
	gap: 12px;
	align-items: center;
}

.smmp-calc__labels {
	padding-bottom: 10px;
	border-bottom: 1px solid var(--smmp-row-rule);
	color: var(--smmp-muted);
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.smmp-calc__labels-value {
	text-align: right;
}

.smmp ol.smmp-calc__rows {
	list-style: none;
	margin: 0;
	padding: 0;
}

.smmp-calc__row {
	padding: 14px 0;
	border-bottom: 1px solid var(--smmp-row-rule);
}

.smmp-calc__cell {
	min-width: 0;
}

.smmp-calc select,
.smmp-calc input[type="number"] {
	display: block;
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var(--smmp-field-border);
	border-radius: 0;
	background-color: var(--smmp-field-bg);
	color: var(--smmp-text);
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	box-shadow: none;
}

.smmp-calc select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 34px;
	background-image: var(--smmp-chevron);
	background-repeat: no-repeat;
	background-position: right 12px center;
	cursor: pointer;
}

.smmp-calc select option {
	color: #1b1b1b;
	background: #fff;
}

.smmp-calc input[type="number"] {
	font-variant-numeric: tabular-nums;
	-moz-appearance: textfield;
}

.smmp-calc input[type="number"]::-webkit-inner-spin-button,
.smmp-calc input[type="number"]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.smmp-calc select:focus,
.smmp-calc input[type="number"]:focus {
	outline: 2px solid var(--smmp-accent);
	outline-offset: 1px;
	border-color: var(--smmp-accent);
}

.smmp-calc__mlabel {
	display: none;
}

.smmp-calc__rate {
	color: var(--smmp-muted);
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.smmp-calc__cell--value {
	text-align: right;
}

.smmp-calc__value {
	color: var(--smmp-text);
	font-size: 18px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.smmp .smmp-calc__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--smmp-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.smmp .smmp-calc__remove:hover:not(:disabled) {
	color: var(--smmp-down);
	border-color: currentColor;
}

.smmp .smmp-calc__remove:disabled {
	opacity: 0.25;
	cursor: default;
}

.smmp .smmp-calc__add {
	margin-top: 16px;
	padding: 10px 0;
	border: 0;
	background: none;
	color: var(--smmp-accent-text);
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	cursor: pointer;
}

.smmp .smmp-calc__add:hover {
	text-decoration: underline;
}

.smmp-calc button:focus-visible {
	outline: 2px solid var(--smmp-accent);
	outline-offset: 2px;
}

/* Summary */

.smmp-calc__summary {
	grid-area: summary;
	padding: 26px 26px 28px;
	background: var(--smmp-card-bg);
	border: 1px solid var(--smmp-card-border);
	border-top: 2px solid var(--smmp-accent);
	align-self: center;
}

.smmp .smmp-calc__total-label {
	color: var(--smmp-muted);
	font-size: 13px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.smmp .smmp-calc__total {
	margin: 6px 0 14px;
	color: var(--smmp-accent-text);
	font-size: clamp(2rem, 3vw, 2.5rem);
	font-weight: 400;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.smmp .smmp-calc__note {
	color: var(--smmp-muted);
	font-size: 13px;
	line-height: 1.5;
}

.smmp-calc__cta.smmp__button {
	display: block;
	margin-top: 22px;
	text-align: center;
}

/* Scrap mode: wider first column for labels like "Sterling Silver (925)". */
@container smmp-calc-rows (min-width: 641px) {
	.smmp-calc--scrap .smmp-calc__labels,
	.smmp-calc--scrap .smmp-calc__row {
		grid-template-columns: minmax(170px, 1.7fr) minmax(70px, 0.7fr) minmax(100px, 0.9fr) minmax(100px, 1fr) minmax(100px, 1fr) 40px;
	}
}

/* Narrow row area: each item becomes a small card. */

@container smmp-calc-rows (max-width: 640px) {
	.smmp-calc__labels {
		display: none;
	}

	.smmp-calc__row {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
		grid-template-areas:
			"metal metal remove"
			"qty unit unit"
			"rate value value";
		gap: 10px;
		padding: 16px 0;
	}

	.smmp-calc__cell--metal { grid-area: metal; }
	.smmp-calc__cell--qty { grid-area: qty; }
	.smmp-calc__cell--unit { grid-area: unit; }
	.smmp-calc__cell--rate { grid-area: rate; }
	.smmp-calc__cell--value { grid-area: value; }
	.smmp-calc__cell--remove { grid-area: remove; justify-self: end; }

	.smmp-calc__mlabel {
		display: block;
		color: var(--smmp-muted);
		font-size: 12px;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		margin-bottom: 2px;
	}
}

/* Whole calculator narrow: summary moves under the rows. */

@container (max-width: 860px) {
	.smmp-calc__inner {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"head"
			"main"
			"summary";
	}

	.smmp-calc__summary {
		position: static;
	}
}

/* ------------------------------------------------------------------
 * Compact band on phones: one tappable summary line, full list on demand.
 * [sm_metal_prices layout="compact"] (add mobile="full" to always show the list)
 * --------------------------------------------------------------- */

.smmp .smmp__toggle {
	display: none;
}

@container (max-width: 600px) {
	.smmp--collapsible .smmp__inner {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.smmp--collapsible .smmp__topbar {
		flex-wrap: nowrap;
		gap: 12px;
		margin-bottom: 0;
	}

	.smmp--collapsible.smmp--open .smmp__topbar {
		margin-bottom: 4px;
	}

	.smmp--collapsible .smmp__status {
		flex: 0 0 auto;
	}

	/* Time only shows once the list is open. */
	.smmp--collapsible:not(.smmp--open) .smmp__updated {
		display: none;
	}

	.smmp--collapsible:not(.smmp--open) .smmp__items {
		display: none;
	}

	.smmp--collapsible .smmp__toplink {
		display: none;
	}

	.smmp .smmp__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		flex: 1 1 auto;
		min-width: 0;
		min-height: 40px;
		margin: 0;
		padding: 0;
		border: 0;
		background: none;
		color: var(--smmp-text);
		font: inherit;
		font-size: 13px;
		text-align: left;
		cursor: pointer;
	}

	.smmp .smmp__toggle:focus-visible {
		outline: 2px solid var(--smmp-accent-text);
		outline-offset: 2px;
	}

	.smmp__sum {
		display: flex;
		flex-wrap: wrap;
		gap: 2px 12px;
		min-width: 0;
		font-variant-numeric: tabular-nums;
	}

	.smmp__sum-item {
		white-space: nowrap;
	}

	.smmp__sum-name {
		color: var(--smmp-muted);
		text-transform: uppercase;
		letter-spacing: 0.08em;
		font-size: 11px;
	}

	.smmp__sum-unit {
		color: var(--smmp-muted);
		font-size: 11px;
	}

	.smmp--open .smmp__sum {
		visibility: hidden;
	}

	.smmp__toggle-label {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		flex: 0 0 auto;
		color: var(--smmp-accent-text);
		font-size: 11px;
		letter-spacing: 0.1em;
		text-transform: uppercase;
	}

	.smmp__toggle-less,
	.smmp--open .smmp__toggle-more {
		display: none;
	}

	.smmp--open .smmp__toggle-less {
		display: inline;
	}

	.smmp__chev {
		width: 7px;
		height: 7px;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		transform: translateY(-2px) rotate(45deg);
		transition: transform 0.2s ease;
	}

	.smmp--open .smmp__chev {
		transform: translateY(1px) rotate(-135deg);
	}
}

/* ------------------------------------------------------------------
 * Price history chart: [sm_metal_chart]
 * --------------------------------------------------------------- */

.smmp-chart.smmp--light {
	--smmp-bg: #f7f4ef;
}

.smmp-chart__inner {
	max-width: var(--smmp-max);
	margin: 0 auto;
	padding: clamp(28px, 4vw, 52px) var(--smmp-pad-x);
}

.smmp-chart__head {
	margin-bottom: 18px;
}

.smmp .smmp-chart__heading {
	color: var(--smmp-text);
	font-family: inherit;
	font-size: clamp(1.5rem, 2.2vw, 2rem);
	font-weight: 400;
	line-height: 1.2;
	margin-bottom: 6px;
}

.smmp .smmp-chart__text {
	color: var(--smmp-soft);
	font-size: 0.95rem;
}

.smmp-chart__frame {
	position: relative;
	border-top: 1px solid var(--smmp-rule);
	padding-top: 12px;
}

.smmp-chart .tradingview-widget-container,
.smmp-chart .tradingview-widget-container iframe {
	width: 100% !important;
	border: 0;
}

/* TradingView's attribution line: kept (their terms require it), restyled to fit. */
.smmp-chart .tradingview-widget-copyright {
	text-align: left !important;
}

.smmp-chart .tradingview-widget-copyright,
.smmp-chart .tradingview-widget-copyright a {
	color: var(--smmp-muted) !important;
	font-size: 12px !important;
	text-decoration: none;
}

.smmp .smmp-chart__credit {
	margin-top: 10px;
	color: var(--smmp-muted);
	font-size: 12px;
}

.smmp .smmp-chart__credit a {
	color: var(--smmp-accent-text);
	text-decoration: none;
}

.smmp .smmp-chart__credit a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.smmp__dot,
	.smmp-flash--up,
	.smmp-flash--down {
		animation: none;
	}
}
