.tc-app,
.tc-guard {
	--tc-primary: var(--gv-primary, #5B5BD6);
	--tc-primary-dark: var(--gv-primary-dark, #4747c2);
	--tc-primary-light: var(--gv-primary-light, #7B7BF0);
	--tc-primary-subtle: var(--gv-primary-subtle, #EDEDFF);
	--tc-accent: var(--gv-accent, #0ECAD4);
	--tc-success: var(--gv-success, #22C55E);
	--tc-warning: var(--gv-warning, #F59E0B);
	--tc-danger: var(--gv-danger, #EF4444);
	--tc-bg: var(--gv-bg, #FFFFFF);
	--tc-bg-2: var(--gv-bg-2, #F6F7FB);
	--tc-bg-3: var(--gv-bg-3, #EEEEF7);
	--tc-surface: var(--gv-surface, #FFFFFF);
	--tc-surface-2: var(--gv-surface-2, #F9F9FD);
	--tc-border: var(--gv-border, #E3E3EF);
	--tc-border-2: var(--gv-border-2, #D0D0E8);
	--tc-text-primary: var(--gv-text-primary, #14142B);
	--tc-text-secondary: var(--gv-text-secondary, #4A4A6A);
	--tc-text-muted: var(--gv-text-muted, #8888AA);
	--tc-text-inverse: var(--gv-text-inverse, #FFFFFF);
	--tc-radius-sm: var(--gv-radius-sm, 6px);
	--tc-radius-md: var(--gv-radius-md, 10px);
	--tc-radius-lg: var(--gv-radius-lg, 16px);
	--tc-radius-xl: var(--gv-radius-xl, 24px);
	--tc-radius-full: var(--gv-radius-full, 999px);
	--tc-shadow-sm: var(--gv-shadow-sm, 0 1px 3px rgba(14,14,40,0.08));
	--tc-shadow-md: var(--gv-shadow-md, 0 4px 20px rgba(14,14,40,0.10));
	--tc-shadow-lg: var(--gv-shadow-lg, 0 8px 40px rgba(14,14,40,0.13));
	--tc-font-sans: var(--gv-font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
	--tc-font-display: var(--gv-font-display, 'Sora', 'Inter', sans-serif);
	--tc-transition: var(--gv-transition, 0.2s cubic-bezier(0.4, 0, 0.2, 1));
	font-family: var(--tc-font-sans);
	color: var(--tc-text-primary);
	display: block;
	padding: 20px 80px;
	margin: 0 auto;
	box-sizing: border-box;
}

.tc-app *,
.tc-app *::before,
.tc-app *::after,
.tc-guard *,
.tc-guard *::before,
.tc-guard *::after {
	box-sizing: border-box;
}

.tc-app {
	margin-top: 30px;
	margin-bottom: 30px;
}

[hidden] {
	display: none !important;
}

.tc-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 24px;
}

.tc-header__title {
	font-family: var(--tc-font-display);
	font-size: 28px;
	font-weight: 700;
	margin: 0 0 6px;
	color: var(--tc-text-primary);
}

.tc-header__subtitle {
	margin: 0;
	font-size: 14px;
	color: var(--tc-text-secondary);
}

.tc-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--tc-font-sans);
	font-size: 14px;
	font-weight: 600;
	padding: 11px 20px;
	border-radius: var(--tc-radius-md);
	border: 1px solid transparent;
	cursor: pointer;
	transition: var(--tc-transition);
	white-space: nowrap;
	line-height: 1.2;
	text-decoration: none;
}

.tc-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.tc-btn--primary {
	background: var(--tc-primary);
	color: var(--tc-text-inverse);
	box-shadow: var(--tc-shadow-sm);
}

.tc-btn--primary:hover:not(:disabled) {
	background: var(--tc-primary-dark);
	box-shadow: var(--tc-shadow-md);
}

.tc-btn--outline {
	background: transparent;
	color: var(--tc-text-primary);
	border-color: var(--tc-border-2);
}

.tc-btn--outline:hover:not(:disabled) {
	background: var(--tc-bg-2);
	border-color: var(--tc-primary-light);
}

.tc-btn--ghost {
	background: var(--tc-bg-2);
	color: var(--tc-text-secondary);
}

.tc-btn--ghost:hover:not(:disabled) {
	background: var(--tc-bg-3);
}

.tc-btn--danger-ghost {
	background: transparent;
	color: var(--tc-danger);
	border-color: transparent;
}

.tc-btn--danger-ghost:hover:not(:disabled) {
	background: rgba(239, 68, 68, 0.08);
}

.tc-btn--success-ghost {
	background: transparent;
	color: var(--tc-success);
	border-color: transparent;
}

.tc-btn--success-ghost:hover:not(:disabled) {
	background: rgba(34, 197, 94, 0.08);
}

.tc-tabs {
	display: flex;
	gap: 4px;
	background: var(--tc-bg-2);
	padding: 4px;
	border-radius: var(--tc-radius-md);
	margin-bottom: 20px;
	width: fit-content;
	max-width: 100%;
	overflow-x: auto;
}

.tc-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--tc-font-sans);
	font-size: 14px;
	font-weight: 600;
	color: var(--tc-text-secondary);
	background: transparent;
	border: none;
	padding: 10px 18px;
	border-radius: var(--tc-radius-sm);
	cursor: pointer;
	transition: var(--tc-transition);
	white-space: nowrap;
}

.tc-tab.is-active {
	background: var(--tc-surface);
	color: var(--tc-primary);
	box-shadow: var(--tc-shadow-sm);
}

.tc-tab__count {
	background: var(--tc-bg-3);
	color: var(--tc-text-muted);
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: var(--tc-radius-full);
	min-width: 20px;
	text-align: center;
}

.tc-tab.is-active .tc-tab__count {
	background: var(--tc-primary-subtle);
	color: var(--tc-primary);
}

.tc-panel[hidden] {
	display: none;
}

.tc-ticket-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
}

.tc-ticket-card {
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius-lg);
	padding: 18px;
	cursor: pointer;
	transition: var(--tc-transition);
	display: flex;
	flex-direction: column;
	gap: 10px;
	position: relative;
}

.tc-ticket-card:hover {
	border-color: var(--tc-primary-light);
	box-shadow: var(--tc-shadow-md);
	transform: translateY(-2px);
}

.tc-ticket-card__top {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.tc-unread-dot {
	width: 9px;
	height: 9px;
	border-radius: var(--tc-radius-full);
	background: var(--tc-accent);
	margin-left: auto;
	box-shadow: 0 0 0 3px rgba(14, 202, 212, 0.18);
}

.tc-pill {
	display: inline-flex;
	align-items: center;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: var(--tc-radius-full);
	background: var(--tc-bg-3);
	color: var(--tc-text-secondary);
	text-transform: capitalize;
	line-height: 1.4;
}

.tc-pill--category {
	background: var(--tc-primary-subtle);
	color: var(--tc-primary);
}

.tc-pill--priority[data-priority="urgent"],
.tc-pill--priority[data-priority-value="urgent"] {
	background: rgba(239, 68, 68, 0.12);
	color: var(--tc-danger);
}

.tc-pill--priority[data-priority="high"] {
	background: rgba(245, 158, 11, 0.14);
	color: var(--tc-warning);
}

.tc-ticket-card__subject {
	font-family: var(--tc-font-display);
	font-size: 16px;
	font-weight: 600;
	margin: 0;
	color: var(--tc-text-primary);
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.tc-ticket-card__excerpt {
	margin: 0;
	font-size: 12px;
	color: var(--tc-text-muted);
	font-family: monospace;
}

.tc-ticket-card__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--tc-border);
	font-size: 12px;
	color: var(--tc-text-muted);
}

.tc-ticket-card__status {
	font-weight: 700;
	color: var(--tc-success);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.tc-ticket-card__status[data-status="closed"] {
	color: var(--tc-text-muted);
}

.tc-ticket-card__status::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: var(--tc-radius-full);
	background: currentColor;
}

.tc-skeleton-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 14px;
}

.tc-skeleton-card {
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius-lg);
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.tc-skeleton-card__top {
	display: flex;
	gap: 8px;
}

.tc-skeleton-card__bottom {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--tc-border);
}

.tc-skeleton {
	display: inline-block;
	border-radius: var(--tc-radius-sm);
	background: linear-gradient(90deg, var(--tc-bg-3) 25%, var(--tc-bg-2) 37%, var(--tc-bg-3) 63%);
	background-size: 400% 100%;
	animation: tc-shimmer 1.4s ease infinite;
}

.tc-skeleton--pill {
	width: 64px;
	height: 20px;
	border-radius: var(--tc-radius-full);
}

.tc-skeleton--pill.tc-skeleton--sm {
	width: 40px;
}

.tc-skeleton--line {
	height: 12px;
	width: 100%;
}

.tc-skeleton--title {
	height: 18px;
	width: 80%;
}

.tc-skeleton--text {
	width: 55%;
}

.tc-skeleton--meta {
	width: 90px;
	height: 10px;
}

.tc-skeleton--avatar {
	width: 28px;
	height: 28px;
	border-radius: var(--tc-radius-full);
	flex-shrink: 0;
}

.tc-skeleton-bubble {
	height: 60px;
	width: 70%;
	border-radius: var(--tc-radius-lg);
	background: linear-gradient(90deg, var(--tc-bg-3) 25%, var(--tc-bg-2) 37%, var(--tc-bg-3) 63%);
	background-size: 400% 100%;
	animation: tc-shimmer 1.4s ease infinite;
	margin-bottom: 14px;
}

.tc-skeleton-bubble--right {
	margin-left: auto;
	width: 55%;
}

.tc-thread-skeleton {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px 0;
}

@keyframes tc-shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}

.tc-empty {
	text-align: center;
	padding: 60px 20px;
	color: var(--tc-text-muted);
}

.tc-empty__icon {
	font-size: 40px;
	color: var(--tc-primary-light);
	margin-bottom: 14px;
}

.tc-empty__title {
	font-family: var(--tc-font-display);
	font-size: 18px;
	color: var(--tc-text-primary);
	margin: 0 0 6px;
}

.tc-empty__text {
	margin: 0;
	font-size: 14px;
}

.tc-load-more {
	display: flex;
	justify-content: center;
	margin-top: 20px;
}

.tc-guard {
	text-align: center;
	padding: 60px 24px;
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius-lg);
	max-width: 420px;
	margin: 40px auto;
}

.tc-guard__icon {
	font-size: 32px;
	color: var(--tc-primary);
	margin-bottom: 14px;
}

.tc-guard__text {
	color: var(--tc-text-secondary);
	margin: 0 0 20px;
}

.tc-view[hidden] {
	display: none;
}

.tc-back-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	color: var(--tc-text-secondary);
	font-family: var(--tc-font-sans);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	padding: 8px 0;
	margin-bottom: 16px;
	transition: var(--tc-transition);
}

.tc-back-link:hover {
	color: var(--tc-primary);
}

.tc-form-card,
.tc-thread {
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius-xl);
	padding: 28px;
	box-shadow: var(--tc-shadow-sm);
}

.tc-form-card__title {
	font-family: var(--tc-font-display);
	font-size: 22px;
	margin: 0 0 6px;
}

.tc-form-card__subtitle {
	margin: 0 0 22px;
	color: var(--tc-text-secondary);
	font-size: 14px;
}

.tc-field {
	margin-bottom: 18px;
}

.tc-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.tc-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--tc-text-primary);
	margin-bottom: 7px;
}

.tc-input,
.tc-select,
.tc-textarea {
	width: 100%;
	font-family: var(--tc-font-sans);
	font-size: 14px;
	color: var(--tc-text-primary);
	background: var(--tc-bg-2);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius-md);
	padding: 12px 14px;
	transition: var(--tc-transition);
}

.tc-textarea {
	resize: vertical;
	min-height: 120px;
	line-height: 1.5;
}

.tc-input:focus,
.tc-select:focus,
.tc-textarea:focus {
	outline: none;
	border-color: var(--tc-primary);
	background: var(--tc-surface);
	box-shadow: 0 0 0 3px var(--tc-primary-subtle);
}

.tc-field__hint {
	display: block;
	font-size: 12px;
	color: var(--tc-text-muted);
	margin-top: 6px;
	text-align: right;
}

.tc-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 2px dashed var(--tc-border-2);
	border-radius: var(--tc-radius-lg);
	padding: 26px;
	cursor: pointer;
	color: var(--tc-text-secondary);
	transition: var(--tc-transition);
	text-align: center;
}

.tc-dropzone:hover,
.tc-dropzone.is-dragover {
	border-color: var(--tc-primary);
	background: var(--tc-primary-subtle);
	color: var(--tc-primary);
}

.tc-dropzone i {
	font-size: 22px;
}

.tc-dropzone__text {
	font-size: 14px;
	font-weight: 600;
}

.tc-dropzone__hint {
	font-size: 12px;
	color: var(--tc-text-muted);
}

.tc-attachments-preview {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.tc-attachment-preview-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--tc-bg-3);
	border-radius: var(--tc-radius-full);
	padding: 6px 10px 6px 12px;
	font-size: 12px;
	color: var(--tc-text-secondary);
}

.tc-attachment-preview-item button {
	background: none;
	border: none;
	color: var(--tc-text-muted);
	cursor: pointer;
	padding: 2px;
	display: flex;
}

.tc-attachment-preview-item button:hover {
	color: var(--tc-danger);
}

.tc-form-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 6px;
}

.tc-form-footer__note {
	font-size: 12px;
	color: var(--tc-text-muted);
}

.tc-alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--tc-radius-md);
	font-size: 13px;
	margin-bottom: 16px;
	line-height: 1.5;
}

.tc-alert--error {
	background: rgba(239, 68, 68, 0.08);
	color: var(--tc-danger);
	border: 1px solid rgba(239, 68, 68, 0.2);
}

.tc-alert--info {
	background: var(--tc-bg-3);
	color: var(--tc-text-secondary);
	border: 1px solid var(--tc-border);
}

.tc-alert[hidden] {
	display: none;
}

.tc-thread__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 18px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--tc-border);
}

.tc-thread__subject {
	font-family: var(--tc-font-display);
	font-size: 20px;
	margin: 0 0 10px;
}

.tc-thread__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 12px;
}

.tc-thread__key {
	font-family: monospace;
	color: var(--tc-text-muted);
}

.tc-thread__actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.tc-messages {
	display: flex;
	flex-direction: column;
	gap: 18px;
	max-height: 560px;
	overflow-y: auto;
	padding: 4px 4px 20px;
	margin-bottom: 16px;
}

.tc-message {
	display: flex;
	gap: 12px;
	max-width: 85%;
}

.tc-message[data-author-type="admin"] {
	align-self: flex-start;
}

.tc-message[data-author-type="user"] {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.tc-message__avatar {
	width: 34px;
	height: 34px;
	border-radius: var(--tc-radius-full);
	background: var(--tc-primary-subtle);
	color: var(--tc-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 13px;
	flex-shrink: 0;
}

.tc-message[data-author-type="admin"] .tc-message__avatar {
	background: var(--tc-bg-3);
	color: var(--tc-text-secondary);
}

.tc-message__bubble {
	background: var(--tc-bg-2);
	border-radius: var(--tc-radius-lg);
	padding: 12px 16px;
}

.tc-message[data-author-type="user"] .tc-message__bubble {
	background: var(--tc-primary-subtle);
}

.tc-message__meta {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 5px;
	font-size: 12px;
	color: var(--tc-text-muted);
}

.tc-message__meta strong {
	color: var(--tc-text-primary);
	font-size: 13px;
}

.tc-message__body {
	font-size: 14px;
	line-height: 1.6;
	color: var(--tc-text-primary);
	word-break: break-word;
	white-space: pre-wrap;
}

.tc-message__attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.tc-attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--tc-surface);
	border: 1px solid var(--tc-border-2);
	border-radius: var(--tc-radius-full);
	padding: 6px 12px;
	font-size: 12px;
	color: var(--tc-text-secondary);
	text-decoration: none;
	transition: var(--tc-transition);
}

.tc-attachment-chip:hover {
	border-color: var(--tc-primary);
	color: var(--tc-primary);
}

.tc-attachment-chip__size {
	color: var(--tc-text-muted);
}

.tc-reply-box {
	border-top: 1px solid var(--tc-border);
	padding-top: 16px;
}

.tc-reply-box__footer {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
}

.tc-icon-upload {
	width: 40px;
	height: 40px;
	border-radius: var(--tc-radius-md);
	background: var(--tc-bg-2);
	color: var(--tc-text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: var(--tc-transition);
}

.tc-icon-upload:hover {
	background: var(--tc-bg-3);
	color: var(--tc-primary);
}

.tc-reply-box__footer .tc-attachments-preview {
	flex: 1;
	margin-top: 0;
}

.tc-reply-box__footer .tc-btn {
	margin-left: auto;
}

.gv-icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--gv-radius-full, 999px);
	color: inherit;
	text-decoration: none;
	transition: var(--gv-transition, 0.2s ease);
}

.gv-icon-btn:hover {
	background: rgba(91, 91, 214, 0.08);
}

.gv-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	background: var(--gv-danger, #EF4444);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	border-radius: var(--gv-radius-full, 999px);
	box-shadow: 0 0 0 2px var(--gv-header-bg, #fff);
}

@media (max-width: 782px) {
	.tc-app {
		padding: 10px 30px;
	}

	.tc-header {
		flex-direction: column;
		align-items: stretch;
	}

	.tc-header .tc-btn {
		justify-content: center;
	}

	.tc-ticket-list,
	.tc-skeleton-list {
		grid-template-columns: 1fr;
	}

	.tc-field-row {
		grid-template-columns: 1fr;
	}

	.tc-form-card,
	.tc-thread {
		padding: 18px;
		border-radius: var(--tc-radius-lg);
	}

	.tc-message {
		max-width: 95%;
	}

	.tc-thread__actions {
		width: 100%;
	}

	.tc-thread__actions .tc-btn {
		flex: 1;
		justify-content: center;
	}
}

@media (max-width: 480px) {
	.tc-header__title {
		font-size: 22px;
	}

	.tc-tabs {
		width: 100%;
	}

	.tc-tab {
		flex: 1;
		justify-content: center;
	}

	.tc-reply-box__footer {
		flex-wrap: wrap;
	}

	.tc-reply-box__footer .tc-btn {
		margin-left: 0;
		width: 100%;
		justify-content: center;
	}
}
