/* TMP purchasing page (/purchasing/) – brand colours from the CI (22 Nov 2026). */
:root {
	--navy: #1b5070;
	--navy-dark: #123a52;
	--ink: #0f2a3a;
	--muted: #4a5d6a;
	--line: #d6e3e8;
	--tint: #e8f5f8;
	--cream: #fdfaf2;
	--blue: #9fd7e1;
	--yellow: #f2bb45;
	--green: #71994d;
	--red: #db5760;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif; }
a { color: var(--navy); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }

.tp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 20px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.tp-top a { color: #fff; }
.tp-brand { font-weight: 700; text-decoration: none; font-size: 16px; }
.tp-brand span { font-weight: 400; opacity: .75; font-size: 13px; margin-left: 4px; }
.tp-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tp-tabs a { text-decoration: none; padding: 6px 12px; border-radius: 6px; opacity: .85; }
.tp-tabs a.on, .tp-tabs a:hover { background: var(--navy-dark); opacity: 1; }
.tp-user { margin-left: auto; font-size: 13px; opacity: .9; }
.tp-user a { display: inline-block; padding: 5px 2px; } /* 0.27.2: 24 px tap height on phones */

.tp-main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 90px; }
.tp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 4px 0 14px; }
.tp-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.tp-narrow { max-width: 420px; margin: 40px auto; }
.tp-muted { color: var(--muted); font-size: 13px; }
.tp-nowrap { white-space: nowrap; }
.tp-r { text-align: right; }
.tp-scroll { overflow-x: auto; }

.tp-btn { display: inline-block; border: 1px solid var(--navy); background: #fff; color: var(--navy); border-radius: 7px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.tp-btn:hover { background: var(--tint); }
.tp-primary { background: var(--navy); color: #fff; }
.tp-primary:hover { background: var(--navy-dark); }
.tp-small { padding: 4px 10px; font-size: 13px; }

.tp-flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.tp-flash ul { margin: 6px 0 0 18px; padding: 0; }
.tp-success { background: #eef6e8; border-color: var(--green); }
.tp-info { background: var(--tint); border-color: var(--blue); }
.tp-warning { background: #fdf3df; border-color: var(--yellow); }
.tp-error { background: #fbebeb; border-color: var(--red); }

input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input:not([type]), select, textarea { width: 100%; font: inherit; padding: 7px 9px; border: 1px solid #c3d5dc; border-radius: 6px; background: #fff; color: var(--ink); }
input[readonly] { background: #f1f5f7; color: var(--muted); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--navy); }
label { display: block; }
.tp-login label { margin-bottom: 12px; }
.tp-login .tp-btn { width: 100%; margin: 6px 0 10px; }
.tp-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tp-check input, .tp-chip input, .tp-segment input { width: auto; }
.tp-big { font-weight: 700; font-size: 16px; }

.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 12px 14px; }
.tp-grid2 { grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.tp-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-note { background: var(--tint); border-left: 3px solid var(--navy); border-radius: 6px; padding: 8px 12px; font-size: 14px; margin: 0 0 12px; }
.tp-row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; align-items: end; margin-bottom: 10px; }
.tp-row4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.tp-span2 { grid-column: span 2; }
@media (max-width: 560px) { .tp-span2 { grid-column: auto; } }
.tp-field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tp-field small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.tp-req { color: var(--red); }
.tp-has-error input, .tp-has-error select, .tp-has-error textarea, .tp-segment.tp-has-error { border-color: var(--red); outline: 1px solid var(--red); }
.tp-error-text { display: block; color: var(--red); font-style: normal; font-size: 12px; margin-top: 3px; }
.tp-off { opacity: .45; }
.tp-off .tp-req { display: none; }

.tp-segment { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 8px 10px; border-radius: 8px; background: var(--tint); margin-bottom: 12px; }
.tp-segment > span { font-weight: 600; font-size: 13px; }
.tp-segment label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-chip { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; background: #fff; }
.tp-chip:has(input:checked) { background: var(--tint); border-color: var(--navy); }

.tp-margin, .tp-ship-preview, .tp-calc-out { background: var(--tint); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.tp-ship-preview:empty, .tp-calc-out:empty { display: none; }
.tp-ship-preview { margin-top: 12px; }
.tp-ship-preview .tp-warn-text { margin: 8px 0 0; color: #8a5a00; font-size: 13px; }
.tp-ship-preview table, .tp-calc-out table { width: 100%; border-collapse: collapse; }
.tp-ship-preview td, .tp-calc-out td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.tp-ship-preview td small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.tp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tp-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.tp-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: middle; }
.tp-table tr:hover td { background: #f8fbfc; }
.tp-tiers { max-width: 420px; }
.tp-tiers td { padding: 4px; }
.tp-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: #f1f5f7; }
.tp-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tp-filters input[type=search] { flex: 1 1 240px; width: auto; }
.tp-filters select { width: auto; }

.tp-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #eef2f4; color: var(--muted); white-space: nowrap; }
.tp-b-published { background: #e5f4e4; color: #3d6a24; }
.tp-b-hidden { background: #f9ece7; color: #8a4b2c; }
.tp-b-discontinued { background: #fbebeb; color: #9a2c33; }
.tp-b-draft { background: #f0efec; color: var(--muted); }
.tp-b-demo { background: #f9eeda; color: #8a6315; }
.tp-b-alert { background: #fbebeb; color: #9a2c33; }

.tp-images { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; }
.tp-images figure { margin: 0; width: 132px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.tp-images img { width: 132px; height: 132px; object-fit: cover; display: block; }
.tp-images figcaption { padding: 6px; font-size: 12px; }
.tp-images figcaption label { display: flex; gap: 4px; align-items: center; }
.tp-images figcaption input { width: auto; }

.tp-savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 14px; align-items: center; justify-content: center; z-index: 9; box-shadow: 0 -2px 10px rgba(15, 42, 58, .06); }
.tp-actions { margin-top: 12px; }

.tp-rules { min-width: 1180px; }
.tp-rules td { padding: 4px; white-space: nowrap; }
.tp-rules input, .tp-rules select { font-size: 13px; padding: 5px 6px; }
.tp-rules select { width: auto; min-width: 86px; }
.tp-rules .tp-num { width: 70px; display: inline-block; }
.tp-rules .tp-wide { min-width: 220px; }
.tp-rules .tp-price { white-space: nowrap; }
.tp-rules .tp-price select { width: 70px; }
.tp-rule.tp-noprice .tp-price input, .tp-rule:not([data-type=per_kg]) .tp-kg-only > *, .tp-rule:not([data-type=per_kg]) input.tp-kg-only { visibility: hidden; }
.tp-rule.tp-noprice .tp-price select { visibility: hidden; }
.tp-rules .tp-sell { margin-top: 4px; }
.tp-rules .tp-sell small { display: inline-block; min-width: 70px; color: var(--muted); }
.tp-rule.tp-noprice .tp-sell small { visibility: hidden; }
.tp-del { font-size: 12px; color: var(--red); display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.tp-del input { width: auto; }
.tp-gaps { margin-top: 10px; font-size: 13px; color: #8a6315; }
.tp-changes { margin: 0; padding-left: 16px; }
.tp-log td { vertical-align: top; }

/* ---------- 0.13.0: easier product pages ---------- */
.tp-hide, [hidden] { display: none !important; }
.tp-btn-lg { padding: 10px 20px; font-size: 16px; border-radius: 9px; }
.tp-head h1 { font-size: 24px; }

/* Filters + view switch */
.tp-filters { position: sticky; top: 52px; z-index: 5; box-shadow: 0 2px 8px rgba(15, 42, 58, .05); }
.tp-filters input[type=search] { font-size: 16px; padding: 9px 12px; }
.tp-viewswitch { display: inline-flex; margin-left: auto; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tp-viewswitch button { border: 0; background: #fff; padding: 7px 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.tp-viewswitch button.on { background: var(--navy); color: #fff; }
.tp-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Product cards */
.tp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.tp-pcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.tp-pcard:hover { box-shadow: 0 6px 20px rgba(15, 42, 58, .12); transform: translateY(-2px); }
.tp-pcard-img { position: relative; display: block; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--line); }
.tp-pcard-img img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 10px; }
.tp-pcard-status { position: absolute; top: 10px; left: 10px; }
.tp-pcard-demo { position: absolute; top: 10px; right: 10px; }
.tp-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); font-weight: 600; text-align: center; background: repeating-linear-gradient(45deg, #f4f8f9, #f4f8f9 10px, #eef3f5 10px, #eef3f5 20px); text-decoration: none; }
.tp-noimg small { font-weight: 400; font-size: 12px; }
.tp-pcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tp-pcard-name { font-weight: 700; font-size: 15px; line-height: 1.35; text-decoration: none; color: var(--ink); }
.tp-pcard-name:hover { color: var(--navy); text-decoration: underline; }
.tp-pcard-sku { font-size: 12px; color: var(--muted); }
.tp-pcard-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 4px 0 0; }
.tp-pcard-facts div { display: flex; flex-direction: column; }
.tp-pcard-facts dt { font-size: 11px; color: var(--muted); }
.tp-pcard-facts dd { margin: 0; font-weight: 700; font-size: 14px; }
.tp-pcard-channel { font-size: 12px; color: var(--muted); }
.tp-pcard-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tp-pcard-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.tp-pcard-actions .tp-btn { flex: 1; text-align: center; }
.tp-thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; }

/* Edit screen: form + live preview */
.tp-edit { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .tp-edit { grid-template-columns: minmax(0, 1fr); } .tp-edit-side { display: none; } }
.tp-edit-side { align-self: stretch; }
.tp-side-sticky { position: sticky; top: 66px; max-height: calc(100vh - 150px); overflow-y: auto; padding-bottom: 4px; }
.tp-steps { position: sticky; top: 52px; z-index: 6; display: flex; gap: 4px; overflow-x: auto; background: var(--cream); padding: 8px 0 10px; margin-bottom: 4px; }
.tp-steps a { display: flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.tp-steps a i, .tp-step h2 i { font-style: normal; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--tint); color: var(--navy); font-size: 12px; font-weight: 700; }
.tp-steps a.on { border-color: var(--navy); color: var(--navy); }
.tp-steps a.done i { background: var(--green); color: #fff; }
.tp-step { scroll-margin-top: 110px; padding: 20px; }
.tp-step h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 6px; }
.tp-step h2 i { width: 28px; height: 28px; font-size: 14px; background: var(--navy); color: #fff; }
.tp-step-hint { margin: 0 0 14px; }
.tp-step .tp-grid { margin-top: 12px; }
.tp-span-all { grid-column: 1 / -1; }
.tp-field input, .tp-field select, .tp-field textarea { padding: 9px 11px; }
.tp-money input { font-weight: 700; font-size: 16px; }
.tp-big-input input { font-size: 20px; font-weight: 700; max-width: 180px; }
.tp-subbox { margin-top: 16px; padding: 12px 14px; background: #f7fbfc; border: 1px solid var(--line); border-radius: 10px; }
.tp-subbox h3 { margin: 0 0 4px; }
.tp-subbox.tp-off { display: none; }

/* Pills (channel, origin) */
.tp-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 4px; }
.tp-pills label { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; background: #fff; font-weight: 600; font-size: 14px; }
.tp-pills label:has(input:checked) { border-color: var(--navy); background: var(--tint); color: var(--navy-dark); }
.tp-pills input { width: auto; accent-color: var(--navy); }
.tp-pills[data-single] label { cursor: default; }
.tp-pills.tp-has-error { outline: 2px solid var(--red); border-radius: 10px; }

/* Optional fields folded away */
.tp-more { margin-top: 14px; border: 1px dashed #c3d5dc; border-radius: 10px; background: #fbfdfd; }
.tp-more summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--navy); list-style: none; }
.tp-more summary::-webkit-details-marker { display: none; }
.tp-more summary::before { content: '＋ '; }
.tp-more[open] summary::before { content: '－ '; }
.tp-more-body { padding: 0 14px 14px; }
.tp-more-body .tp-grid { margin-top: 0; }

/* Photos */
.tp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 14px; }
.tp-img { position: relative; margin: 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.tp-img-view { display: block; border: 0; padding: 0; background: #fff; cursor: zoom-in; aspect-ratio: 1 / 1; }
.tp-img-view img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 6px; }
.tp-img figcaption { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13px; background: #fafcfd; }
.tp-img figcaption label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tp-img figcaption input { width: auto; accent-color: var(--navy); }
.tp-img-flag, .tp-img-gone { display: none; position: absolute; top: 8px; left: 8px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.tp-img-flag { background: var(--yellow); color: var(--ink); }
.tp-img-gone { background: var(--red); color: #fff; }
.tp-img:has(.tp-img-main input:checked) { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(242, 187, 69, .35); }
.tp-img:has(.tp-img-main input:checked) .tp-img-flag { display: inline-block; }
.tp-img:has(.tp-img-main input:checked) .tp-img-main { visibility: hidden; height: 0; overflow: hidden; }
.tp-img:has(.tp-img-keep input:not(:checked)) { border-color: var(--red); }
.tp-img:has(.tp-img-keep input:not(:checked)) .tp-img-view { opacity: .3; }
.tp-img:has(.tp-img-keep input:not(:checked)) .tp-img-gone { display: inline-block; }
.tp-img:has(.tp-img-keep input:not(:checked)) .tp-img-flag { display: none; }
.tp-img-new .tp-img-tag { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--green); color: #fff; }
.tp-img-remove { border: 0; background: none; color: var(--red); font: inherit; font-size: 13px; text-align: left; padding: 0; cursor: pointer; }
.tp-img-big { color: var(--red); font-size: 12px; font-weight: 600; }
.tp-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1 / 1; min-height: 170px; border: 2px dashed #9fc3cf; border-radius: 12px; background: var(--tint); color: var(--navy); text-align: center; cursor: pointer; padding: 12px; }
.tp-drop b { font-size: 18px; }
.tp-drop span { font-size: 13px; color: var(--muted); }
.tp-drop:hover, .tp-drop.is-over { background: #d9eef3; border-color: var(--navy); }
.tp-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Live preview + checklist */
.tp-preview { padding: 14px; }
.tp-preview-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.tp-preview-img { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0; cursor: zoom-in; overflow: hidden; }
.tp-preview-img img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 8px; }
.tp-preview-thumbs { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.tp-preview-thumbs img { width: 46px; height: 46px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.tp-preview-name { font-weight: 700; font-size: 16px; line-height: 1.3; margin-top: 8px; }
.tp-preview-name:empty::before { content: 'ชื่อสินค้า'; color: #b6c4cb; }
.tp-preview-short { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tp-preview-price { font-size: 22px; font-weight: 800; color: var(--navy-dark); margin-top: 8px; }
.tp-preview-ws { font-size: 13px; background: #fdf3df; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.tp-preview-ws:empty { display: none; }
.tp-preview-ship { font-size: 12px; color: var(--muted); margin-top: 8px; }
.tp-ready { padding: 14px; }
.tp-ready-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tp-progress { height: 8px; background: #eef3f5; border-radius: 999px; overflow: hidden; }
.tp-progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.tp-ready ul { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; }
.tp-ready li { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.tp-ready li::before { content: '○'; color: var(--red); font-weight: 700; width: 16px; text-align: center; }
.tp-ready li.ok { color: var(--muted); }
.tp-ready li.ok::before { content: '✓'; color: var(--green); }
.tp-ready li.opt::before { content: '○'; color: var(--yellow); }
.tp-ready li:hover { color: var(--navy); }

/* Save bar */
.tp-savebar { gap: 16px; }
.tp-missing { font-size: 13px; color: #9a2c33; max-width: 46ch; }
.tp-missing.ok { color: #3d6a24; }
@media (max-width: 700px) { .tp-savenote { display: none; } }

/* Big picture */
.tp-lightbox { border: 0; border-radius: 12px; padding: 12px; max-width: min(92vw, 900px); text-align: center; }
.tp-lightbox::backdrop { background: rgba(15, 42, 58, .7); }
.tp-lightbox img { max-width: 100%; max-height: 78vh; display: block; margin: 0 auto 10px; }
.tp-step .tp-off { display: none; }

.tp-pcard-img { text-decoration: none; }
.tp-stocknow { display: flex; gap: 12px; margin: 4px 0 8px; }
.tp-stocknow div { background: var(--tint); border-radius: 10px; padding: 8px 14px; display: flex; align-items: baseline; gap: 8px; }
.tp-stocknow span { font-size: 13px; color: var(--muted); }
.tp-stocknow b { font-size: 22px; color: var(--navy-dark); }
.tp-stocknow small { font-size: 13px; color: var(--muted); }

/* Phones */
@media (max-width: 800px) {
	.tp-top { position: static; }
	.tp-filters, .tp-steps { top: 0; }
	.tp-filters { position: static; }
	.tp-main { padding: 12px 10px 110px; }
	.tp-step { padding: 14px; }
	.tp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.tp-pcard-body { padding: 10px; }
	.tp-pcard-name { font-size: 14px; }
	.tp-pcard-facts { grid-template-columns: 1fr; }
	.tp-pcard-actions { flex-direction: column; }
	.tp-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.tp-drop { min-height: 0; }
	.tp-savebar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 10px; }
	.tp-missing { max-width: 100%; flex: 1 1 100%; text-align: center; }
	.tp-viewswitch { display: none; }
}

/* Supplier portal (/supplier/) and the purchasing tab "ผู้ผลิต" – 0.14.0 */
.tp-img-flag.tp-show { display: inline-block; }
.tp-img:has(.tp-img-flag.tp-show) { border-color: var(--yellow); }
.tp-img.is-gone .tp-img-flag { display: none !important; }
.tp-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-size: 12px; }
.tp-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: var(--tint); color: var(--navy); font-size: 13px; vertical-align: middle; }
.tp-btn-lg { padding: 11px 20px; font-size: 15px; }
.tp-block { display: flex; width: 100%; justify-content: center; text-align: center; }
.tp-danger { background: #fff; color: #9a2c33; border-color: #e7b7ba; }
.tp-danger:hover { background: #fbebeb; }
.tp-center { text-align: center; }
.tp-mt { margin-top: 12px; }
.tp-kv th { width: 34%; white-space: normal; vertical-align: top; font-size: 13px; border-bottom: 1px solid var(--line); }
.tp-kv td { vertical-align: top; }

.tp-sup-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 10px; }
.tp-sup-pitch h1 { font-size: 30px; line-height: 1.25; margin-bottom: 10px; color: var(--navy); }
.tp-sup-pitch p { font-size: 16px; }
.tp-sup-steps { list-style: none; counter-reset: s; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.tp-sup-steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 56px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.tp-sup-steps li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tp-sup-hero .tp-login { max-width: none; margin: 0; }
.tp-or { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 8px; }
.tp-bigicon { width: 64px; height: 64px; margin: 6px auto 12px; border-radius: 50%; background: #e5f4e4; color: #3d6a24; font-size: 34px; display: flex; align-items: center; justify-content: center; }
.tp-docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.tp-doc { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 2px dashed #9fc3cf; border-radius: 12px; background: var(--tint); font-weight: 600; }
.tp-doc input { font-weight: 400; }
.tp-doc.tp-has-error { border-color: var(--red); background: #fdf1f1; }
.tp-check.tp-has-error { color: #9a2c33; }

.tp-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tp-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.tp-stat b { font-size: 26px; line-height: 1.1; }
.tp-stat span { font-size: 13px; color: var(--muted); }
.tp-stat:hover, .tp-stat.on { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(27, 80, 112, .15); }
.tp-stat-changes b { color: #8a4b2c; }
.tp-stat-live b { color: #3d6a24; }
@media (max-width: 800px) { .tp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tp-sup-hero { grid-template-columns: minmax(0, 1fr); } .tp-sup-pitch h1 { font-size: 24px; } }
.tp-empty-state { text-align: center; padding: 40px 16px; }
.tp-sup-note { font-size: 13px; background: #fdf3df; border-radius: 8px; padding: 6px 9px; }
.tp-pcard-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.tp-s-pending { background: #f9eeda; color: #8a6315; }
.tp-s-changes { background: #f9ece7; color: #8a4b2c; }
.tp-s-approved { background: #e8f5f8; color: var(--navy); }
.tp-s-live { background: #e5f4e4; color: #3d6a24; }
.tp-s-rejected, .tp-s-stop { background: #fbebeb; color: #9a2c33; }
.tp-tier-preview { margin-top: 10px; font-size: 14px; }
.tp-tier-preview:empty { display: none; }
.tp-tier-preview ul { margin: 4px 0 0 18px; padding: 0; }
.tp-tier-preview em { color: #3d6a24; font-style: normal; font-size: 13px; }
.tp-tiers input.tp-bad { border-color: var(--red); background: #fdf1f1; }
.tp-sup-product-line { display: flex; gap: 14px; align-items: center; }
.tp-sup-mini { width: 64px; height: 64px; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.tp-sup-mini img { width: 100%; height: 100%; object-fit: contain; }

.tp-queue { display: flex; flex-direction: column; gap: 8px; }
.tp-qrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: var(--ink); }
.tp-qrow:hover { border-color: var(--navy); }
.tp-qimg { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.tp-qimg img { width: 100%; height: 100%; object-fit: contain; }
.tp-qimg .tp-noimg { font-size: 10px; }
.tp-qmain { display: flex; flex-direction: column; min-width: 0; }
.tp-qmain b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-qmain small, .tp-qdate { color: var(--muted); font-size: 12px; }
@media (max-width: 700px) {
	.tp-qrow { grid-template-columns: 48px minmax(0, 1fr); row-gap: 6px; }
	.tp-qrow .tp-qimg { width: 48px; height: 48px; grid-row: span 2; align-self: start; }
	.tp-qrow .tp-badge { grid-column: 2; justify-self: start; white-space: normal; }
	.tp-qmain b { white-space: normal; }
	.tp-qdate, .tp-qrow .tp-btn { display: none; }
}
.tp-review { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.tp-review-side { position: sticky; top: 64px; }
@media (max-width: 1000px) { .tp-review { grid-template-columns: minmax(0, 1fr); } .tp-review-side { position: static; } }
.tp-decide-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tp-decide .tp-field { margin-top: 10px; }
.tp-doclist { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-docbtn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; font-weight: 600; }
.tp-docmissing { color: var(--muted); font-weight: 400; background: #f6f8f9; }
.tp-pricebox { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tp-pricebox div { background: var(--tint); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.tp-pricebox span { font-size: 12px; color: var(--muted); }
.tp-pricebox b { font-size: 18px; }
@media (max-width: 700px) { .tp-pricebox { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tp-compare td b { color: var(--navy); }
.tp-sup .tp-cards { margin-bottom: 16px; }

/* /work/ – team and supplier sign-in (0.16.0) */
.tp-work-intro { text-align: center; margin: 26px auto 18px; max-width: 640px; }
.tp-work-intro h1 { margin: 0 0 6px; font-size: 26px; }
.tp-work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 900px; margin: 0 auto; align-items: start; }
.tp-work-card { padding: 22px; margin: 0; }
.tp-work-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.tp-work-head h2 { margin: 0 0 2px; font-size: 20px; }
.tp-work-head p { margin: 0; }
.tp-work-ico { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--tint); color: var(--navy); display: flex; align-items: center; justify-content: center; }
.tp-work-ico svg { stroke: currentColor; }
.tp-work-pw { margin-top: 4px; }
.tp-work-pw summary { cursor: pointer; color: var(--navy); font-weight: 600; padding: 4px 0; }
.tp-work-pw .tp-login { margin-top: 10px; }
.tp-work-note { margin: 12px 0 0; }
.tp-work-card .tp-btn.tp-block { margin-top: 8px; }
a.tp-work-area { display: block; color: var(--ink); text-decoration: none; }
a.tp-work-area:hover { border-color: var(--navy); box-shadow: 0 4px 16px rgba(16, 42, 67, .08); }
@media (max-width: 760px) { .tp-work-grid { grid-template-columns: minmax(0, 1fr); } .tp-work-intro h1 { font-size: 22px; } }

/* Supplier dashboard round 1 (0.17.0): to-do, messages, documents, sales */
.tp-todo h2 { display: flex; align-items: center; gap: 8px; }
.tp-todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tp-todo-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: #fff; border-left-width: 4px; }
.tp-todo-alert { border-left-color: var(--red) !important; background: #fdf3f3 !important; }
.tp-todo-warn { border-left-color: #e3a52a !important; background: #fdf8ec !important; }
.tp-todo-info { border-left-color: var(--navy) !important; }
.tp-todo-list .tp-btn { flex: none; }
.tp-sup-reason { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: #fdf8ec; color: #6b4c0c; font-size: 13px; }
.tp-btn.tp-ghost { border-color: var(--line); color: var(--muted); }
.tp-thread { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; padding: 4px 2px 12px; }
.tp-thread-empty { margin: 6px 0 14px; }
.tp-msg { max-width: 78%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.tp-msg-mine { align-self: flex-end; background: var(--tint); border-color: #b8dfe7; }
.tp-msg-theirs { align-self: flex-start; }
.tp-msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tp-msg-tag { display: inline-block; font-size: 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-bottom: 6px; }
.tp-msg-body { white-space: normal; overflow-wrap: anywhere; }
.tp-chat-form { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.tp-chat-form select, .tp-doc-fields select, .tp-doc-fields input[type=text], .tp-doc-fields input[type=date], .tp-chat-form textarea { width: 100%; }
.tp-doc-asks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tp-doc-ask { border: 1px solid var(--line); border-left: 4px solid #e3a52a; border-radius: 9px; padding: 12px; background: #fff; }
.tp-doc-ask.tp-doc-rejected { border-left-color: var(--red); }
.tp-doc-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.tp-doc-new { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.tp-doc-new summary { cursor: pointer; color: var(--navy); font-weight: 600; }
.tp-exp { font-size: 13px; white-space: nowrap; }
.tp-exp-soon { color: #8a5a00; font-weight: 600; }
.tp-exp-expired { color: var(--red); font-weight: 700; }
.tp-old td { color: var(--muted); }
.tp-inline-decide { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tp-inline-decide input[type=text] { min-width: 160px; flex: 1; }
.tp-sales td, .tp-sales th { white-space: nowrap; }
.tp-sales th:first-child, .tp-sales td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line); white-space: normal; min-width: 120px; max-width: 160px; }
@media (max-width: 700px) { .tp-msg { max-width: 92%; } .tp-todo-list li { flex-direction: column; align-items: flex-start; } }
.tp-sales th.tp-r, .tp-sales td.tp-r { text-align: right; }
#tp-docs td a { white-space: nowrap; }

/* Wide tables become cards on phones (0.17.1). Labels come from the header (data-label, set by JS). */
@media (max-width: 700px) {
	.tp-scroll:has(> .tp-stack) { overflow: visible; }
	table.tp-stack, .tp-stack tbody, .tp-stack tr, .tp-stack td { display: block; width: 100%; box-sizing: border-box; }
	.tp-stack thead { display: none; }
	.tp-stack tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; background: #fff; }
	.tp-stack td { border: 0 !important; padding: 3px 0 !important; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; }
	.tp-stack td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
	.tp-stack td:empty, .tp-stack td.tp-blank { display: none; }
	.tp-stack td form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
}

/* Shipping rules on a phone (0.17.2): one card per rule */
@media (max-width: 700px) {
	.tp-rules.tp-stack { min-width: 0; }
	.tp-rules.tp-stack td { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; }
	.tp-rules.tp-stack td[data-label]:not([data-label=""])::before { flex: 0 0 100%; margin: 4px 0 0; }
	.tp-rules.tp-stack .tp-wide { min-width: 0; width: 100%; }
	.tp-rules.tp-stack select { min-width: 0; max-width: 100%; }
	.tp-rule.tp-noprice td.tp-price, .tp-rule:not([data-type=per_kg]) td.tp-kg-only, .tp-rule:not([data-type=per_kg]) input.tp-kg-only { display: none !important; }
}

/* Shipping example on the product form, phones (0.17.2): customer + country on one line, method under it, price on the right */
@media (max-width: 700px) {
	.tp-ship-preview table, .tp-ship-preview tbody { display: block; }
	.tp-ship-preview tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
	.tp-ship-preview td { border: 0; padding: 0; }
	.tp-ship-preview td:nth-child(1) { white-space: nowrap; font-weight: 600; }
	.tp-ship-preview td:nth-child(2) { white-space: nowrap; }
	.tp-ship-preview td:nth-child(3) { grid-column: 1 / 3; color: var(--muted); font-size: 13px; }
	.tp-ship-preview td:nth-child(4) { grid-column: 3; grid-row: 1 / 3; align-self: center; white-space: nowrap; text-align: right; font-weight: 600; }
}

/* 0.20.0 Pricing 360°, owner pages, test accounts */
.tp-field-wide { grid-column: 1 / -1; }
.tp-margin { line-height: 1.7; }
.tp-margin .tp-bad, .tp-bad { color: #b42318; font-weight: 600; }
.tp-good { color: #1a7f37; font-weight: 600; }
.tp-exception { background: #fff7e0; border: 1px solid #f2bb45; border-radius: 8px; padding: 10px 12px; }
.tp-policy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 18px; }
.tp-policy-grid .tp-field input { max-width: 140px; }
.tp-unit { color: var(--muted, #4a5d6a); margin-left: 6px; }
.tp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 18px; }
.tp-kpi { background: #fff; border: 1px solid var(--line, #d6e3e8); border-radius: 12px; padding: 12px 14px; }
.tp-kpi span { display: block; font-size: 13px; color: var(--muted, #4a5d6a); }
.tp-kpi b { display: block; font-size: 22px; margin-top: 2px; }
.tp-persona { display: flex; flex-direction: column; gap: 8px; }
.tp-persona form { margin-top: auto; }
/* Owner test-account cards only: the base .tp-badge (top of file) and its colour classes stay as they are on /purchasing/. */
.tp-persona .tp-badge { font-size: 12px; padding: 2px 8px; background: #e8f5f8; color: #1b5070; white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.tp-persona .tp-badge.tp-warn { background: #fff7e0; color: #8a5a00; }

/* 0.21.0 Inter Sales: /sales/ (rep dashboard) and the owner's Inter Sales tab */
.tp-subnav { margin: 0 0 14px; }
.tp-subnav .tp-btn { padding: 6px 12px; font-size: 14px; }
.tp-salesrep .tp-policy-grid .tp-field input, .tp-salesrep .tp-policy-grid .tp-field select,
.tp-owner .tp-policy-grid .tp-field input[type="email"], .tp-owner .tp-policy-grid .tp-field input[type="text"] { max-width: none; }
.tp-bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 8px 0 0; }
.tp-bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.tp-bar-fill { display: block; width: 100%; max-width: 56px; min-height: 2px; background: var(--navy); border-radius: 6px 6px 0 0; }
.tp-bar b { font-size: 12px; }
.tp-bar small { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tp-linkbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 18px; align-items: start; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--tint); }
.tp-linkbox input[type="text"] { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.tp-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tp-qr canvas { width: 100%; max-width: 200px; height: auto; background: #fff; border-radius: 6px; image-rendering: pixelated; }
.tp-terms ul { padding-left: 20px; line-height: 1.7; }
.tp-terms li { margin-bottom: 4px; }
@media (max-width: 640px) {
	.tp-linkbox { grid-template-columns: minmax(0, 1fr); }
	.tp-bars { gap: 6px; height: 150px; }
	.tp-bar small { font-size: 11px; }
}

/* 0.22.0 Owner Dashboard: sales and profit, profit per product, wholesale shops, money to pay, change log */
.tp-kpi small { display: block; font-size: 13px; margin-top: 4px; line-height: 1.4; }
.tp-kpi small b { display: inline; font-size: inherit; margin: 0; }
.tp-dash-kpis { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); margin-bottom: 10px; }
.tp-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 14px; }
.tp-dash-grid > .tp-card { min-width: 0; }
.tp-dash-hold { margin: 4px 0 8px; padding: 8px 12px; border-radius: 8px; background: #fdf3df; border: 1px solid var(--yellow); }
.tp-dash-table td small { font-size: 12px; }
.tp-dash-table .tp-badge { margin-top: 2px; }
.tp-dash-table tr.tp-dash-total td { border-top: 2px solid var(--line); background: var(--tint); }
.tp-dash-note { margin-top: 0; }
.tp-dash-h { margin: 22px 0 12px; }
.tp-warn-text { color: #8a5a00; font-size: 13px; }
@media (max-width: 700px) {
	/* Dashboard tables on phones: the first cell is the card title, then "label …… value" on one line. */
	.tp-dash-table td:first-child { font-weight: 600; }
	.tp-dash-table td:first-child::before { display: none !important; }
	.tp-dash-table td[data-label]:not([data-label=""]):not(:first-child):not(.tp-blank) { display: flex !important; justify-content: space-between; align-items: baseline; gap: 12px; }
	/* The label never shrinks (0.22.1: a long value squeezed "เหตุผล" to one letter per line). */
	.tp-dash-table td[data-label]:not([data-label=""]):not(:first-child)::before { margin-top: 0; flex: 0 0 auto; max-width: 45%; overflow-wrap: normal; }
	.tp-dash-table td[data-label]:not([data-label=""]):not(:first-child) > span { flex: 0 1 auto; min-width: 0; text-align: right; }
	/* Long text (reasons): label above, text below, left-aligned. */
	.tp-dash-table td.tp-dash-long[data-label]:not([data-label=""]):not(:first-child):not(.tp-blank) { display: block !important; }
	.tp-dash-table td.tp-dash-long[data-label]:not([data-label=""]):not(:first-child)::before { display: block; max-width: none; margin-bottom: 2px; }
	.tp-dash-table td.tp-dash-long[data-label]:not([data-label=""]):not(:first-child) > span { display: block; text-align: left; }
	.tp-dash-table td.tp-blank { display: none !important; }
}
