/* TeamStores frontend styles */
.ts-store,
.ts-builder,
.ts-dashboard,
.ts-directory {
	--ts-primary: #1d4ed8;
	--ts-secondary: #111827;
	--ts-bg: #f8fafc;
	--ts-line: #e5e7eb;
	--ts-radius: 12px;
	color: #111827;
	font-family: inherit;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 16px 60px;
	box-sizing: border-box;
}
.ts-store *,
.ts-builder *,
.ts-dashboard *,
.ts-directory * { box-sizing: border-box; }

.ts-muted { color: #6b7280; }
.ts-small { font-size: .85em; }
.ts-empty { color: #6b7280; padding: 24px 0; text-align: center; }

/* Buttons */
.ts-btn {
	display: inline-block;
	padding: 11px 20px;
	border-radius: 999px;
	border: 1px solid transparent;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	transition: transform .05s ease, box-shadow .2s ease, background .2s ease;
}
.ts-btn:active { transform: translateY(1px); }
.ts-btn--primary { background: var(--ts-primary); color: #fff; }
.ts-btn--primary:hover { box-shadow: 0 6px 18px rgba(29,78,216,.28); color: #fff; }
.ts-btn--ghost { background: #fff; border-color: var(--ts-line); color: #111827; }
.ts-btn--ghost:hover { border-color: var(--ts-primary); color: var(--ts-primary); }
.ts-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Store header ---------- */
.ts-store__header {
	position: relative;
	border-radius: var(--ts-radius);
	background: var(--ts-primary);
	background-size: cover;
	background-position: center;
	color: #fff;
	margin: 20px 0 28px;
	overflow: hidden;
}
.ts-store__header-inner {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 28px 26px;
}
.ts-store__logo img {
	width: 92px; height: 92px;
	object-fit: contain;
	background: #fff;
	border-radius: 14px;
	padding: 8px;
}
.ts-store__titles { flex: 1; }
.ts-store__name { margin: 0; font-size: 30px; line-height: 1.1; color: #fff; }
.ts-store__org { margin: 4px 0 0; opacity: .9; }
.ts-badge {
	display: inline-block;
	margin-top: 10px;
	background: rgba(255,255,255,.18);
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 13px;
}
.ts-store__cart .ts-cart-link {
	color: #fff; text-decoration: none; font-weight: 700; font-size: 18px;
	background: rgba(0,0,0,.2); padding: 10px 14px; border-radius: 999px;
}
.ts-store__intro { margin-bottom: 20px; }
.ts-closed-banner { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; padding: 14px 18px; border-radius: 10px; margin: 0 0 20px; font-size: 15px; }
.ts-closed-banner__icon { font-size: 18px; }
.ts-preview-note { background: #eef2ff; border: 1px dashed #c7d2fe; color: #3730a3; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* ---------- Product grid ---------- */
.ts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 22px;
}
.ts-card {
	display: block;
	background: #fff;
	border: 1px solid var(--ts-line);
	border-radius: var(--ts-radius);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: box-shadow .2s ease, transform .2s ease;
}
.ts-card:hover { box-shadow: 0 10px 28px rgba(0,0,0,.10); transform: translateY(-2px); }
.ts-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--ts-bg);
	display: flex; align-items: center; justify-content: center;
}
.ts-card__img { width: 100%; height: 100%; object-fit: contain; }
.ts-card__logo {
	position: absolute;
	width: 22%;
	max-width: 64px;
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
	pointer-events: none;
}
.ts-loc-left_chest   { top: 30%; right: 26%; }
.ts-loc-right_chest  { top: 30%; left: 26%; }
.ts-loc-center_chest { top: 34%; left: 50%; transform: translateX(-50%); width: 34%; }
.ts-loc-full_front   { top: 38%; left: 50%; transform: translateX(-50%); width: 42%; }
.ts-loc-full_back    { top: 34%; left: 50%; transform: translateX(-50%); width: 42%; }
.ts-loc-left_sleeve  { top: 40%; left: 8%; width: 12%; }
.ts-loc-right_sleeve { top: 40%; right: 8%; width: 12%; }
.ts-card__essential {
	position: absolute; top: 10px; left: 10px;
	background: var(--ts-primary); color: #fff;
	font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.ts-card__body { padding: 14px 16px 18px; }
.ts-card__title { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.ts-card__price { font-weight: 700; color: var(--ts-secondary); }

/* ---------- PDP ---------- */
.ts-pdp__back { margin: 6px 0 16px; }
.ts-pdp__back a { color: var(--ts-primary); text-decoration: none; font-weight: 600; }
.ts-pdp__grid {
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	gap: 40px;
}
.ts-mockup {
	position: relative;
	background: var(--ts-bg);
	border: 1px solid var(--ts-line);
	border-radius: var(--ts-radius);
	aspect-ratio: 1 / 1;
	overflow: hidden;
}
.ts-mockup__canvas { width: 100%; height: 100%; display: block; }
.ts-mockup__loading {
	position: absolute; inset: 0; display: none;
	align-items: center; justify-content: center;
	color: #9ca3af; background: rgba(248,250,252,.7);
}
.ts-mockup.is-loading .ts-mockup__loading { display: flex; }
.ts-mockup__note { color: #6b7280; font-size: 13px; margin-top: 10px; }

.ts-pdp__title { margin: 0 0 8px; font-size: 26px; }
.ts-pdp__price { font-size: 24px; font-weight: 800; color: var(--ts-secondary); margin-bottom: 16px; }
.ts-pdp__desc { color: #374151; margin-bottom: 18px; }
.ts-pdp__fundraise { margin-top: 14px; color: var(--ts-primary); font-weight: 600; font-size: 14px; }

.ts-field { margin-bottom: 16px; }
.ts-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.ts-field select,
.ts-field input[type="text"],
.ts-field input[type="email"],
.ts-field input[type="number"],
.ts-field input[type="password"],
.ts-field input[type="search"],
.ts-field textarea {
	width: 100%;
	padding: 11px 13px;
	border: 1px solid var(--ts-line);
	border-radius: 10px;
	font-size: 15px;
	background: #fff;
}
.ts-field--qty .ts-qty { width: 90px; }

/* Personalization */
.ts-personalization { border: 1px solid var(--ts-line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--ts-bg); }
.ts-personalization__head { font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.ts-personalization__price { background: var(--ts-primary); color: #fff; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.ts-personalization .ts-field { margin-bottom: 0; }
.ts-personalization__bundle { margin: 10px 0 0; font-size: 13px; color: var(--ts-primary); }
.ts-price-hint { color: var(--ts-primary); font-weight: 700; font-size: 12px; }
.ts-opt { color: #9ca3af; font-weight: 400; font-size: 12px; }
.ts-req { color: #dc2626; font-weight: 700; }

/* Custom add-ons */
.ts-addons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.ts-addon-field { margin-bottom: 0; }
.ts-addon-checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.ts-addon-checkbox input { width: 18px; height: 18px; }

.ts-logo-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.ts-logo-swatch {
	width: 56px; height: 56px; border: 2px solid var(--ts-line);
	border-radius: 10px; background: #fff; cursor: pointer; padding: 4px;
}
.ts-logo-swatch.is-active { border-color: var(--ts-primary); }
.ts-logo-swatch img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Gate ---------- */
.ts-gate { display: flex; justify-content: center; padding: 60px 16px; }
.ts-gate__card {
	background: #fff; border: 1px solid var(--ts-line); border-radius: var(--ts-radius);
	padding: 40px; max-width: 420px; text-align: center;
}
.ts-gate__logo { max-width: 120px; margin: 0 auto 16px; display: block; }
.ts-gate__form { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.ts-gate__form input { padding: 12px; border: 1px solid var(--ts-line); border-radius: 10px; }

/* ---------- Builder ---------- */
.ts-builder { max-width: 860px; }
.ts-builder__steps { display: flex; gap: 8px; margin: 24px 0 28px; }
.ts-step-pip {
	flex: 1; display: flex; align-items: center; gap: 8px; justify-content: center;
	padding: 10px; border-radius: 10px; background: #fff; border: 1px solid var(--ts-line);
	font-weight: 600; font-size: 13px; color: #9ca3af; cursor: pointer;
}
.ts-step-pip span {
	width: 24px; height: 24px; border-radius: 999px; background: var(--ts-line);
	display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.ts-step-pip.is-active { color: var(--ts-secondary); border-color: var(--ts-primary); }
.ts-step-pip.is-active span { background: var(--ts-primary); }
.ts-step { display: none; background: #fff; border: 1px solid var(--ts-line); border-radius: var(--ts-radius); padding: 28px; }
.ts-step.is-active { display: block; }
.ts-step h2 { margin-top: 0; }
.ts-field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.ts-field-row .ts-field { flex: 1; min-width: 160px; }
.ts-builder__nav { display: flex; justify-content: space-between; margin-top: 24px; }
.ts-toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.ts-logo-upload { display: flex; gap: 20px; align-items: center; margin-bottom: 20px; }
.ts-logo-preview {
	width: 130px; height: 130px; border: 2px dashed var(--ts-line); border-radius: 12px;
	display: flex; align-items: center; justify-content: center; background: var(--ts-bg);
}
.ts-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ts-logo-placeholder { color: #9ca3af; font-size: 13px; }
.ts-upload-status { color: #6b7280; font-size: 13px; margin-top: 8px; }

.ts-catalog-search { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.ts-catalog-search input { flex: 1; padding: 10px 12px; border: 1px solid var(--ts-line); border-radius: 10px; }
.ts-selected-count { font-weight: 600; color: var(--ts-primary); white-space: nowrap; }
.ts-catalog-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px;
	max-height: 440px; overflow-y: auto; padding: 4px;
}
.ts-catalog-item {
	position: relative; border: 2px solid var(--ts-line); border-radius: 10px; padding: 8px;
	cursor: pointer; text-align: center; background: #fff; display: block;
}
.ts-catalog-item.is-selected { border-color: var(--ts-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.ts-catalog-item input { position: absolute; top: 8px; left: 8px; }
.ts-catalog-item__media { display: block; aspect-ratio: 1/1; background: var(--ts-bg); border-radius: 8px; overflow: hidden; }
.ts-catalog-item__media img { width: 100%; height: 100%; object-fit: contain; }
.ts-catalog-item__name { display: block; font-size: 12px; margin-top: 6px; font-weight: 600; }
.ts-catalog-item__price { display: block; font-size: 12px; color: #6b7280; }

.ts-markup-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.ts-markup-btn {
	padding: 10px 18px; border: 2px solid var(--ts-line); border-radius: 999px; cursor: pointer; font-weight: 700;
}
.ts-markup-btn.is-active { border-color: var(--ts-primary); color: var(--ts-primary); background: rgba(29,78,216,.06); }
.ts-markup-btn input { display: none; }
.ts-review__grid { display: grid; gap: 8px; margin: 16px 0; }
.ts-review__row { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--ts-bg); border-radius: 10px; }
.ts-builder__error { color: #b91c1c; margin-top: 12px; font-weight: 600; }
.ts-builder-success { text-align: center; padding: 50px 20px; background: #fff; border-radius: var(--ts-radius); border: 1px solid var(--ts-line); }

/* ---------- Dashboard ---------- */
.ts-dashboard__topbar { display: flex; justify-content: space-between; align-items: flex-end; margin: 22px 0 10px; gap: 16px; flex-wrap: wrap; }
.ts-store-switch label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.ts-store-switch select { padding: 9px 12px; border: 1px solid var(--ts-line); border-radius: 10px; min-width: 220px; }
.ts-dashboard__actions { display: flex; gap: 10px; }
.ts-dashboard__title { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; }
.ts-status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e5e7eb; color: #374151; text-transform: capitalize; }
.ts-status--publish { background: #dcfce7; color: #166534; }
.ts-status--pending { background: #fef9c3; color: #854d0e; }

.ts-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.ts-stat { background: #fff; border: 1px solid var(--ts-line); border-radius: var(--ts-radius); padding: 18px; text-align: center; }
.ts-stat__value { display: block; font-size: 26px; font-weight: 800; color: var(--ts-secondary); }
.ts-stat__label { display: block; font-size: 13px; color: #6b7280; margin-top: 2px; }
.ts-stat--accent { background: var(--ts-primary); border-color: var(--ts-primary); }
.ts-stat--accent .ts-stat__value, .ts-stat--accent .ts-stat__label { color: #fff; }

.ts-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ts-line); margin-bottom: 22px; flex-wrap: wrap; }
.ts-tab {
	background: none; border: none; padding: 12px 18px; font-weight: 600; color: #6b7280; cursor: pointer;
	border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.ts-tab.is-active { color: var(--ts-primary); border-bottom-color: var(--ts-primary); }
.ts-panel { display: none; }
.ts-panel.is-active { display: block; }
.ts-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

.ts-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--ts-line); border-radius: var(--ts-radius); overflow: hidden; }
.ts-table th, .ts-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--ts-line); font-size: 14px; }
.ts-table th { background: var(--ts-bg); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }
.ts-table tr:last-child td { border-bottom: none; }
.ts-td-product { display: flex; align-items: center; gap: 10px; }
.ts-td-product img { border-radius: 8px; object-fit: cover; }
.ts-link-danger { background: none; border: none; color: #b91c1c; cursor: pointer; font-weight: 600; padding: 0; }

.ts-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.ts-switch input { opacity: 0; width: 0; height: 0; }
.ts-switch span { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; transition: .2s; cursor: pointer; }
.ts-switch span:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.ts-switch input:checked + span { background: var(--ts-primary); }
.ts-switch input:checked + span:before { transform: translateX(18px); }

.ts-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #e5e7eb; color: #374151; }
.ts-pill--active, .ts-pill--accrued { background: #dcfce7; color: #166534; }
.ts-pill--paid, .ts-pill--used { background: #dbeafe; color: #1e40af; }
.ts-pill--void { background: #fee2e2; color: #991b1b; }
.ts-fundraise-summary { display: flex; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.ts-fundraise-summary strong { font-size: 18px; color: var(--ts-secondary); }

.ts-field--btn { display: flex; align-items: flex-end; }
.ts-manager-list { list-style: none; padding: 0; margin: 14px 0 0; }
.ts-manager-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fff; border: 1px solid var(--ts-line); border-radius: 10px; margin-bottom: 8px; }

.ts-copy-row { display: flex; gap: 8px; }
.ts-copy-row input { flex: 1; padding: 11px 13px; border: 1px solid var(--ts-line); border-radius: 10px; }
.ts-share-buttons { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ts-logo-list { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.ts-logo-chip { position: relative; width: 70px; height: 70px; border: 1px solid var(--ts-line); border-radius: 10px; padding: 6px; }
.ts-logo-chip img { width: 100%; height: 100%; object-fit: contain; }
.ts-remove-logo { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #ef4444; color: #fff; border: none; cursor: pointer; }

/* Modal */
.ts-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 99999; padding: 20px; }
.ts-modal[hidden] { display: none; }
.ts-modal__box { background: #fff; border-radius: var(--ts-radius); max-width: 720px; width: 100%; max-height: 86vh; display: flex; flex-direction: column; padding: 22px; }
.ts-modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ts-modal__close { background: none; border: none; font-size: 26px; cursor: pointer; line-height: 1; }
.ts-modal #ts-modal-search { padding: 10px 12px; border: 1px solid var(--ts-line); border-radius: 10px; margin-bottom: 12px; }
.ts-modal__foot { margin-top: 14px; text-align: right; }

/* Toast */
.ts-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #111827; color: #fff; padding: 12px 20px; border-radius: 999px; opacity: 0; transition: .3s; z-index: 100000; font-weight: 600; }
.ts-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.ts-toast--error { background: #b91c1c; }

/* ---------- Directory ---------- */
.ts-directory__search { display: flex; gap: 10px; margin: 24px 0 28px; }
.ts-directory__search input { flex: 1; padding: 13px 16px; border: 1px solid var(--ts-line); border-radius: 999px; font-size: 16px; }
.ts-directory__grid { display: grid; gap: 22px; }
.ts-directory__grid.ts-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ts-directory__grid.ts-cols-3 { grid-template-columns: repeat(3, 1fr); }
.ts-directory__grid.ts-cols-4 { grid-template-columns: repeat(4, 1fr); }
.ts-dir-card { display: block; border: 1px solid var(--ts-line); border-radius: var(--ts-radius); overflow: hidden; text-decoration: none; color: inherit; background: #fff; transition: box-shadow .2s, transform .2s; }
.ts-dir-card:hover { box-shadow: 0 10px 28px rgba(0,0,0,.1); transform: translateY(-2px); }
.ts-dir-card__banner { height: 120px; background: var(--ts-primary); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.ts-dir-card__logo { max-height: 80px; max-width: 70%; background: #fff; border-radius: 10px; padding: 6px; }
.ts-dir-card__body { padding: 16px; }
.ts-dir-card__body h3 { margin: 0 0 4px; }
.ts-dir-card__cta { display: inline-block; margin-top: 8px; color: var(--ts-primary); font-weight: 700; }
.ts-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 28px; }
.ts-page { padding: 8px 14px; border: 1px solid var(--ts-line); border-radius: 8px; text-decoration: none; color: inherit; }
.ts-page.is-active { background: var(--ts-primary); color: #fff; border-color: var(--ts-primary); }

.ts-notice { background: #fff; border: 1px solid var(--ts-line); border-radius: var(--ts-radius); padding: 26px; text-align: center; margin: 24px 0; }
.ts-voucher-form { max-width: 380px; }
.ts-voucher-form__row { display: flex; gap: 8px; }
.ts-voucher-form__row input { flex: 1; padding: 10px 12px; border: 1px solid var(--ts-line); border-radius: 10px; }

/* Responsive */
@media (max-width: 860px) {
	.ts-pdp__grid { grid-template-columns: 1fr; }
	.ts-stats { grid-template-columns: repeat(2, 1fr); }
	.ts-directory__grid.ts-cols-3, .ts-directory__grid.ts-cols-4 { grid-template-columns: repeat(2, 1fr); }
	.ts-store__header-inner { flex-wrap: wrap; }
}
@media (max-width: 560px) {
	.ts-stats { grid-template-columns: 1fr 1fr; }
	.ts-directory__grid.ts-cols-2, .ts-directory__grid.ts-cols-3, .ts-directory__grid.ts-cols-4 { grid-template-columns: 1fr; }
	.ts-builder__steps { flex-wrap: wrap; }
}
