/**
 * TradeButtons Support & QA — frontend styles.
 *
 * Design tokens follow the TradeButtons system:
 *   Standard look  -> .tbsq--look-standard, theme.json presets
 *   Cyber look     -> .tbsq--look-cyber, --tb-cyber-* variables
 * Both are supported; the tokens below resolve automatically.
 */

.tbsq {
	--tbsq-radius: 14px;
	--tbsq-radius-sm: 9px;
	--tbsq-gap: 18px;
	/*
	 * Fixed values on purpose: this site's theme INVERTS the
	 * --wp--preset--color--neutral-* scale in dark mode, so neutral-100 is a
	 * dark tone there. Deriving text colours from those presets produced dark
	 * text on dark cards. Only the brand accents are taken from the presets,
	 * because those are not inverted.
	 */
	--tbsq-bg: #ffffff;
	--tbsq-surface: #f9fafb;
	--tbsq-surface-2: #f1f3f6;
	--tbsq-border: rgba(15, 23, 42, 0.12);
	--tbsq-border-strong: rgba(15, 23, 42, 0.22);
	--tbsq-text: #16202e;
	--tbsq-muted: #5a6474;
	--tbsq-accent: var(--wp--preset--color--primary-600, #0891b2);
	--tbsq-accent-soft: #e8fbff;
	--tbsq-accent-text: #ffffff;
	--tbsq-success: var(--wp--preset--color--success-600, #059669);
	--tbsq-warning: var(--wp--preset--color--warning-600, #d97706);
	--tbsq-danger: var(--wp--preset--color--error-600, #e11d48);
	--tbsq-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
	--tbsq-font: var(--wp--preset--font-family--inter, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
	--tbsq-mono: var(--wp--preset--font-family--jetbrains-mono, "JetBrains Mono", ui-monospace, monospace);

	position: relative;
	z-index: 2;
	font-family: var(--tbsq-font);
	color: var(--tbsq-text);
	line-height: 1.55;
}

/* ---------------------------------------------------------------------
 * Palette selection.
 *
 * Light/dark and the look toggle are two INDEPENDENT switches on this site:
 *   blockifyDarkMode cookie -> is-style-dark   (default: dark)
 *   tb_look cookie          -> cyber/standard  (default: cyber)
 * Relying on the ancestor classes made the palette depend on stylesheet
 * order, which produced light cards with light text. The container therefore
 * carries its own resolved state (tbsq--dark / tbsq--light / tbsq--look-*),
 * stamped server side, and every token below keys off that single element.
 * The ancestor selectors stay as a fallback for cached markup.
 * ------------------------------------------------------------------- */

.tbsq.tbsq--dark,
body.is-style-dark .tbsq,
.tbsq[data-scheme="dark"] {
	/*
	 * Soft off-white instead of #fff: long support threads on a near-black
	 * page are tiring to read at maximum contrast.
	 */
	--tbsq-bg: #0d1522;
	--tbsq-surface: rgba(255, 255, 255, 0.045);
	--tbsq-surface-2: rgba(255, 255, 255, 0.085);
	--tbsq-border: rgba(255, 255, 255, 0.16);
	--tbsq-border-strong: rgba(255, 255, 255, 0.3);
	--tbsq-text: #dfe7f0;
	--tbsq-muted: #9aa7b8;
	--tbsq-accent: #22d3ee;
	--tbsq-accent-soft: rgba(34, 211, 238, 0.16);
	--tbsq-accent-text: #04121a;
	--tbsq-success: #34d399;
	--tbsq-warning: #fbbf24;
	--tbsq-danger: #fb7185;
	--tbsq-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* TradeButtons Cyber look --------------------------------------------- */
.tbsq.tbsq--look-cyber,
body.tb-look-cyber .tbsq {
	--tbsq-bg: var(--tb-cyber-panel, rgba(5, 12, 25, 0.4));
	--tbsq-surface: rgba(5, 14, 28, 0.62);
	--tbsq-surface-2: rgba(9, 22, 42, 0.72);
	--tbsq-border: var(--tb-cyber-line-soft, rgba(42, 231, 255, 0.2));
	--tbsq-border-strong: var(--tb-cyber-line, rgba(42, 231, 255, 0.48));
	--tbsq-text: #d8ecf7;
	--tbsq-muted: #93a8c9;
	--tbsq-accent: var(--tb-cyber-blue, #2ae7ff);
	--tbsq-accent-soft: rgba(42, 231, 255, 0.12);
	--tbsq-accent-text: #02121b;
	--tbsq-success: var(--tb-cyber-green, #2ff2a0);
	--tbsq-danger: var(--tb-cyber-red, #ff4d72);
	--tbsq-shadow: 0 0 0 1px rgba(42, 231, 255, 0.08), 0 14px 36px rgba(2, 6, 23, 0.55);
}

/*
 * The TradeButtons look toggle (cookie tb_look) is independent of light/dark:
 * a site can run "Standard-Look" while `is-style-dark` is active. So the
 * standard look must NOT force light colours — only the genuinely light case
 * gets the bright surface, otherwise the dark palette above stays in charge.
 */
.tbsq.tbsq--look-standard.tbsq--light,
body.tb-look-standard:not(.is-style-dark) .tbsq {
	--tbsq-bg: #ffffff;
	--tbsq-surface: #f8fafc;
	--tbsq-text: #0f172a;
}

/* Layout primitives --------------------------------------------------- */

.tbsq * {
	box-sizing: border-box;
}

.tbsq-head {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tbsq-gap);
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: var(--tbsq-gap);
}

.tbsq-head__title {
	margin: 0 0 4px;
	font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
	letter-spacing: -0.01em;
}

.tbsq-head__sub {
	margin: 0;
	color: var(--tbsq-muted);
	max-width: 62ch;
}

.tbsq-card,
.tbsq-panel > .tbsq-form,
.tbsq-item,
.tbsq-detail,
.tbsq-filters {
	background: var(--tbsq-surface);
	border: 1px solid var(--tbsq-border);
	border-radius: var(--tbsq-radius);
	box-shadow: var(--tbsq-shadow);
	padding: clamp(14px, 2vw, 24px);
}

.tbsq-card--center {
	text-align: center;
}

.tbsq-card--success {
	border-color: color-mix(in srgb, var(--tbsq-success) 55%, transparent);
	background: color-mix(in srgb, var(--tbsq-success) 10%, var(--tbsq-surface));
}

.tbsq-card--error {
	border-color: color-mix(in srgb, var(--tbsq-danger) 55%, transparent);
	background: color-mix(in srgb, var(--tbsq-danger) 10%, var(--tbsq-surface));
}

.tbsq-card__title {
	margin: 0 0 8px;
	font-size: 1.15rem;
}

.tbsq-sub {
	margin: 22px 0 8px;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--tbsq-muted);
}

.tbsq-muted {
	color: var(--tbsq-muted);
}

.tbsq-ticketno {
	display: inline-block;
	font-family: var(--tbsq-mono);
	font-size: 0.78rem;
	letter-spacing: 0.04em;
	color: var(--tbsq-accent);
}

/* Tabs ---------------------------------------------------------------- */

.tbsq-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: var(--tbsq-gap);
	border-bottom: 1px solid var(--tbsq-border);
	padding-bottom: 6px;
}

.tbsq-tab {
	appearance: none;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--tbsq-radius-sm);
	color: var(--tbsq-muted);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 8px 16px;
	transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tbsq-tab:hover {
	color: var(--tbsq-text);
	background: var(--tbsq-surface-2);
}

.tbsq-tab.is-active {
	background: var(--tbsq-accent-soft);
	border-color: var(--tbsq-border-strong);
	color: var(--tbsq-text);
}

.tbsq-tab:focus-visible,
.tbsq-btn:focus-visible,
.tbsq input:focus-visible,
.tbsq select:focus-visible,
.tbsq textarea:focus-visible,
.tbsq-item:focus-visible {
	outline: 2px solid var(--tbsq-accent);
	outline-offset: 2px;
}

.is-hidden {
	display: none !important;
}

/* Buttons ------------------------------------------------------------- */

.tbsq-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	padding: 8px 16px;
	border-radius: var(--tbsq-radius-sm);
	border: 1px solid var(--tbsq-border-strong);
	background: var(--tbsq-surface-2);
	color: var(--tbsq-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}

.tbsq-btn:hover:not(:disabled) {
	border-color: var(--tbsq-accent);
}

.tbsq-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.tbsq-btn:disabled {
	opacity: 0.55;
	cursor: progress;
}

.tbsq-btn--primary {
	background: var(--tbsq-accent);
	border-color: var(--tbsq-accent);
	color: var(--tbsq-accent-text);
}

.tbsq-btn--ghost {
	background: transparent;
}

.tbsq-btn--small {
	min-height: 32px;
	padding: 4px 10px;
	font-size: 0.85rem;
}

.tbsq-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
}

/* Forms --------------------------------------------------------------- */

.tbsq-form {
	display: block;
}


/* Ein Raster als direktes Kind eines <fieldset> bekommt eine unbestimmte
   Breite (Shrink-to-fit); `1fr`-Spalten fallen dadurch auf 0 und die Felder
   quellen rechts heraus. Gemessen 14.08.2026: Raster 0 px bei 1948 px
   Rahmeninnenbreite. Mit fester Breite: 1920 px, vier Spalten a 469,5 px. */
.tbsq-fieldset > .tbsq-grid,
fieldset > .tbsq-grid {
	width: 100%;
	min-width: 0;
}

.tbsq-grid {
	display: grid;
	gap: 14px;
	margin-bottom: 14px;
}

.tbsq-grid--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tbsq-grid--4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tbsq-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-bottom: 14px;
	min-width: 0;
}

.tbsq-field--grow {
	flex: 1 1 220px;
}

.tbsq-label {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--tbsq-muted);
}

.tbsq-req {
	color: var(--tbsq-danger);
}

.tbsq-hint {
	font-size: 0.78rem;
	color: var(--tbsq-muted);
}

.tbsq input[type="text"],
.tbsq input[type="email"],
.tbsq input[type="url"],
.tbsq input[type="search"],
.tbsq input[type="date"],
.tbsq select,
.tbsq textarea {
	width: 100%;
	min-height: 42px;
	padding: 9px 12px;
	border-radius: var(--tbsq-radius-sm);
	border: 1px solid var(--tbsq-border);
	background: var(--tbsq-bg);
	color: var(--tbsq-text);
	font: inherit;
	transition: border-color 0.16s ease;
}

.tbsq textarea {
	min-height: 110px;
	resize: vertical;
	line-height: 1.5;
}

.tbsq input:hover,
.tbsq select:hover,
.tbsq textarea:hover {
	border-color: var(--tbsq-border-strong);
}

.tbsq-fieldset {
	border: 1px dashed var(--tbsq-border);
	border-radius: var(--tbsq-radius-sm);
	padding: 12px 14px;
	margin: 0 0 16px;
}

.tbsq-fieldset legend {
	padding: 0 6px;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--tbsq-muted);
}

.tbsq-check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin: 10px 0;
	font-size: 0.92rem;
}

.tbsq-check input {
	margin-top: 3px;
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
}

.tbsq-check--inline {
	align-items: center;
	margin: 0;
	white-space: nowrap;
}

.tbsq-checkgrid {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 18px;
}

.tbsq-note {
	margin: 12px 0;
	padding: 10px 12px;
	border-left: 3px solid var(--tbsq-border-strong);
	border-radius: 0 var(--tbsq-radius-sm) var(--tbsq-radius-sm) 0;
	background: var(--tbsq-surface-2);
	font-size: 0.88rem;
}

.tbsq-note--warn {
	border-left-color: var(--tbsq-warning);
}

.tbsq-note--action {
	border-left-color: var(--tbsq-accent);
	background: var(--tbsq-accent-soft);
	font-weight: 600;
}

.tbsq-status {
	font-size: 0.88rem;
	color: var(--tbsq-muted);
}

.tbsq-status.is-ok {
	color: var(--tbsq-success);
	font-weight: 600;
}

.tbsq-status.is-error {
	color: var(--tbsq-danger);
	font-weight: 600;
}

/* Honeypot: off-screen but not display:none, so bots still fill it. */
.tbsq-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Filters ------------------------------------------------------------- */

.tbsq-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 10px 14px;
	margin-bottom: var(--tbsq-gap);
}

.tbsq-filters .tbsq-field {
	margin-bottom: 0;
	min-width: 150px;
}

.tbsq-filters__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	width: 100%;
}

.tbsq-inline-select {
	min-height: 34px !important;
	width: auto !important;
	min-width: 150px;
	padding: 4px 8px !important;
}

.tbsq-bulk {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	margin-bottom: 12px;
	border: 1px solid var(--tbsq-accent);
	border-radius: var(--tbsq-radius-sm);
	background: var(--tbsq-accent-soft);
}

/* Ticket list --------------------------------------------------------- */

.tbsq-list {
	display: grid;
	gap: 12px;
}

.tbsq-item {
	cursor: pointer;
	padding: 14px 16px;
	transition: border-color 0.16s ease, transform 0.12s ease;
}

.tbsq-item:hover {
	border-color: var(--tbsq-accent);
	transform: translateY(-1px);
}

.tbsq-item.is-overdue {
	border-left: 4px solid var(--tbsq-warning);
}

.tbsq-item.is-critical {
	border-left: 4px solid var(--tbsq-danger);
}

.tbsq-item__head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.tbsq-item__check {
	width: 18px;
	height: 18px;
	margin-top: 4px;
	flex: 0 0 auto;
}

.tbsq-item__title {
	flex: 1 1 auto;
	min-width: 0;
}

.tbsq-item__title h3 {
	margin: 2px 0 0;
	font-size: 1.03rem;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.tbsq-item__meta,
.tbsq-item__flags,
.tbsq-item__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-top: 10px;
	align-items: center;
}

.tbsq-chip {
	display: inline-flex;
	gap: 5px;
	align-items: baseline;
	padding: 3px 9px;
	border-radius: 999px;
	border: 1px solid var(--tbsq-border);
	background: var(--tbsq-surface-2);
	font-size: 0.76rem;
	white-space: nowrap;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tbsq-chip__k {
	color: var(--tbsq-muted);
}

.tbsq-chip__v {
	font-weight: 600;
}

.tbsq-chip--prio-critical {
	border-color: var(--tbsq-danger);
	color: var(--tbsq-danger);
}

.tbsq-chip--prio-high {
	border-color: var(--tbsq-warning);
}

.tbsq-chip--danger {
	border-color: var(--tbsq-danger);
	color: var(--tbsq-danger);
}

.tbsq-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 11px;
	border-radius: 999px;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
	flex: 0 0 auto;
}

.tbsq-badge--status {
	--tbsq-badge-color: var(--tbsq-accent);
	color: var(--tbsq-badge-color);
	border: 1px solid var(--tbsq-badge-color);
	background: color-mix(in srgb, var(--tbsq-badge-color) 14%, transparent);
}

.tbsq-badge--internal {
	background: var(--tbsq-warning);
	color: #1a1205;
}

.tbsq-flag {
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 0.74rem;
	font-weight: 700;
}

.tbsq-flag--unread {
	background: var(--tbsq-accent);
	color: var(--tbsq-accent-text);
}

.tbsq-flag--overdue {
	background: var(--tbsq-warning);
	color: #1a1205;
}

.tbsq-flag--action {
	background: var(--tbsq-accent-soft);
	color: var(--tbsq-text);
	border: 1px solid var(--tbsq-accent);
}

.tbsq-empty,
.tbsq-loading {
	padding: 28px 16px;
	text-align: center;
	color: var(--tbsq-muted);
	border: 1px dashed var(--tbsq-border);
	border-radius: var(--tbsq-radius);
}

.tbsq-empty--error {
	color: var(--tbsq-danger);
	border-color: var(--tbsq-danger);
}

.tbsq-empty--small {
	padding: 10px;
	border: none;
}

.tbsq-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 16px;
}

/* Detail -------------------------------------------------------------- */

.tbsq-detail__head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-start;
	justify-content: space-between;
	margin-bottom: 12px;
}

.tbsq-detail__head h2 {
	margin: 2px 0 0;
	font-size: 1.35rem;
	overflow-wrap: anywhere;
}

.tbsq-detail__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
	gap: var(--tbsq-gap);
	align-items: start;
}

.tbsq-thread {
	display: grid;
	gap: 12px;
	margin-bottom: 18px;
	max-height: 62vh;
	overflow-y: auto;
	padding-right: 4px;
}

.tbsq-msg {
	border: 1px solid var(--tbsq-border);
	border-radius: var(--tbsq-radius-sm);
	padding: 12px 14px;
	background: var(--tbsq-bg);
}

.tbsq-msg--customer {
	border-left: 4px solid var(--tbsq-border-strong);
}

.tbsq-msg--team {
	border-left: 4px solid var(--tbsq-accent);
	background: var(--tbsq-accent-soft);
}

.tbsq-msg--internal {
	border-left: 4px solid var(--tbsq-warning);
	background: color-mix(in srgb, var(--tbsq-warning) 12%, var(--tbsq-bg));
	border-style: dashed;
}

.tbsq-msg--system {
	font-style: italic;
	opacity: 0.85;
}

.tbsq-msg__head {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 6px;
	font-size: 0.82rem;
	color: var(--tbsq-muted);
}

.tbsq-msg__head strong {
	color: var(--tbsq-text);
}

.tbsq-msg__body {
	overflow-wrap: anywhere;
}

.tbsq-msg__files {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 10px;
}

.tbsq-att {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: var(--tbsq-radius-sm);
	border: 1px solid var(--tbsq-border);
	background: var(--tbsq-surface-2);
	font-size: 0.82rem;
	text-decoration: none;
	color: inherit;
	max-width: 100%;
}

.tbsq-att--img {
	flex-direction: column;
	width: 132px;
	align-items: stretch;
}

.tbsq-att--img img {
	width: 100%;
	height: 88px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.tbsq-att--img span {
	font-size: 0.72rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tbsq-meta {
	margin: 0 0 16px;
	display: grid;
	gap: 6px;
}

.tbsq-meta__row {
	display: grid;
	grid-template-columns: minmax(110px, 40%) 1fr;
	gap: 8px;
	padding-bottom: 5px;
	border-bottom: 1px dotted var(--tbsq-border);
	font-size: 0.85rem;
}

.tbsq-meta dt {
	color: var(--tbsq-muted);
	margin: 0;
}

.tbsq-meta dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.tbsq-longfield {
	margin-bottom: 12px;
}

.tbsq-longfield h4 {
	margin: 0 0 4px;
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--tbsq-muted);
}

.tbsq-longfield p {
	margin: 0;
	font-size: 0.9rem;
}

/* Reply --------------------------------------------------------------- */

.tbsq-reply {
	border: 1px solid var(--tbsq-border);
	border-radius: var(--tbsq-radius);
	padding: 14px;
	background: var(--tbsq-surface-2);
	transition: border-color 0.2s ease, background 0.2s ease;
}

.tbsq-reply.is-internal {
	border-color: var(--tbsq-warning);
	border-style: dashed;
	background: color-mix(in srgb, var(--tbsq-warning) 9%, var(--tbsq-surface-2));
}

.tbsq-reply__mode {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 8px;
}

.tbsq-radio {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px solid var(--tbsq-border-strong);
	cursor: pointer;
	font-size: 0.86rem;
	font-weight: 600;
}

.tbsq-radio.is-internal:has(input:checked) {
	background: var(--tbsq-warning);
	color: #1a1205;
	border-color: var(--tbsq-warning);
}

.tbsq-radio.is-public:has(input:checked) {
	background: var(--tbsq-accent);
	color: var(--tbsq-accent-text);
	border-color: var(--tbsq-accent);
}

.tbsq-reply__warn {
	margin: 0 0 8px;
	font-size: 0.84rem;
	font-weight: 700;
}

.tbsq-reply__warn.is-internal {
	color: var(--tbsq-warning);
}

.tbsq-reply__warn.is-public {
	color: var(--tbsq-accent);
}

/* Uploads ------------------------------------------------------------- */

.tbsq-upload {
	margin: 12px 0;
}

.tbsq-upload__drop {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 18px;
	border: 2px dashed var(--tbsq-border-strong);
	border-radius: var(--tbsq-radius);
	background: var(--tbsq-bg);
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease;
}

.tbsq-upload__drop.is-over {
	border-color: var(--tbsq-accent);
	background: var(--tbsq-accent-soft);
}

.tbsq-upload__drop input[type="file"] {
	max-width: 100%;
}

.tbsq-upload__preview {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.tbsq-upload__item {
	position: relative;
	width: 128px;
	padding: 8px;
	border: 1px solid var(--tbsq-border);
	border-radius: var(--tbsq-radius-sm);
	background: var(--tbsq-surface-2);
	font-size: 0.72rem;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tbsq-upload__item img {
	width: 100%;
	height: 76px;
	object-fit: cover;
	border-radius: 6px;
}

.tbsq-upload__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tbsq-upload__size {
	color: var(--tbsq-muted);
}

.tbsq-upload__remove {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--tbsq-border-strong);
	background: var(--tbsq-danger);
	color: #fff;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.tbsq-upload__error {
	margin: 8px 0 0;
	color: var(--tbsq-danger);
	font-size: 0.82rem;
	font-weight: 600;
}

/* Checklist ----------------------------------------------------------- */

.tbsq-progress {
	height: 8px;
	border-radius: 999px;
	background: var(--tbsq-surface-2);
	overflow: hidden;
	border: 1px solid var(--tbsq-border);
}

.tbsq-progress__bar {
	height: 100%;
	background: var(--tbsq-accent);
	transition: width 0.3s ease;
}

.tbsq-cl__list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: grid;
	gap: 4px;
}

.tbsq-cl__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 6px;
	border-radius: var(--tbsq-radius-sm);
	font-size: 0.87rem;
}

.tbsq-cl__item:hover {
	background: var(--tbsq-surface-2);
}

.tbsq-cl__item label {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	cursor: pointer;
	min-width: 0;
}

.tbsq-cl__item input {
	width: 17px;
	height: 17px;
	flex: 0 0 auto;
}

.tbsq-cl__item.is-done .tbsq-cl__label {
	text-decoration: line-through;
	color: var(--tbsq-muted);
}

.tbsq-cl__meta {
	font-size: 0.72rem;
	color: var(--tbsq-muted);
	white-space: nowrap;
}

.tbsq-cl__del {
	border: none;
	background: transparent;
	color: var(--tbsq-muted);
	cursor: pointer;
	font-size: 17px;
	line-height: 1;
	padding: 0 4px;
}

.tbsq-cl__del:hover {
	color: var(--tbsq-danger);
}

.tbsq-cl__add {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}

/* Controls & history -------------------------------------------------- */

.tbsq-controls {
	display: grid;
	gap: 10px;
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid var(--tbsq-border);
}

.tbsq-controls .tbsq-field {
	margin-bottom: 0;
}

.tbsq-controls__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.tbsq-history {
	margin-top: 18px;
	font-size: 0.84rem;
}

.tbsq-history summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--tbsq-muted);
	padding: 6px 0;
}

.tbsq-history ul {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: grid;
	gap: 6px;
	max-height: 320px;
	overflow-y: auto;
}

.tbsq-history li {
	padding-bottom: 5px;
	border-bottom: 1px dotted var(--tbsq-border);
	overflow-wrap: anywhere;
}

.tbsq-history time {
	color: var(--tbsq-muted);
	font-family: var(--tbsq-mono);
	font-size: 0.74rem;
}

/* Board --------------------------------------------------------------- */

.tbsq-board {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(240px, 1fr);
	gap: 12px;
	overflow-x: auto;
	padding-bottom: 10px;
}

.tbsq-col {
	--tbsq-col-color: var(--tbsq-accent);
	border: 1px solid var(--tbsq-border);
	border-top: 3px solid var(--tbsq-col-color);
	border-radius: var(--tbsq-radius);
	background: var(--tbsq-surface);
	display: flex;
	flex-direction: column;
	min-height: 220px;
}

.tbsq-col.is-target {
	border-color: var(--tbsq-accent);
	background: var(--tbsq-accent-soft);
}

.tbsq-col__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--tbsq-border);
}

.tbsq-col__head h3 {
	margin: 0;
	font-size: 0.9rem;
}

.tbsq-col__count {
	font-size: 0.78rem;
	color: var(--tbsq-muted);
	background: var(--tbsq-surface-2);
	border-radius: 999px;
	padding: 2px 9px;
}

.tbsq-col__body {
	padding: 10px;
	display: grid;
	gap: 8px;
	align-content: start;
	overflow-y: auto;
	max-height: 66vh;
}

.tbsq-card-mini {
	display: grid;
	gap: 5px;
	padding: 10px;
	border: 1px solid var(--tbsq-border);
	border-radius: var(--tbsq-radius-sm);
	background: var(--tbsq-bg);
	cursor: pointer;
	transition: border-color 0.16s ease;
}

.tbsq-card-mini:hover {
	border-color: var(--tbsq-accent);
}

.tbsq-card-mini.is-dragging {
	opacity: 0.5;
}

.tbsq-card-mini strong {
	font-size: 0.88rem;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.tbsq-card-mini__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.tbsq-card-mini__meta .tbsq-chip {
	font-size: 0.68rem;
	padding: 2px 7px;
}

/* Bell ---------------------------------------------------------------- */

.tbsq-bell {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px solid var(--tbsq-border-strong);
	cursor: pointer;
	font-size: 0.86rem;
	font-weight: 600;
}

.tbsq-bell.has-new {
	border-color: var(--tbsq-accent);
	background: var(--tbsq-accent-soft);
}

/* Files list (guest view) --------------------------------------------- */

.tbsq-files {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 6px;
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 980px) {
	.tbsq-detail__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.tbsq-grid--4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.tbsq-grid--2,
	.tbsq-grid--4 {
		grid-template-columns: minmax(0, 1fr);
	}

	.tbsq-filters .tbsq-field {
		min-width: 100%;
	}

	.tbsq-head {
		align-items: flex-start;
	}

	.tbsq-item__meta .tbsq-chip {
		font-size: 0.72rem;
	}

	.tbsq-thread {
		max-height: none;
	}

	.tbsq-board {
		grid-auto-flow: row;
		grid-auto-columns: auto;
	}

	.tbsq-col__body {
		max-height: none;
	}
}

/* ---------------------------------------------------------------------
 * Theme overrides.
 *
 * The TradeButtons cyber skin styles every `button`, `select` and `input`
 * with !important, and theme.json styles `[type="submit"]` with a higher
 * specificity than a single class. Both would strip our buttons and badges
 * of their meaning-carrying colours. These rules win by specificity and are
 * scoped to `.tbsq`, so nothing outside the ticket system is affected.
 * ------------------------------------------------------------------- */

body .tbsq .tbsq-btn,
body.tb-look-cyber .tbsq .tbsq-btn,
body.tb-look-standard .tbsq .tbsq-btn {
	background: var(--tbsq-surface-2) !important;
	border: 1px solid var(--tbsq-border-strong) !important;
	border-radius: var(--tbsq-radius-sm) !important;
	color: var(--tbsq-text) !important;
	min-height: 40px !important;
	height: auto !important;
	padding: 8px 16px !important;
	font-weight: 600 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

body .tbsq .tbsq-btn--primary,
body.tb-look-cyber .tbsq .tbsq-btn--primary,
body.tb-look-standard .tbsq .tbsq-btn--primary {
	background: var(--tbsq-accent) !important;
	border-color: var(--tbsq-accent) !important;
	color: var(--tbsq-accent-text) !important;
}

body .tbsq .tbsq-btn--ghost {
	background: transparent !important;
}

body .tbsq .tbsq-btn--small {
	min-height: 32px !important;
	padding: 4px 10px !important;
	font-size: 0.85rem !important;
}

body .tbsq .tbsq-btn:hover:not(:disabled) {
	border-color: var(--tbsq-accent) !important;
}

body .tbsq .tbsq-tab {
	background: transparent !important;
	border: 1px solid transparent !important;
	color: var(--tbsq-muted) !important;
	min-height: 0 !important;
}

body .tbsq .tbsq-tab.is-active {
	background: var(--tbsq-accent-soft) !important;
	border-color: var(--tbsq-border-strong) !important;
	color: var(--tbsq-text) !important;
}

body .tbsq .tbsq-badge--status {
	color: var(--tbsq-badge-color) !important;
	border: 1px solid var(--tbsq-badge-color) !important;
	background: color-mix(in srgb, var(--tbsq-badge-color) 14%, transparent) !important;
}

body .tbsq .tbsq-badge--internal,
body .tbsq .tbsq-flag--overdue {
	background: var(--tbsq-warning) !important;
	color: #1a1205 !important;
}

body .tbsq .tbsq-flag--unread {
	background: var(--tbsq-accent) !important;
	color: var(--tbsq-accent-text) !important;
}

body .tbsq .tbsq-upload__remove {
	background: var(--tbsq-danger) !important;
	color: #fff !important;
	min-height: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
}

body .tbsq .tbsq-cl__del {
	background: transparent !important;
	border: none !important;
	min-height: 0 !important;
	padding: 0 4px !important;
	color: var(--tbsq-muted) !important;
}

body .tbsq .tbsq-radio.is-internal:has(input:checked) {
	background: var(--tbsq-warning) !important;
	color: #1a1205 !important;
	border-color: var(--tbsq-warning) !important;
}

body .tbsq .tbsq-radio.is-public:has(input:checked) {
	background: var(--tbsq-accent) !important;
	color: var(--tbsq-accent-text) !important;
	border-color: var(--tbsq-accent) !important;
}

body .tbsq .tbsq-progress__bar {
	background: var(--tbsq-accent) !important;
}

/* ---------------------------------------------------------------------
 * Browser autofill.
 *
 * Chrome and Safari paint autofilled fields with their own opaque white
 * background and ignore `background-color`. On the dark TradeButtons look
 * that turns a filled form into hard white blocks. The only reliable way to
 * keep our surface is an inset shadow plus text-fill-color.
 * ------------------------------------------------------------------- */

.tbsq input:-webkit-autofill,
.tbsq input:-webkit-autofill:hover,
.tbsq input:-webkit-autofill:focus,
.tbsq input:-webkit-autofill:active,
.tbsq textarea:-webkit-autofill,
.tbsq select:-webkit-autofill {
	-webkit-text-fill-color: var(--tbsq-text) !important;
	caret-color: var(--tbsq-text);
	-webkit-box-shadow: 0 0 0 1000px var(--tbsq-input-bg) inset !important;
	box-shadow: 0 0 0 1000px var(--tbsq-input-bg) inset !important;
	background-clip: content-box !important;
	transition: background-color 9999s ease-out 0s;
}

/* ---------------------------------------------------------------------
 * Comfort pass.
 *
 * Pure white on near-black is exhausting to read for longer support
 * threads. Inputs sit one step above the page instead of glaring, text uses
 * the theme's soft tone rather than #fff, and borders carry the structure.
 * ------------------------------------------------------------------- */

.tbsq {
	--tbsq-input-bg: #ffffff;
	--tbsq-placeholder: var(--tbsq-muted);
}

.tbsq.tbsq--dark,
body.is-style-dark .tbsq {
	--tbsq-input-bg: rgba(255, 255, 255, 0.06);
}

.tbsq.tbsq--look-cyber,
body.tb-look-cyber .tbsq {
	--tbsq-input-bg: rgba(9, 20, 38, 0.78);
	--tbsq-placeholder: rgba(145, 166, 207, 0.75);
}

.tbsq.tbsq--look-standard.tbsq--light,
body.tb-look-standard:not(.is-style-dark) .tbsq {
	--tbsq-input-bg: #ffffff;
}

body .tbsq input[type="text"],
body .tbsq input[type="email"],
body .tbsq input[type="url"],
body .tbsq input[type="search"],
body .tbsq input[type="date"],
body .tbsq input[type="number"],
body .tbsq select,
body .tbsq textarea {
	background: var(--tbsq-input-bg) !important;
	color: var(--tbsq-text) !important;
	border: 1px solid var(--tbsq-border) !important;
	border-radius: var(--tbsq-radius-sm) !important;
	box-shadow: none !important;
}

body .tbsq input::placeholder,
body .tbsq textarea::placeholder {
	color: var(--tbsq-placeholder);
	opacity: 1;
}

body .tbsq input:focus,
body .tbsq select:focus,
body .tbsq textarea:focus {
	border-color: var(--tbsq-accent) !important;
}

/* ---------------------------------------------------------------------
 * Aufklappliste des `select` (natives Popup).
 *
 * Das aufgeklappte Menue zeichnet der Browser selbst. Die `option`-Eintraege
 * erben dabei nur die TEXTFARBE des Feldes (hell), nicht dessen
 * halbtransparenten Hintergrund — das Popup blieb weiss. Ergebnis: heller
 * Text auf hellem Grund, praktisch unlesbar. `color-scheme` stellt das
 * native Widget auf die passende Variante um; die expliziten Farben decken
 * die Browser ab, die das ignorieren. Reihenfolge wie bei der Palette oben:
 * Basis (hell) -> dark -> cyber -> standard+light.
 *
 * Die Werte sind bewusst DECKEND: ein Popup kann keine Transparenz gegen
 * die Seite mischen, halbtransparente Tokens landen dort wieder auf Weiss.
 * ------------------------------------------------------------------- */

.tbsq {
	--tbsq-scheme: light;
	--tbsq-option-bg: #ffffff;
	--tbsq-option-text: #16202e;
}

.tbsq.tbsq--dark,
body.is-style-dark .tbsq,
.tbsq[data-scheme="dark"] {
	--tbsq-scheme: dark;
	--tbsq-option-bg: #16202e;
	--tbsq-option-text: #dfe7f0;
}

.tbsq.tbsq--look-cyber,
body.tb-look-cyber .tbsq {
	--tbsq-scheme: dark;
	--tbsq-option-bg: #0b1a2e;
	--tbsq-option-text: #d8ecf7;
}

.tbsq.tbsq--look-standard.tbsq--light,
body.tb-look-standard:not(.is-style-dark) .tbsq {
	--tbsq-scheme: light;
	--tbsq-option-bg: #ffffff;
	--tbsq-option-text: #0f172a;
}

body .tbsq select {
	color-scheme: var(--tbsq-scheme);
}

body .tbsq select option,
body .tbsq select optgroup {
	background-color: var(--tbsq-option-bg);
	color: var(--tbsq-option-text);
}

body .tbsq select optgroup {
	font-weight: 600;
}

/* Keep the reading surface calm: no pure-white text on the dark looks. */
.tbsq.tbsq--look-cyber .tbsq-msg__body,
.tbsq.tbsq--look-cyber .tbsq-longfield p,
.tbsq.tbsq--look-cyber .tbsq-meta dd,
body.tb-look-cyber .tbsq .tbsq-msg__body,
body.tb-look-cyber .tbsq .tbsq-longfield p,
body.tb-look-cyber .tbsq .tbsq-meta dd {
	color: #cfe4f2;
}

.tbsq.tbsq--look-cyber .tbsq-note,
body.tb-look-cyber .tbsq .tbsq-note {
	background: rgba(9, 22, 42, 0.55);
}

@media (prefers-reduced-motion: reduce) {
	.tbsq *,
	.tbsq *::before,
	.tbsq *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.tbsq-tabs,
	.tbsq-filters,
	.tbsq-reply,
	.tbsq-controls,
	.tbsq-bulk {
		display: none !important;
	}
}
