/**
 * Support desk styling, front and back.
 *
 * One stylesheet for both because the thread is the same component in both
 * places; the tokens below fall back to literals so the admin, which does not
 * load the theme's token sheet, still renders correctly.
 */

.fvt {
	--fvt-ink: var(--fv-ink, #16181d);
	--fvt-ink-2: var(--fv-ink-2, #5c6370);
	--fvt-line: var(--fv-line, #e6e8ec);
	--fvt-accent: var(--fv-accent, #fe5502);
	--fvt-surface: var(--fv-surface, #fff);
}

/* ── shared thread ─────────────────────────────────────────────── */

.fvt-thread {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fvt-msg {
	border: 1px solid var(--fvt-line, #e6e8ec);
	border-radius: 10px;
	padding: 12px 14px;
	background: var(--fvt-surface, #fff);
}

.fvt-msg.is-staff {
	border-color: #d9e4f5;
	background: #f6f9ff;
}

/*
 * An internal note has to be unmistakable at a glance. It is the one thing on
 * this screen that must never be confused with a message the customer can
 * read, and a colour alone does not survive being skimmed — hence the rule
 * down the side and the label in the header.
 */
.fvt-msg.is-note {
	border-color: #f0c36d;
	background: #fffaf0;
	border-left: 4px solid #e8a33d;
}

.fvt-msg.is-system {
	border: 0;
	background: none;
	padding: 2px 0;
	color: var(--fvt-ink-2, #5c6370);
	font-size: 13px;
}

.fvt-msg-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 6px;
	font-size: 13px;
}

.fvt-note-flag {
	background: #e8a33d;
	color: #fff;
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 600;
}

.fvt-when {
	margin-left: auto;
	color: var(--fvt-ink-2, #5c6370);
	font-size: 12px;
}

.fvt-msg-body {
	line-height: 1.6;
	word-break: break-word;
}

.fvt-msg-body p:last-child {
	margin-bottom: 0;
}

.fvt-files {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.fvt-files img {
	border-radius: 6px;
	max-width: 96px;
	height: auto;
	display: block;
}

/* ── account tab ───────────────────────────────────────────────── */

.fvt-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.fvt-head h2 {
	margin: 0;
	font-size: 20px;
}

.fvt-btn {
	display: inline-block;
	background: var(--fvt-accent, #fe5502);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 10px 16px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}

.fvt-btn:hover {
	filter: brightness(0.94);
	color: #fff;
}

.fvt-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fvt-row a {
	display: block;
	border: 1px solid var(--fvt-line, #e6e8ec);
	border-radius: 10px;
	padding: 12px 14px;
	text-decoration: none;
	color: inherit;
}

.fvt-row.is-unread a {
	border-color: var(--fvt-accent, #fe5502);
	box-shadow: inset 3px 0 0 var(--fvt-accent, #fe5502);
}

.fvt-row-top {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;
}

.fvt-ref {
	font-family: var(--fv-mono, ui-monospace, monospace);
	font-weight: 700;
}

.fvt-subject {
	display: block;
	font-weight: 600;
}

.fvt-meta {
	display: block;
	color: var(--fvt-ink-2, #5c6370);
	font-size: 13px;
	margin-top: 2px;
}

.fvt-status,
.fvt-pill {
	border-radius: 999px;
	padding: 2px 10px;
	font-size: 12px;
	font-weight: 600;
	background: #eef0f3;
	color: #444;
	white-space: nowrap;
}

.fvt-status.is-new,
.fvt-pill.is-new { background: #fde8dc; color: #9a3d00; }
.fvt-status.is-open,
.fvt-pill.is-open { background: #dbeafe; color: #1e40af; }
.fvt-status.is-waiting,
.fvt-pill.is-waiting { background: #fef3c7; color: #92400e; }
.fvt-status.is-resolved,
.fvt-pill.is-resolved { background: #dcfce7; color: #166534; }
.fvt-status.is-closed,
.fvt-pill.is-closed { background: #e5e7eb; color: #4b5563; }

.fvt-summary {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.fvt-form .fvt-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}

.fvt-form label {
	font-weight: 600;
	font-size: 14px;
}

.fvt-form input[type="text"],
.fvt-form select,
.fvt-form textarea {
	width: 100%;
	max-width: 520px;
	border: 1px solid var(--fvt-line, #e6e8ec);
	border-radius: 8px;
	padding: 10px 12px;
	font: inherit;
}

.fvt-hint {
	color: var(--fvt-ink-2, #5c6370);
	font-size: 13px;
	font-weight: 400;
}

.fvt-empty {
	color: var(--fvt-ink-2, #5c6370);
}

.fvt-notice {
	border-radius: 8px;
	padding: 10px 14px;
	margin-bottom: 14px;
}

.fvt-notice.is-ok { background: #dcfce7; color: #166534; }
.fvt-notice.is-error { background: #fee2e2; color: #991b1b; }

.fvt-pages {
	display: flex;
	gap: 6px;
	margin-top: 16px;
}

.fvt-pages a {
	border: 1px solid var(--fvt-line, #e6e8ec);
	border-radius: 6px;
	padding: 4px 10px;
	text-decoration: none;
}

.fvt-pages a.is-current {
	background: var(--fvt-accent, #fe5502);
	border-color: var(--fvt-accent, #fe5502);
	color: #fff;
}

/* ── admin ─────────────────────────────────────────────────────── */

.fvt-admin-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 20px;
	align-items: start;
	margin-top: 16px;
}

@media (max-width: 960px) {
	.fvt-admin-grid { grid-template-columns: minmax(0, 1fr); }
}

.fvt-admin-side .card {
	margin: 0 0 16px;
	padding: 12px 16px;
	max-width: none;
}

.fvt-admin-search {
	margin: 12px 0;
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.fvt-admin-reply textarea {
	margin-bottom: 8px;
}

tr.fvt-unread td {
	font-weight: 600;
	box-shadow: inset 3px 0 0 #fe5502;
}

.fvt-urgent {
	background: #fee2e2;
	color: #991b1b;
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 700;
}

.fvt-orders {
	margin: 0;
	padding-left: 18px;
}

.fvt-admin .fvt-thread {
	margin-top: 0;
}

/* ── v1.1: SLA, canned replies, merge, rating ──────────────────── */

.fvt-late {
	background: #fde2e2;
	color: #9b1c1c;
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

.fvt-canned {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 0 0 8px;
}

.fvt-reply-row {
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 10px 12px;
	background: #fff;
	margin: 0 0 10px;
}

.fvt-reply-row input[type="text"] {
	margin-bottom: 6px;
}

.fvt-rating-shown {
	font-size: 15px;
	letter-spacing: 1px;
}

/*
 * The stars are laid out in reverse in the markup — 5 first — so that the
 * CSS sibling combinator can light every star to the left of the hovered one.
 * `row-reverse` puts them back in reading order on screen.
 */
.fvt-stars {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 2px;
	font-size: 30px;
	line-height: 1;
}

.fvt-stars input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.fvt-stars label {
	color: #d4d6db;
	cursor: pointer;
	transition: color 0.12s ease;
}

.fvt-stars label:hover,
.fvt-stars label:hover ~ label,
.fvt-stars input:checked ~ label {
	color: #f5a623;
}

.fvt-stars input:focus-visible + label {
	outline: 2px solid var(--fvt-accent, #fe5502);
	outline-offset: 2px;
}

.fvt-rate {
	border-top: 1px solid var(--fvt-line, #e6e8ec);
	padding-top: 16px;
	margin-top: 8px;
}

.fvt-rate-q {
	font-weight: 600;
	margin-bottom: 6px;
}

.fvt-rated {
	color: #b8860b;
	font-size: 15px;
}
