/* Spend analyser on the credit card page (templates/components/credit-calculator.twig), after
   the prototype's #v2cx rules in v2-desktop.css, v3-refine.css and v5-credit-fix.css.
   Desktop only, like the prototype. */

.pt-cx-sec { display: none; }

@media (min-width: 1024px) {
	.pt-cx-sec { display: block; }
	.pt-cx-scope { margin: -4px 0 12px; padding: 8px 12px; border-left: 3px solid var(--acc); background: #eef4ff; font-size: 13px; color: #1e3a8a; }
	.pt-cx-preview { margin: -4px 0 12px; padding: 8px 12px; border-left: 3px solid var(--orange); background: #fff7e8; font-size: 12.5px; color: #7a4a00; }

	.pt-cx-type { margin: 0 0 14px; }
	.pt-cx-type label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
	.pt-cx-type div { display: flex; gap: 8px; }
	.pt-cx-type input { flex: 1; min-width: 0; border: 1px solid #c5cdd9; border-radius: 4px; padding: 8px 10px; font: 14px "Noto Sans Thai", Arial, sans-serif; color: var(--ink); }
	.pt-cx-type input:focus { outline: 0; border-color: var(--acc); box-shadow: 0 0 0 2px #dbe6ff; }
	.pt-cx-type button { border: 0; border-radius: 4px; padding: 0 18px; background: var(--ink); color: #fff; font-weight: 700; cursor: pointer; }
	.pt-cx-parsed { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; font-size: 12px; color: var(--mut); }

	.pt-cx-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
	.pt-cx-prof, .pt-cx-pref { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
	.pt-cx-prof { margin-bottom: 10px; }
	.pt-cx-chip { height: 32px; padding: 0 12px; border: 1px solid #c5cdd9; border-radius: 4px; background: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; }
	.pt-cx-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
	.pt-cx-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 92px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
	.pt-cx-row input[type=range] { width: 100%; accent-color: var(--acc); }
	.pt-cx-row input[type=number] { width: 100%; border: 1px solid #d0d7e2; border-radius: 4px; padding: 5px 8px; font: 13px "Noto Sans Thai", Arial, sans-serif; text-align: right; background: #fff; }
	.pt-cx-total { margin: 14px 0 12px; padding-top: 12px; border-top: 1px solid #eef1f6; font-size: 13.5px; font-weight: 800; }
	.pt-cx-pref > span { margin-right: 6px; font-size: 12.5px; font-weight: 700; color: #3b4f73; }

	.pt-cx-win { border: 2px solid #12b76a; border-radius: 8px; padding: 12px 14px; background: #fff; }
	.pt-cx-win > small, .pt-cx-pair > small { font-size: 12px; font-weight: 800; color: #05603a; }
	.pt-cx-wcard { display: flex; gap: 12px; align-items: center; margin: 6px 0; }
	.pt-cx-wcard .pt-cc-art { width: 76px; height: 48px; flex: none; }
	.pt-cx-wcard b { display: block; font-size: 16px; }
	.pt-cx-wcard a:hover b { text-decoration: underline; }
	.pt-cx-wcard span { font-size: 14px; font-weight: 700; color: #05603a; }
	.pt-cx-wcard em { display: block; font-style: normal; font-size: 12px; font-weight: 600; color: var(--mut); }
	.pt-cx-why { margin: 8px 0 0; padding: 0 0 0 18px; list-style: disc; display: grid; gap: 3px; }
	.pt-cx-why li { font-size: 12.5px; line-height: 1.5; color: #344054; }
	.pt-cx-why li::marker { color: #12b76a; }
	.pt-cx-chk { margin: 8px 0 0; font-size: 11.5px; color: var(--mut); }
	.pt-cx-pair { margin-top: 10px; border: 1px dashed var(--acc); border-radius: 8px; padding: 10px 14px; background: #fff; font-size: 13px; }
	.pt-cx-pair > small { color: var(--acc); }
	.pt-cx-pair > b { display: block; margin: 2px 0; }
	.pt-cx-pair > span { color: var(--acc); font-weight: 700; }
	.pt-cx-pair ul { margin: 6px 0 0; padding-left: 18px; list-style: disc; font-size: 12.5px; color: #344054; }
	.pt-cx-pair li { padding: 2px 0; }
	.pt-cx-pair li::marker { color: var(--acc); }
	.pt-cx-pair li > span::after { content: ":"; }
	.pt-cx-empty { padding: 20px; text-align: center; color: var(--mut); background: #f7f8fa; border-radius: 8px; }

	.pt-cx-table { margin-top: 20px; border: 1px solid #e3e8ef; border-radius: 8px; overflow-x: auto; }
	.pt-cx-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
	.pt-cx-table th { padding: 9px 8px; background: var(--ink); color: #fff; font-weight: 700; text-align: left; white-space: nowrap; vertical-align: bottom; line-height: 1.3; }
	.pt-cx-table th small { display: block; margin-top: 2px; font-weight: 500; font-size: 11px; color: #c7d2e6; }
	.pt-cx-table td { padding: 9px 8px; border-top: 1px solid #eef2f6; white-space: nowrap; vertical-align: middle; }
	.pt-cx-table .num { text-align: right; font-variant-numeric: tabular-nums; }
	.pt-cx-table td.card { position: relative; padding-left: 40px; min-width: 200px; white-space: normal; }
	.pt-cx-table td.card b { display: block; line-height: 1.35; }
	.pt-cx-table td.card a:hover b { text-decoration: underline; }
	.pt-cx-table td.card small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--mut); }
	.pt-cx-table td.card small.pt-cx-bonus { color: #7a4a00; }
	.pt-cx-rk { position: absolute; left: 12px; top: 12px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #eef2f6; font-size: 11px; font-weight: 800; }
	.pt-cx-table tr.top td { background: #f0fdf4; }
	.pt-cx-table tr.top .pt-cx-rk { background: #12b76a; color: #fff; }
	.pt-cx-table td.best { background: #ecfdf3; color: #05603a; font-weight: 800; }
	.pt-cx-table tr.top td.best { background: #d1fadf; }
	.pt-cx-table td.net { position: relative; min-width: 84px; padding-bottom: 14px; }
	.pt-cx-table td.net b { position: relative; z-index: 1; }
	.pt-cx-table td.net i { position: absolute; right: 10px; bottom: 6px; max-width: calc(100% - 20px); height: 4px; border-radius: 2px; background: #12b76a; opacity: .6; }
	.pt-cx-foot { margin: 0; padding: 8px 12px; border-top: 1px solid #eef2f6; font-size: 11.5px; color: var(--mut); }
	.pt-cx-note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--mut); }
}

/* Analyser table, readable version (6 Nov): one update line for the whole table, a short name cell with the card art
   and a reward chip, bonus / exclusion chips that open a detail row, sticky first column and header, 10 rows then
   "see more"; below 1180px the table becomes a card list. */
@media (min-width: 1024px) {
	.pt-cx-upd { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 12.5px; color: #3b4f73; }
	.pt-cx-upd b { font-weight: 800; color: #00184a; }
	.pt-cx-table { position: relative; }
	.pt-cx-table table { font-size: 13px; }
	.pt-cx-table thead th { position: sticky; top: 0; z-index: 3; }
	.pt-cx-table th { padding: 8px 7px; }
	.pt-cx-table td { padding: 8px 7px; white-space: nowrap; }
	.pt-cx-table td.card { position: sticky; left: 0; z-index: 2; min-width: 224px; max-width: 280px; padding: 8px 8px 8px 38px; background: #fff; box-shadow: 6px 0 8px -6px rgba(0, 24, 74, .18); }
	.pt-cx-table th.card { position: sticky; left: 0; z-index: 4; }
	.pt-cx-table tr.top td.card { background: #f0fdf4; }
	.pt-cx-rk { top: 50%; margin-top: -11px; }
	.pt-cx-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
	.pt-cx-name .pt-cc-art { flex: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 26px; border: 1px solid #e3e8f0; border-radius: 4px; background: #fff; overflow: hidden; box-sizing: border-box; }
	.pt-cx-name .pt-cc-art img { width: 100%; height: 100%; object-fit: contain; padding: 2px; box-sizing: border-box; }
	.pt-cx-name .pt-cc-art b { font-size: 9px; }
	.pt-cx-name > span { display: grid; gap: 2px; min-width: 0; }
	.pt-cx-name b { font-size: 14px; font-weight: 800; line-height: 1.25; color: #00184a; white-space: normal; }
	.pt-cx-name a:hover b { text-decoration: underline; }
	.pt-cx-tags { display: flex; flex-wrap: wrap; gap: 4px; }
	.pt-cx-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; line-height: 1; white-space: nowrap; }
	.pt-cx-tag.rw-cashback { background: #e6f6ee; color: #0a7a4a; } .pt-cx-tag.rw-points { background: #e8f0ff; color: #1d4ed8; } .pt-cx-tag.rw-miles { background: #f1e9ff; color: #6d28d9; } .pt-cx-tag.rw-coins { background: #fff3e0; color: #b45309; }
	.pt-cx-tag.upd { background: #f1f4f9; color: #5b6b85; font-weight: 700; }
	button.pt-cx-tag { border: 0; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 800; }
	.pt-cx-tag.bonus { background: #fff3e0; color: #b45309; } .pt-cx-tag.none { background: #eef1f5; color: #5b6b85; }
	button.pt-cx-tag[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px currentColor; }
	.pt-cx-table tr.pt-cx-det td { padding: 6px 12px 10px 40px; background: #fafbfd; white-space: normal; border-top: 0; }
	.pt-cx-table tr.pt-cx-det td.card { box-shadow: none; }
	.pt-cx-det ul { margin: 0; padding: 0 0 0 16px; font-size: 12px; line-height: 1.5; color: #344054; columns: 2; column-gap: 24px; }
	.pt-cx-det li { break-inside: avoid; }
	.pt-cx-det b { font-weight: 800; color: #00184a; }
	.pt-cx-table tr.pt-cx-hide, .pt-cx-table tr.pt-cx-det[hidden] { display: none; }
	.pt-cx-more { display: block; width: 100%; padding: 10px; border: 0; border-top: 1px solid #eef2f6; background: #fff; font: 700 13px "Noto Sans Thai", Arial, sans-serif; color: #1d4ed8; cursor: pointer; }
	.pt-cx-more:hover { background: #f5f8ff; }
	.pt-cx-cards { display: none; }
}
@media (min-width: 1024px) and (max-width: 1179px) {
	.pt-cx-table table, .pt-cx-table .pt-cx-more { display: none; }
	.pt-cx-table { border: 0; overflow: visible; }
	.pt-cx-cards { display: grid; gap: 10px; }
	.pt-cx-card { position: relative; display: grid; gap: 8px; padding: 12px 14px 12px 44px; border: 1px solid #e3e8ef; border-radius: 10px; background: #fff; }
	.pt-cx-card.top { border-color: #12b76a; background: #f6fef9; }
	.pt-cx-card .pt-cx-rk { left: 12px; top: 14px; margin: 0; }
	.pt-cx-card-hd { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
	.pt-cx-card-net { text-align: right; }
	.pt-cx-card-net b { display: block; font-size: 18px; font-weight: 900; color: #00184a; white-space: nowrap; }
	.pt-cx-card-net small { display: block; font-size: 11px; color: var(--mut); }
	.pt-cx-card-fee { font-size: 12px; color: #3b4f73; }
	.pt-cx-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
	.pt-cx-card-grid div { padding: 6px 8px; border-radius: 6px; background: #f6f8fb; font-size: 11px; color: var(--mut); }
	.pt-cx-card-grid div.best { background: #ecfdf3; color: #05603a; }
	.pt-cx-card-grid b { display: block; font-size: 13px; font-weight: 800; color: #00184a; font-variant-numeric: tabular-nums; }
	.pt-cx-card .pt-cx-det-box { margin: 0; padding: 8px 10px; border-radius: 6px; background: #fafbfd; }
	.pt-cx-card .pt-cx-det-box ul { columns: 1; }
	.pt-cx-card.pt-cx-hide { display: none; }
	.pt-cx-cards .pt-cx-more { display: block; border: 1px solid #e3e8ef; border-radius: 10px; }
}

/* 11 Nov 2026: the comparison table explains itself (user: "ยังงงว่าอ่านตารางยังไง") — a how-to-read line, "/ปี" on every
   amount and the share of that category's spend under it. Desktop table only; the phone cards are unchanged. */
.pt-cx-how { display: none; }
@media (min-width: 1024px) {
	.pt-cx-how { display: block; margin: 0 0 10px; padding: 9px 12px; border-radius: 10px; background: #f3f6fb; font-size: 13px; line-height: 1.55; color: #3b4f73; }
	.pt-cx-how b { font-weight: 700; color: #00184a; }
	#pt-cx-table tr.pt-cx-grp th { padding: 7px 8px 5px; border-bottom: 1px solid rgba(255, 255, 255, .16); font-size: 11.5px; font-weight: 600; text-align: center; color: #c7d2e6; }
	#pt-cx-table tr.pt-cx-grp th + th { border-left: 1px solid rgba(255, 255, 255, .16); }
	#pt-cx-table td.num .pt-cx-share { display: block; margin-top: 1px; font-style: normal; font-size: 11.5px; line-height: 1.3; font-weight: 500; color: #6b7a90; white-space: nowrap; }
	#pt-cx-table td.num.best .pt-cx-share { color: #2c7a52; }
}
