/**
 * Scoped to Support Candy ticket thread email HTML only.
 * Neutralizes newsletter grey shells, table grids, and tracking pixels.
 */

.wpsc-it-thread-section-container .thread-text,
.wpsc-it-body-item .thread-text,
.wpsc-thread .thread-text {
	background: #fff;
	color: #1d2327;
	line-height: 1.55;
	font-size: 14px;
	overflow-x: auto;
}

/* Keep original newsletter/table formatting; only make it responsive */
.wpsc-it-thread-section-container .thread-text table,
.wpsc-it-body-item .thread-text table,
.wpsc-thread .thread-text table {
	width: auto !important;
	max-width: 100% !important;
	border-collapse: collapse;
	margin: 0.5em auto;
}

/* Respect email-authored table widths but never overflow thread area */
.wpsc-it-thread-section-container .thread-text table[width],
.wpsc-it-body-item .thread-text table[width],
.wpsc-thread .thread-text table[width] {
	max-width: 100% !important;
}

/*
 * Flatten heavy table chrome but keep author-defined backgrounds.
 * This preserves dark blocks behind light text from original emails.
 */
.wpsc-it-thread-section-container .thread-text table,
.wpsc-it-thread-section-container .thread-text td,
.wpsc-it-thread-section-container .thread-text th,
.wpsc-it-body-item .thread-text table,
.wpsc-it-body-item .thread-text td,
.wpsc-it-body-item .thread-text th,
.wpsc-thread .thread-text table,
.wpsc-thread .thread-text td,
.wpsc-thread .thread-text th {
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
}

/*
 * Remove common light-grey shell overlays that appear in ticket threads
 * while keeping intentional dark/brand backgrounds from original emails.
 */
.wpsc-it-thread-section-container .thread-text table[bgcolor="#f2f2f2" i],
.wpsc-it-thread-section-container .thread-text td[bgcolor="#f2f2f2" i],
.wpsc-it-thread-section-container .thread-text th[bgcolor="#f2f2f2" i],
.wpsc-it-thread-section-container .thread-text table[bgcolor="#f5f5f5" i],
.wpsc-it-thread-section-container .thread-text td[bgcolor="#f5f5f5" i],
.wpsc-it-thread-section-container .thread-text th[bgcolor="#f5f5f5" i],
.wpsc-it-thread-section-container .thread-text table[bgcolor="#eeeeee" i],
.wpsc-it-thread-section-container .thread-text td[bgcolor="#eeeeee" i],
.wpsc-it-thread-section-container .thread-text th[bgcolor="#eeeeee" i],
.wpsc-it-thread-section-container .thread-text table[bgcolor="#eaeaea" i],
.wpsc-it-thread-section-container .thread-text td[bgcolor="#eaeaea" i],
.wpsc-it-thread-section-container .thread-text th[bgcolor="#eaeaea" i],
.wpsc-it-body-item .thread-text table[bgcolor="#f2f2f2" i],
.wpsc-it-body-item .thread-text td[bgcolor="#f2f2f2" i],
.wpsc-it-body-item .thread-text th[bgcolor="#f2f2f2" i],
.wpsc-it-body-item .thread-text table[bgcolor="#f5f5f5" i],
.wpsc-it-body-item .thread-text td[bgcolor="#f5f5f5" i],
.wpsc-it-body-item .thread-text th[bgcolor="#f5f5f5" i],
.wpsc-it-body-item .thread-text table[bgcolor="#eeeeee" i],
.wpsc-it-body-item .thread-text td[bgcolor="#eeeeee" i],
.wpsc-it-body-item .thread-text th[bgcolor="#eeeeee" i],
.wpsc-it-body-item .thread-text table[bgcolor="#eaeaea" i],
.wpsc-it-body-item .thread-text td[bgcolor="#eaeaea" i],
.wpsc-it-body-item .thread-text th[bgcolor="#eaeaea" i],
.wpsc-thread .thread-text table[bgcolor="#f2f2f2" i],
.wpsc-thread .thread-text td[bgcolor="#f2f2f2" i],
.wpsc-thread .thread-text th[bgcolor="#f2f2f2" i],
.wpsc-thread .thread-text table[bgcolor="#f5f5f5" i],
.wpsc-thread .thread-text td[bgcolor="#f5f5f5" i],
.wpsc-thread .thread-text th[bgcolor="#f5f5f5" i],
.wpsc-thread .thread-text table[bgcolor="#eeeeee" i],
.wpsc-thread .thread-text td[bgcolor="#eeeeee" i],
.wpsc-thread .thread-text th[bgcolor="#eeeeee" i],
.wpsc-thread .thread-text table[bgcolor="#eaeaea" i],
.wpsc-thread .thread-text td[bgcolor="#eaeaea" i],
.wpsc-thread .thread-text th[bgcolor="#eaeaea" i] {
	background: transparent !important;
	background-color: transparent !important;
}

/* Nested tables: tighter */
.wpsc-it-thread-section-container .thread-text table table,
.wpsc-it-body-item .thread-text table table,
.wpsc-thread .thread-text table table {
	margin: 0.25em 0;
}

/* Shopee / Gmail often wrap copy in <code> — reset to normal text */
.wpsc-it-thread-section-container .thread-text code,
.wpsc-it-body-item .thread-text code,
.wpsc-thread .thread-text code {
	display: inline;
	background: transparent !important;
	border: none !important;
	padding: 0 !important;
	margin: 0 !important;
	font-family: inherit !important;
	font-size: inherit !important;
	color: inherit !important;
	white-space: normal;
	word-break: break-word;
}

/* Primary action buttons from emails: keep readable, soften box */
.wpsc-it-thread-section-container .thread-text a[style*="background-color"],
.wpsc-it-body-item .thread-text a[style*="background-color"],
.wpsc-thread .thread-text a[style*="background-color"] {
	display: inline-block;
	margin: 0.5em 0;
}

/* Images scale; hide tracking pixels */
.wpsc-it-thread-section-container .thread-text img,
.wpsc-it-body-item .thread-text img,
.wpsc-thread .thread-text img {
	/* Prevent oversized banners/signatures from dominating the thread body */
	max-width: min(100%, 460px) !important;
	max-height: 420px !important;
	width: auto !important;
	height: auto !important;
}

/* Keep favicon/emoji/icon-like inline images from being blown up */
.wpsc-it-thread-section-container .thread-text img[src*="favicon" i],
.wpsc-it-thread-section-container .thread-text img[src*="emoji" i],
.wpsc-it-thread-section-container .thread-text img[src*="icon" i],
.wpsc-it-body-item .thread-text img[src*="favicon" i],
.wpsc-it-body-item .thread-text img[src*="emoji" i],
.wpsc-it-body-item .thread-text img[src*="icon" i],
.wpsc-thread .thread-text img[src*="favicon" i],
.wpsc-thread .thread-text img[src*="emoji" i],
.wpsc-thread .thread-text img[src*="icon" i] {
	max-width: 20px !important;
	max-height: 20px !important;
	vertical-align: text-bottom;
}

/* Keep common email cards centered in thread area */
.wpsc-it-thread-section-container .thread-text > table,
.wpsc-it-body-item .thread-text > table,
.wpsc-thread .thread-text > table {
	margin-left: auto;
	margin-right: auto;
}

.wpsc-it-thread-section-container .thread-text img[width="1"],
.wpsc-it-thread-section-container .thread-text img[height="1"],
.wpsc-it-body-item .thread-text img[width="1"],
.wpsc-it-body-item .thread-text img[height="1"],
.wpsc-thread .thread-text img[width="1"],
.wpsc-thread .thread-text img[height="1"] {
	display: none !important;
	visibility: hidden !important;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
}

/* Spacer-only rows (single &nbsp;) — shrink */
.wpsc-it-thread-section-container .thread-text td:empty,
.wpsc-it-body-item .thread-text td:empty,
.wpsc-thread .thread-text td:empty {
	padding: 0 !important;
	height: 0 !important;
	line-height: 0 !important;
	font-size: 0 !important;
}
