/* STS Referral: customer dashboard.
   Colors come from CSS variables set inline on .stsr. By default these point at the active
   theme's own palette variables; admin overrides are written as plain colors. */
.stsr {
	--stsr-surface: color-mix(in srgb, var(--stsr-bg) 96%, var(--stsr-text));
	--stsr-card: color-mix(in srgb, var(--stsr-bg) 98%, var(--stsr-text));
	--stsr-line: color-mix(in srgb, var(--stsr-text) 12%, transparent);
	--stsr-muted: color-mix(in srgb, var(--stsr-text) 60%, var(--stsr-bg));
	--stsr-tint: color-mix(in srgb, var(--stsr-primary) 10%, var(--stsr-bg));
	--stsr-ok: #15803d;
	--stsr-warn: #b45309;
	--stsr-bad: #b42318;
	--stsr-shadow: 0 1px 2px color-mix(in srgb, var(--stsr-text) 8%, transparent), 0 6px 18px -8px color-mix(in srgb, var(--stsr-text) 14%, transparent);
	color: var(--stsr-text);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.55;
	box-sizing: border-box;
}
.stsr *, .stsr *::before, .stsr *::after { box-sizing: inherit; }
.stsr--dark { background: var(--stsr-bg); padding: 1.25rem; border-radius: calc(var(--stsr-radius) + 4px); }
.stsr h3, .stsr h4 { color: var(--stsr-text); margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
.stsr h3 { font-size: 1.35rem; }
.stsr h4 { margin-top: 2rem; font-size: 1.05rem; }
.stsr h4.stsr-first { margin-top: 0; }
.stsr p { margin: 0 0 .75rem; }
.stsr a { color: var(--stsr-primary); text-underline-offset: 2px; }
.stsr-ico { flex: none; display: block; }
.stsr-label { display: block; font-size: .8rem; letter-spacing: .02em; text-transform: uppercase; color: var(--stsr-muted); margin-bottom: .3rem; font-weight: 600; }
.stsr-note { color: var(--stsr-muted); font-size: .92rem; }
.stsr-kicker { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--stsr-primary); margin-bottom: .5rem; }

/* ---------- Hero ---------- */
.stsr-hero {
	display: grid; gap: 1.5rem; padding: 1.5rem; margin-bottom: 1.5rem;
	background: linear-gradient(135deg, var(--stsr-tint), var(--stsr-bg) 70%);
	border: 1px solid var(--stsr-line); border-radius: calc(var(--stsr-radius) + 4px);
	box-shadow: var(--stsr-shadow);
}
@media (min-width: 780px) { .stsr-hero { grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr); align-items: center; gap: 2.5rem; padding: 1.75rem 2rem; } }
.stsr-balance__num { display: block; font-size: clamp(2.2rem, 6vw, 3rem); line-height: 1.05; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stsr-balance__num small { font-size: 1rem; font-weight: 500; color: var(--stsr-muted); letter-spacing: 0; }
.stsr-balance__sub { display: block; margin-top: .35rem; color: var(--stsr-muted); font-size: .92rem; }
.stsr-progress { height: 8px; border-radius: 999px; background: var(--stsr-line); overflow: hidden; margin: .9rem 0 .4rem; }
.stsr-progress span { display: block; height: 100%; border-radius: inherit; background: var(--stsr-primary); transition: width .4s ease; }
.stsr-balance__hint { font-size: .85rem; color: var(--stsr-muted); }

/* Link ticket */
.stsr-ticket__row { display: flex; align-items: stretch; background: var(--stsr-bg); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); overflow: hidden; box-shadow: var(--stsr-shadow); }
.stsr-ticket__row input[type="text"] { flex: 1; min-width: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--stsr-text); padding: .9rem 1rem; font: inherit; font-size: .95rem; text-overflow: ellipsis; }
.stsr-ticket__row .stsr-btn { border-radius: 0; border: 0; border-left: 2px dashed color-mix(in srgb, var(--stsr-on-primary) 45%, transparent); padding-inline: 1.4rem; }

/* ---------- Buttons ---------- */
.stsr-btn {
	appearance: none; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2;
	background: var(--stsr-primary); color: var(--stsr-on-primary);
	border: 1px solid var(--stsr-primary); border-radius: var(--stsr-radius);
	padding: .75rem 1.3rem; transition: transform .12s, filter .15s, box-shadow .15s; text-decoration: none; display: inline-block;
}
.stsr-btn:hover { filter: brightness(1.07); box-shadow: 0 4px 14px -6px var(--stsr-primary); }
.stsr-btn:active { transform: translateY(1px); }
.stsr-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }
.stsr-btn--ghost { background: transparent; color: var(--stsr-primary); }
.stsr a:focus-visible, .stsr button:focus-visible, .stsr input:focus-visible, .stsr summary:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--stsr-primary) 45%, transparent); outline-offset: 2px;
}

/* ---------- Layout and navigation ---------- */
.stsr-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
@media (min-width: 880px) { .stsr-layout { grid-template-columns: 12.5rem minmax(0, 1fr); gap: 2rem; } }
.stsr-nav { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.stsr-nav a { display: flex; align-items: center; gap: .6rem; padding: .6rem .95rem; border-radius: var(--stsr-radius); text-decoration: none; color: var(--stsr-muted); white-space: nowrap; font-weight: 550; transition: background .15s, color .15s; }
.stsr-nav a:hover { background: var(--stsr-surface); color: var(--stsr-text); }
.stsr-nav a[aria-current] { background: var(--stsr-tint); color: var(--stsr-primary); }
.stsr-nav .stsr-ico { width: 18px; height: 18px; }
@media (min-width: 880px) { .stsr-nav { flex-direction: column; align-self: start; position: sticky; top: 1.5rem; overflow: visible; } }
.stsr-panel { min-width: 0; }

/* ---------- Getting started ---------- */
.stsr-start { background: var(--stsr-tint); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.stsr-start ul { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .45rem; }
.stsr-start li { display: flex; align-items: center; gap: .65rem; }
.stsr-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--stsr-line); display: grid; place-items: center; color: var(--stsr-on-primary); flex: none; }
.stsr-tick .stsr-ico { width: 14px; height: 14px; stroke-width: 3; }
.is-done .stsr-tick { background: var(--stsr-primary); border-color: var(--stsr-primary); }
.is-done a { color: var(--stsr-muted); text-decoration: line-through; }

/* ---------- Stats ---------- */
.stsr-range { display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: 1rem; background: var(--stsr-surface); border-radius: 999px; font-size: .88rem; }
.stsr-range a { padding: .3rem .85rem; border-radius: 999px; text-decoration: none; color: var(--stsr-muted); }
.stsr-range a[aria-current] { background: var(--stsr-bg); color: var(--stsr-text); box-shadow: var(--stsr-shadow); font-weight: 600; }
.stsr-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0 0 1.5rem; }
@media (min-width: 700px) { .stsr-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stsr-stats > div { position: relative; padding: 1rem 1.1rem; background: var(--stsr-card); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); box-shadow: var(--stsr-shadow); }
.stsr-stat-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--stsr-tint); color: var(--stsr-primary); margin-bottom: .6rem; }
.stsr-stat-ico .stsr-ico { width: 18px; height: 18px; }
.stsr-stats dt { margin: 0; color: var(--stsr-muted); font-size: .82rem; }
.stsr-stats dd { margin: 0; font-size: 1.65rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ---------- Charts ---------- */
.stsr-charts { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .stsr-charts { grid-template-columns: 1fr 1fr; } }
.stsr-charts figure { margin: 0; padding: 1rem 1.1rem; background: var(--stsr-card); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); box-shadow: var(--stsr-shadow); }
.stsr-charts figcaption { font-size: .85rem; font-weight: 600; color: var(--stsr-muted); margin-bottom: .5rem; }
.stsr-bars { width: 100%; height: 120px; display: block; }
.stsr-bars rect { fill: var(--stsr-primary); }
.stsr-charts figure:nth-child(2) .stsr-bars rect { fill: color-mix(in srgb, var(--stsr-primary) 55%, var(--stsr-accent)); }
.stsr-bars rect.is-zero { fill: var(--stsr-line); }

/* ---------- Feed ---------- */
.stsr-feed { list-style: none; margin: 0; padding: 0; background: var(--stsr-card); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); overflow: hidden; }
.stsr-feed li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.1rem; }
.stsr-feed li + li { border-top: 1px solid var(--stsr-line); }
.stsr-feed time { display: block; font-size: .8rem; color: var(--stsr-muted); }
.stsr-feed b { font-variant-numeric: tabular-nums; padding: .15rem .6rem; border-radius: 999px; font-size: .9rem; }
.stsr-feed .is-pos { color: var(--stsr-ok); background: color-mix(in srgb, var(--stsr-ok) 12%, var(--stsr-bg)); }
.stsr-feed .is-neg { color: var(--stsr-bad); background: color-mix(in srgb, var(--stsr-bad) 10%, var(--stsr-bg)); }

/* ---------- Forms ---------- */
.stsr-field { margin-bottom: 1rem; }
.stsr-field label { display: block; font-size: .9rem; margin-bottom: .3rem; font-weight: 600; }
.stsr input[type="text"], .stsr input[type="url"], .stsr input[type="number"] {
	width: 100%; padding: .72rem .95rem; font: inherit; color: var(--stsr-text); min-height: 2.9rem;
	background: var(--stsr-bg); border: 1px solid color-mix(in srgb, var(--stsr-text) 20%, transparent); border-radius: var(--stsr-radius);
	transition: border-color .15s, box-shadow .15s;
}
.stsr input[type="text"]:focus, .stsr input[type="url"]:focus, .stsr input[type="number"]:focus { border-color: var(--stsr-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stsr-primary) 18%, transparent); outline: 0; }
.stsr-form { max-width: 30rem; }
.stsr-inline { display: flex; gap: .5rem; max-width: 30rem; flex-wrap: wrap; }
.stsr-inline input { flex: 1; min-width: 8rem; }
.stsr-modes { border: 0; padding: 0; margin: 0 0 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stsr-modes legend { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; padding: 0; }
.stsr-modes label { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); cursor: pointer; background: var(--stsr-bg); font-weight: 550; }
.stsr-modes label:has(input:checked) { border-color: var(--stsr-primary); background: var(--stsr-tint); box-shadow: 0 0 0 1px var(--stsr-primary); }
.stsr-modes input { accent-color: var(--stsr-primary); }
.stsr-check { display: flex; gap: .6rem; align-items: center; margin: 1rem 0; }
.stsr-check input { accent-color: var(--stsr-primary); width: 1.1rem; height: 1.1rem; }
.stsr-terms { max-height: 10rem; overflow: auto; padding: .75rem 1rem; border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); font-size: .9rem; background: var(--stsr-surface); }
.stsr-share { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.stsr-share a { border: 1px solid var(--stsr-line); border-radius: 999px; padding: .35rem 1rem; font-size: .9rem; text-decoration: none; background: var(--stsr-bg); transition: background .15s, border-color .15s; }
.stsr-share a:hover { background: var(--stsr-tint); border-color: var(--stsr-primary); }

/* ---------- Tables ---------- */
.stsr-table-wrap { overflow-x: auto; background: var(--stsr-card); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); }
.stsr-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0; }
.stsr-table th { text-align: left; font-weight: 600; color: var(--stsr-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .75rem 1rem; background: var(--stsr-surface); white-space: nowrap; border: 0; }
.stsr-table td { padding: .75rem 1rem; border: 0; border-top: 1px solid var(--stsr-line); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
	.stsr-table thead { display: none; }
	.stsr-table, .stsr-table tbody, .stsr-table tr, .stsr-table td { display: block; width: 100%; }
	.stsr-table tr { padding: .6rem 0; border-top: 1px solid var(--stsr-line); }
	.stsr-table tr:first-child { border-top: 0; }
	.stsr-table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem 1rem; text-align: right; }
	.stsr-table td::before { content: attr(data-label); font-weight: 600; color: var(--stsr-muted); text-align: left; }
}
.stsr-pager { margin-top: 1rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.stsr-pager .page-numbers { padding: .35rem .8rem; border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); text-decoration: none; background: var(--stsr-bg); }
.stsr-pager .current { background: var(--stsr-primary); color: var(--stsr-on-primary); border-color: var(--stsr-primary); }

/* ---------- Status chips (fixed semantic colors) ---------- */
.stsr-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--stsr-surface); color: var(--stsr-muted); }
.stsr-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stsr-chip--approved, .stsr-chip--paid, .stsr-chip--active { color: var(--stsr-ok); background: color-mix(in srgb, var(--stsr-ok) 12%, var(--stsr-bg)); }
.stsr-chip--pending, .stsr-chip--requested { color: var(--stsr-warn); background: color-mix(in srgb, var(--stsr-warn) 12%, var(--stsr-bg)); }
.stsr-chip--rejected, .stsr-chip--reversed, .stsr-chip--suspended { color: var(--stsr-bad); background: color-mix(in srgb, var(--stsr-bad) 10%, var(--stsr-bg)); }

/* ---------- Alerts, empty states, apply ---------- */
.stsr-alert { padding: .85rem 1.1rem; border-radius: var(--stsr-radius); margin-bottom: 1rem; border: 1px solid var(--stsr-line); border-left-width: 4px; background: var(--stsr-surface); }
.stsr-alert--ok { border-left-color: var(--stsr-ok); background: color-mix(in srgb, var(--stsr-ok) 8%, var(--stsr-bg)); }
.stsr-alert--err { border-left-color: var(--stsr-bad); background: color-mix(in srgb, var(--stsr-bad) 7%, var(--stsr-bg)); }
.stsr-empty { max-width: 36rem; padding: 2rem 1.5rem; text-align: center; border: 1px dashed color-mix(in srgb, var(--stsr-text) 22%, transparent); border-radius: var(--stsr-radius); margin-inline: auto; }
.stsr-apply { max-width: 40rem; padding: 1.75rem; border: 1px solid var(--stsr-line); border-radius: calc(var(--stsr-radius) + 4px); background: var(--stsr-card); box-shadow: var(--stsr-shadow); }
.stsr-how { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.stsr-how li { display: flex; flex-direction: column; gap: .15rem; padding: .9rem; border-radius: var(--stsr-radius); background: var(--stsr-tint); font-size: .88rem; color: var(--stsr-muted); }
.stsr-how li .stsr-ico { color: var(--stsr-primary); margin-bottom: .35rem; }
.stsr-how b { color: var(--stsr-text); font-size: .95rem; }
@media (max-width: 520px) { .stsr-how { grid-template-columns: 1fr; } }

/* ---------- FAQ / help ---------- */
.stsr-faq-list { display: grid; gap: .6rem; }
.stsr-faq { background: var(--stsr-card); border: 1px solid var(--stsr-line); border-radius: var(--stsr-radius); }
.stsr-faq summary { cursor: pointer; list-style: none; padding: .9rem 1.1rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stsr-faq summary::-webkit-details-marker { display: none; }
.stsr-faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--stsr-primary); transition: transform .2s; }
.stsr-faq[open] summary::after { transform: rotate(45deg); }
.stsr-faq[open] { border-color: color-mix(in srgb, var(--stsr-primary) 35%, var(--stsr-line)); }
.stsr-faq__a { padding: 0 1.1rem 1rem; color: color-mix(in srgb, var(--stsr-text) 85%, var(--stsr-bg)); }
.stsr-faq__a ol, .stsr-faq__a ul { margin: 0 0 .5rem 1.2rem; padding: 0; }
.stsr-faq__a p:last-child { margin-bottom: 0; }
.stsr-help-card { display: flex; gap: .9rem; align-items: center; margin-top: 1.25rem; padding: 1rem 1.2rem; background: var(--stsr-tint); border-radius: var(--stsr-radius); }
.stsr-help-card .stsr-ico { width: 26px; height: 26px; color: var(--stsr-primary); }

@media (prefers-reduced-motion: reduce) { .stsr *, .stsr *::before { transition: none !important; } }
