/* Sunrise Trade Portal. Uses the Sunrise theme tokens when present, with neutral fallbacks for any theme. */

.stp,
.stp-save,
.stp-banner,
.stp-csv {
	--stp-primary: var(--color-primary, #0f2a43);
	--stp-accent: var(--color-accent, #f28c00);
	--stp-on-accent: var(--on-accent, #0b1b2b);
	--stp-border: var(--color-border, #dde2e8);
	--stp-muted: var(--color-muted, #4f5a67);
	--stp-surface: var(--color-surface, #f7f8fa);
	--stp-radius: var(--radius-md, 4px);
	--stp-mono: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}

.stp-lead {
	max-width: 62ch;
	margin: 0 0 24px;
	color: var(--stp-muted);
	font-size: 1.0625rem;
}

.stp-h {
	margin: 32px 0 12px;
	color: var(--stp-primary);
	font-size: 1.25rem;
	letter-spacing: -0.02em;
}

.stp-muted {
	color: var(--stp-muted);
}

.stp-small {
	margin-top: 24px;
	font-size: 0.875rem;
}

/* Banner on account pages. */
.stp-banner {
	margin: 0 0 24px;
	padding: 12px 16px;
	border-left: 3px solid var(--stp-accent);
	border-radius: var(--stp-radius);
	background: var(--stp-surface);
	font-weight: 500;
}

.stp-banner--ok {
	border-left-color: var(--stp-primary);
}

.stp-banner a {
	font-weight: 600;
}

/* Notices. */
.stp-notice {
	margin: 0 0 24px;
	padding: 12px 16px;
	border-left: 3px solid;
	border-radius: var(--stp-radius);
	background: #fff;
	font-weight: 600;
}

.stp-notice--success {
	border-color: var(--color-success, #1e8e3e);
	color: var(--color-success, #1e8e3e);
}

.stp-notice--error {
	border-color: var(--color-error, #c62828);
	color: var(--color-error, #c62828);
}

/* Forms: labels above inputs. */
.stp-form {
	max-width: 760px;
}

.stp-fieldset {
	margin: 0 0 24px;
	padding: 0;
	border: 0;
}

.stp-fieldset legend {
	margin-bottom: 12px;
	padding: 0;
	color: var(--stp-primary);
	font-size: 1.125rem;
	font-weight: 700;
}

.stp-grid {
	display: grid;
	gap: 16px 24px;
}

@media (min-width: 640px) {
	.stp-grid {
		grid-template-columns: 1fr 1fr;
	}

	.stp-field--wide,
	.stp-grid > .stp-actions {
		grid-column: 1 / -1;
	}
}

.stp-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

.stp-field label,
.stp-label {
	font-size: 0.875rem;
	font-weight: 600;
}

.stp-req {
	color: var(--color-error, #c62828);
}

.stp-field input,
.stp-field select,
.stp-field textarea,
.stp-table input[type="number"] {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid var(--grey-400, #9aa4b0);
	border-radius: var(--stp-radius);
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: 16px;
}

.stp-field textarea {
	min-height: 0;
}

.stp-help {
	color: var(--stp-muted);
	font-size: 0.8125rem;
}

.stp-static {
	min-height: 44px;
	padding: 10px 0;
}

.stp-check {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0 0 24px;
	font-size: 0.9375rem;
}

.stp-check input {
	width: 20px;
	height: 20px;
	margin-top: 2px;
	flex: none;
}

.stp-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	margin: 0;
}

.stp-btn {
	min-height: 44px;
}

/* Fallback button look when the active theme has no .btn styles. */
.stp-btn:not([class*="btn--"]),
.stp .btn--accent {
	padding: 0 20px;
	border: 2px solid var(--stp-accent);
	border-radius: var(--stp-radius);
	background: var(--stp-accent);
	color: var(--stp-on-accent);
	font-weight: 600;
	cursor: pointer;
}

.stp .stp-btn--ghost,
.stp-save .stp-btn--ghost {
	padding: 0 20px;
	border: 2px solid var(--stp-primary);
	border-radius: var(--stp-radius);
	background: transparent;
	color: var(--stp-primary);
	font-weight: 600;
	cursor: pointer;
}

.stp-link,
.stp-link-btn {
	padding: 0;
	border: 0;
	background: none;
	color: var(--stp-primary);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.stp-link-btn {
	color: var(--color-error, #c62828);
	font-size: 0.875rem;
}

.stp-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Empty states. */
.stp-empty {
	padding: 32px 24px;
	border: 1px dashed var(--grey-300, #c5ccd5);
	border-radius: var(--stp-radius);
	text-align: left;
}

.stp-empty p {
	margin: 0 0 8px;
}

.stp-empty p:last-child {
	margin-bottom: 0;
}

/* Tables. */
.stp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.stp-table th {
	padding: 10px 12px;
	border-bottom: 2px solid var(--stp-primary);
	color: var(--stp-muted);
	font-size: 0.8125rem;
	font-weight: 600;
	text-align: left;
}

.stp-table td {
	padding: 12px;
	border-bottom: 1px solid var(--stp-border);
	vertical-align: middle;
}

.stp-col-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.stp-col-pick {
	width: 40px;
}

.stp-col-pick input {
	width: 20px;
	height: 20px;
}

.stp-col-qty {
	width: 96px;
}

.stp-table__actions,
.stp-col-remove {
	text-align: right;
	white-space: nowrap;
}

.stp-part-name {
	color: var(--stp-primary);
	font-weight: 600;
	text-decoration: none;
}

.stp-part-name:hover {
	text-decoration: underline;
}

.stp-part-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-top: 2px;
	color: var(--stp-muted);
	font-size: 0.8125rem;
}

.stp-sku {
	font-family: var(--stp-mono);
	font-variant-numeric: tabular-nums;
}

.stp-out {
	color: var(--color-error, #c62828);
}

.is-unavailable .stp-part-name {
	color: var(--stp-muted);
}

.stp-parts__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 16px;
}

.stp-list {
	margin-bottom: 40px;
}

.stp-list__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 16px;
	margin-bottom: 8px;
}

.stp-list__head .stp-h {
	margin: 0;
}

.stp-list__delete {
	margin-left: auto;
}

.stp-pager {
	display: flex;
	justify-content: space-between;
	margin-top: 16px;
}

/* Phone: tables become stacked rows. */
@media (max-width: 639px) {
	.stp-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}

	.stp-table tr {
		display: grid;
		grid-template-columns: auto 1fr auto;
		gap: 4px 12px;
		padding: 12px 0;
		border-bottom: 1px solid var(--stp-border);
	}

	.stp-table td {
		padding: 0;
		border: 0;
	}

	.stp-table td[data-label]::before {
		content: attr(data-label) " ";
		color: var(--stp-muted);
		font-size: 0.8125rem;
	}

	.stp-table--parts tr {
		grid-template-columns: 28px 1fr 88px;
	}

	.stp-table--parts td:nth-child(2) {
		grid-column: 2 / 4;
	}

	.stp-table--parts .stp-col-num {
		grid-column: 2;
		text-align: left;
	}

	.stp-table--parts .stp-col-qty {
		grid-column: 3;
		grid-row: 2;
		width: auto;
	}

	.stp-table--parts .stp-col-remove {
		grid-column: 2 / 4;
		text-align: left;
	}

	.stp-table:not(.stp-table--parts) tr {
		grid-template-columns: 1fr auto;
	}

	.stp-parts__actions .stp-btn {
		flex: 1 1 100%;
	}
}

/* Product page: Save to list. */
.stp-save {
	margin-top: 16px;
}

.stp-save summary {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--stp-primary);
	font-weight: 600;
	cursor: pointer;
}

.stp-save__form {
	display: grid;
	gap: 12px;
	max-width: 420px;
	margin-top: 8px;
	padding: 16px;
	border: 1px solid var(--stp-border);
	border-radius: var(--stp-radius);
	background: #fff;
}

.stp-save__form [hidden] {
	display: none;
}

.stp-field--qty input {
	max-width: 120px;
}

/* Quick order CSV upload, added under the Fuse5 quick order box. */
.stp-csv {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	margin: 8px 0;
}

.stp-csv__btn {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 14px;
	border: 2px solid var(--stp-primary);
	border-radius: var(--stp-radius);
	color: var(--stp-primary);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}

.stp-csv__btn:focus-within {
	outline: 3px solid var(--stp-primary);
	outline-offset: 2px;
}

.stp-csv__tpl {
	font-size: 0.875rem;
	font-weight: 600;
}

.stp-csv__note:empty {
	display: none;
}

.stp-csv__note {
	margin: 0 0 8px;
	color: var(--stp-muted);
	font-size: 0.875rem;
}
