/* TG Kit Builder studio. Uses theme tokens (--tg-*) with fallbacks. */
/* One green is not enough: the brand green is 2.74:1, which fails behind white
   text and as text on white. --g stays the brand green for borders and other
   decoration; --g-fill and --g-text are the theme's accessible pair. */
.tgkb {
	--g: var(--tg-green, #5faf2d);
	--g-fill: var(--tg-green-fill, #43841e);
	--g-text: var(--tg-green-text, #3f7d1d);
	--ink: var(--tg-ink, #141414); --line: var(--tg-border, #e3e6e9);
	--muted: var(--tg-text-muted, #565c63); --paper: var(--tg-paper, #f6f6f4);
}
.tgkb, .tgkb * { box-sizing: border-box; }
.tgkb-gate { text-align: center; padding: 48px 16px; }
.tgkb__loading { padding: 48px; text-align: center; color: var(--muted); }

/* Stepper */
.tgkb-steps { display: flex; gap: 8px; list-style: none; margin: 0 0 24px; padding: 0; overflow-x: auto; }
.tgkb-steps li { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tgkb-steps li.is-active { border-color: var(--g); color: var(--ink); }
.tgkb-steps li.is-done { color: var(--g); border-color: var(--g); }
.tgkb-steps__num { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: var(--paper); font-size: 12px; }
.tgkb-steps li.is-active .tgkb-steps__num, .tgkb-steps li.is-done .tgkb-steps__num { background: var(--g-fill); color: #fff; }

/* Body layout */
.tgkb-body { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; }
@media (min-width: 900px) { .tgkb-body { grid-template-columns: minmax(0,1fr) 300px; align-items: start; } }

/* Persistent mobile action bar (fixed above the site's bottom nav) */
.tgkb-mobilebar { display: none; }
@media (max-width: 899px) {
	.tgkb-mobilebar {
		display: flex; align-items: center; justify-content: space-between; gap: 12px;
		position: fixed; left: 0; right: 0; bottom: var(--tg-bottombar-h, 0px); z-index: 60;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
		background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(0,0,0,.08);
	}
	.tgkb-mobilebar__total { display: flex; flex-direction: column; line-height: 1.1; }
	.tgkb-mobilebar__total small { color: var(--muted); font-size: 11px; }
	.tgkb-mobilebar__total strong { font-size: 18px; color: var(--g); }
	.tgkb-mobilebar .tg-btn { flex: 0 0 auto; min-width: 150px; }
	/* Keep the inline Continue/Submit out of the way; the bar drives it on mobile. */
	.tgkb-nav [data-next], .tgkb-nav [data-submit] { display: none; }
	.tgkb-body { padding-bottom: 72px; }
}
.tgkb-stage h2 { font-size: 1.6rem; margin: 0 0 8px; }
.tgkb-hint { color: var(--muted); margin-bottom: 16px; }

/* Summary (sticky) */
.tgkb-summary { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
@media (min-width: 900px) { .tgkb-summary { position: sticky; top: 88px; } }
.tgkb-summary h3 { margin: 0 0 12px; }
.tgkb-summary__rows { margin: 0 0 12px; }
.tgkb-summary__rows > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.tgkb-summary__rows dt { color: var(--muted); margin: 0; } .tgkb-summary__rows dd { margin: 0; font-weight: 600; }
.tgkb-summary__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--line); font-size: 18px; }
.tgkb-summary__total strong { color: var(--g-text); }
.tgkb-summary__eta { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.tgkb-summary__warn { color: #cf3b2e; font-size: 13px; margin: 6px 0 0; }
.tgkb-save { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 16px; }

/* Fields */
.tgkb-field { margin: 16px 0; }
.tgkb-field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.tgkb-field input, .tgkb-field select, .tgkb-field textarea { width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--tg-border-strong, #cdd2d7); border-radius: 10px; font: inherit; }
.tgkb-field select { padding-right: 34px; } /* room for the themed chevron */
.tgkb-chosen { color: var(--muted); font-weight: 400; }

/* Kit cards */
.tgkb-kits { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; margin-bottom: 8px; }
@media (min-width: 620px) { .tgkb-kits { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.tgkb-kit { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.tgkb-kit input { position: absolute; opacity: 0; }
.tgkb-kit.is-selected { border-color: var(--g); background: rgba(95,175,45,.05); }
.tgkb-kit__name { font-weight: 800; font-size: 1.05rem; }
.tgkb-kit__blurb { color: var(--muted); font-size: 13px; }
.tgkb-kit__price { font-weight: 700; margin-top: 6px; } .tgkb-kit__price small { color: var(--muted); font-weight: 400; }
.tgkb-kit__moq { position: absolute; top: 12px; right: 12px; font-size: 11px; color: var(--muted); }

/* Swatches */
.tgkb-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.tgkb-swatch { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--tg-border-strong,#cdd2d7); box-shadow: inset 0 0 0 2px #fff; cursor: pointer; padding: 0; }
.tgkb-swatch.is-selected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--ink); }

/* Matching add-ons */
.tgkb-addons { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
@media (min-width: 620px) { .tgkb-addons { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.tgkb-addon { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.tgkb-addon input { position: absolute; opacity: 0; }
.tgkb-addon.is-selected { border-color: var(--g); background: rgba(95,175,45,.05); }
.tgkb-addon__name { font-weight: 600; } .tgkb-addon__blurb { font-size: 13px; color: var(--muted); } .tgkb-addon__price { font-size: 13px; font-weight: 600; color: var(--g-text); margin-top: 2px; }
.tgkb-field--gk { margin-top: 12px; }
.tgkb-summary__break { font-size: 13px; color: var(--g); font-weight: 600; margin: 8px 0 0; }
.tgkb-summary__eta small { color: var(--muted); font-weight: 400; }

/* Decorations */
.tgkb-decos { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
@media (min-width: 620px) { .tgkb-decos { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.tgkb-deco { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.tgkb-deco input { position: absolute; opacity: 0; }
.tgkb-deco.is-selected { border-color: var(--g); background: rgba(95,175,45,.05); }
.tgkb-deco__name { font-weight: 600; } .tgkb-deco__cost { font-size: 13px; color: var(--muted); } .tgkb-deco__lead { font-size: 12px; color: var(--g); }

/* Upload */
.tgkb-upload { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--tg-border-strong,#cdd2d7); border-radius: 12px; }
.tgkb-upload input[type=file] { min-width: 180px; }
.tgkb-upload__opts { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
@media (min-width: 620px) { .tgkb-upload__opts { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.tgkb-upload__opts select { padding: 8px 32px 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.tgkb-upres { margin: 0; font-size: 13px; color: var(--muted); }
.tgkb-upres.is-low { color: #cf7a13; font-weight: 600; }
.tgkb-rights { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.tgkb-rights input { width: 18px; height: 18px; flex: none; margin-top: 1px; accent-color: var(--g); }
.tgkb-art__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tgkb-art__res { font-size: 12px; color: var(--muted); }
.tgkb-art__res.is-low { color: #cf7a13; font-weight: 600; }
.tgkb-uperr { color: #cf3b2e; font-size: 13px; margin: 8px 0 0; }
.tgkb-arts { list-style: none; margin: 12px 0 0; padding: 0; }
.tgkb-art { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.tgkb-art em { color: var(--muted); font-style: normal; font-size: 12px; }
.tgkb-art__x, .tgkb-srow__x { background: none; border: 0; font-size: 20px; color: #cf3b2e; cursor: pointer; }
.tgkb-uperr { color: #cf3b2e; font-size: 13px; }

/* Squad grid */
.tgkb-squad-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.tgkb-link { font-size: 13px; }
.tgkb-srow { display: grid; grid-template-columns: 1fr 64px 84px 130px 40px; gap: 8px; align-items: center; padding: 6px 0; }
.tgkb-srow--head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
.tgkb-in { min-height: 44px; padding: 6px 10px; border: 1px solid var(--tg-border-strong,#cdd2d7); border-radius: 8px; font: inherit; width: 100%; }
select.tgkb-in { padding-right: 30px; background-position: right 8px center; }
.tgkb-in.is-err { border-color: #cf3b2e; }
.tgkb-in.is-warn { border-color: #e0a800; }
.tgkb-empty { color: var(--muted); padding: 12px 0; }
.tgkb-squad-err { color: #cf3b2e; font-size: 13px; font-weight: 600; margin: 10px 0 0; }
.tgkb-squad-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* Share link (controlled player-size collection) */
.tgkb-share { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(95,175,45,.04); }
.tgkb-share__lead { margin: 0 0 10px; font-size: 14px; }
.tgkb-share__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tgkb-share__row input { flex: 1; min-width: 220px; padding: 10px; border: 1px solid var(--tg-border-strong,#cdd2d7); border-radius: 8px; font: inherit; }
.tgkb-share__status { margin: 8px 0 0; font-size: 13px; color: var(--g); font-weight: 600; }

/* Public player-size form */
.tgkb-sizeform { max-width: 520px; margin: 0 auto; }
.tgkb-sizeform__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tgkb-sizeform__form .tgkb-field { margin-bottom: 14px; }
.tgkb-sizeform__form select { padding-right: 34px; }
.tgkb-sizeform__form input, .tgkb-sizeform__form select { width: 100%; min-height: 46px; padding: 10px; border: 1px solid var(--tg-border-strong,#cdd2d7); border-radius: 8px; font: inherit; }
.tgkb-sizeform__ok { padding: 16px; border: 1px solid var(--g); border-radius: 12px; background: rgba(95,175,45,.06); }

@media (max-width: 620px) {
	/* One player per card: each roster row becomes a self-contained card. */
	.tgkb-srow { grid-template-columns: 1fr 56px 40px; grid-template-areas: 'name name x' 'num init init' 'size size size'; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
	.tgkb-srow--head { display: none; }
	.tgkb-srow [data-f=player_name] { grid-area: name; }
	.tgkb-srow [data-f=player_number] { grid-area: num; }
	.tgkb-srow [data-f=initials] { grid-area: init; }
	.tgkb-srow [data-f=shirt_size] { grid-area: size; }
	.tgkb-srow__x { grid-area: x; justify-self: end; }
}

/* Review */
.tgkb-review { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.tgkb-review__card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.tgkb-review__card h3 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; color: var(--muted); }
.tgkb-warn { color: #cf3b2e; } .tgkb-note { color: var(--muted); font-size: 13px; } .tgkb-submit-err { color: #cf3b2e; }

/* Nav */
.tgkb-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Account: orders + single */
/* Account order views sit on the full-width builder template; keep them readable. */
.tgkb-orders, .tgkb-order { max-width: 860px; }
.tgkb-orders__list { list-style: none; margin: 0; padding: 0; }
.tgkb-orders__list a { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; color: inherit; }
.tgkb-pill, .tgkb-adm-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--paper); }
.tgkb-pill--proofing { background: #fff4d6; } .tgkb-pill--approved { background: #e6f3e0; } .tgkb-pill--paid, .tgkb-pill--production { background: #d9f0d4; color: #1f5c3a; }
.tgkb-order__head { display: flex; align-items: center; gap: 12px; }
.tgkb-order__grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; margin-top: 16px; }
@media (min-width: 800px) { .tgkb-order__grid { grid-template-columns: 1fr 1fr; } }
.tgkb-order__roster { width: 100%; border-collapse: collapse; }
.tgkb-order__roster th, .tgkb-order__roster td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tgkb-approve label, .tgkb-approve textarea { display: block; margin: 10px 0; width: 100%; }
.tgkb-approve textarea { min-height: 80px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.tgkb-pill--changes_requested { background: #ffe3d6; color: #a5401f; }
/* Front/back proof viewer */
.tgkb-proofs { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; margin-bottom: 12px; }
@media (min-width: 480px) { .tgkb-proofs { grid-template-columns: 1fr 1fr; } }
.tgkb-proof { margin: 0; }
.tgkb-proof figcaption { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.tgkb-proof__img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; display: block; background: #fff; }
.tgkb-approved { color: #1f5c3a; font-weight: 600; }
/* Request changes + PO */
.tgkb-reqchanges, .tgkb-po { margin-top: 14px; }
.tgkb-reqchanges summary, .tgkb-po summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.tgkb-reqchanges__form textarea, .tgkb-po__form input { display: block; width: 100%; margin: 8px 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.tgkb-reqchanges__form textarea { min-height: 80px; }
.tgkb-reqchanges__form label, .tgkb-po__form label { display: block; margin-top: 8px; font-size: 14px; font-weight: 600; }
.tgkb-changes { color: #a5401f; font-weight: 600; }
.tgkb-changes__note { margin: 8px 0; padding: 10px 12px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.tgkb-pay { margin-top: 8px; }

/* Sign-in step: a guest has built stages 1-3 and needs an account to submit. */
.tgkb-signin {
	border: 1px solid var(--tg-green, #49b928); border-radius: 12px;
	background: rgba(73, 185, 40, .06); padding: 20px; margin: 24px 0;
}
.tgkb-signin h3 { margin: 0 0 8px; }
.tgkb-signin p { margin: 0 0 12px; }
.tgkb-signin__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

/* The stage heading is focused programmatically on each stage change (so the
   change is announced); it is not a control, so it gets no focus ring. */
.tgkb-stage h2[tabindex="-1"]:focus,
.tgkb-stage h2[tabindex="-1"]:focus-visible { outline: none; }
