body {
	margin: 0;
	padding: 0;
}

.asd-chat-container {
	width: 100vw;
	height: 100vh;
	height: calc(var(--vh, 1vh) * 100);
	max-width: 100%;
	background: #333;
	border: none;
	border-radius: 0;
	box-shadow: none;
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	display: flex;
	justify-content: center;
	align-items: stretch;
	touch-action: manipulation;
	-ms-touch-action: manipulation;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.asd-chat-wrapper {
	width: 100%;
	height: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	overflow: hidden;
}

@media (min-width: 769px) {
	.asd-chat-wrapper {
		max-width: 800px;
		width: 100%;
	}
}

.asd-chat-header {
	background: #0073aa;
	color: #fff;
	padding: 12px 16px;
	border-radius: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.asd-chat-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.asd-font-size-control {
	display: flex;
	gap: 4px;
}

.asd-font-size-btn {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 4px;
	padding: 4px 12px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.2s;
}

.asd-font-size-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

.asd-font-size-btn.active {
	background: #fff;
	color: #0073aa;
	border-color: #fff;
	font-weight: 600;
}


.asd-chat-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	overflow: hidden;
	min-height: 0;
	height: 0;
}

.asd-chat-form-container {
	overflow-y: auto;
	padding: 24px;
	padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	background: #f0f0f1;
	min-height: 0;
	-webkit-overflow-scrolling: touch;
}

.asd-chat-form {
	max-width: 500px;
	margin: 0 auto;
}

.asd-form-group {
	margin-bottom: 20px;
}

.asd-form-group label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #333;
	font-size: 14px;
}

.asd-form-group input,
.asd-form-group textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	font-family: inherit;
	box-sizing: border-box;
}

.asd-form-group input:focus,
.asd-form-group textarea:focus {
	outline: none;
	border-color: #0073aa;
}

.asd-form-group textarea {
	resize: vertical;
	min-height: 100px;
}

.asd-form-submit {
	width: 100%;
	padding: 12px;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	margin-top: 8px;
}

.asd-form-submit:hover {
	background: #005a87;
}

.asd-form-submit:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.asd-form-error {
	background: #f44336;
	color: #fff;
	padding: 12px;
	border-radius: 4px;
	margin-bottom: 20px;
	font-size: 14px;
}

.asd-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f0f0f1;
	min-height: 0;
}

.asd-chat-loading {
	text-align: center;
	color: #666;
	padding: 20px;
}

.asd-message {
	margin-bottom: 12px;
}

.asd-message-guest {
	text-align: right;
}

.asd-message-support {
	text-align: left;
}

.asd-message-content {
	display: inline-block;
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 12px;
	word-wrap: break-word;
	white-space: pre-wrap;
	text-align: left;
	line-height: 1.5;
	font-size: 14px;
}

.asd-message-guest .asd-message-content {
	background: #0073aa;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.asd-message-support .asd-message-content {
	background: #fff;
	color: #1d2327;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
}

.asd-message-time {
	font-size: 11px;
	color: #999;
	margin-top: 4px;
}

.asd-chat-input-container {
	display: flex;
	padding: 12px;
	padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid #ddd;
	background: #fff;
	gap: 8px;
	align-items: center;
	flex-shrink: 0;
}

.asd-chat-upload-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	color: #666;
	transition: all 0.2s;
}

.asd-chat-upload-btn:hover:not(:disabled) {
	background: #f5f5f5;
	border-color: #0073aa;
	color: #0073aa;
}

.asd-chat-upload-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.asd-upload-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #ddd;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: asd-spin 0.8s linear infinite;
}

@keyframes asd-spin {
	to {
		transform: rotate(360deg);
	}
}

.asd-chat-input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
}

.asd-chat-input:focus {
	outline: none;
	border-color: #0073aa;
}

.asd-message-image {
	width: 100%;
	height: auto;
	max-height: 500px;
	object-fit: contain;
	border-radius: 0;
	margin: 0;
	cursor: pointer;
	display: block;
	transition: opacity 0.2s;
}

.asd-message-image:hover {
	opacity: 0.8;
}

.asd-image-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.asd-lightbox-image {
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
	cursor: default;
}

.asd-lightbox-close {
	position: absolute;
	top: 20px;
	right: 30px;
	color: #fff;
	font-size: 40px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
	z-index: 10001;
	transition: opacity 0.2s;
}

.asd-lightbox-close:hover {
	opacity: 0.7;
}

.asd-message-content.has-image {
	padding: 0;
	width: fit-content;
	background: transparent;
}

.asd-message-content.has-image > *:not(.asd-message-image) {
	padding: 10px 14px;
}

.asd-message:has(.asd-message-content.has-image) {
	width: 100%;
}

.asd-chat-send {
	margin-left: 8px;
	padding: 8px 16px;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
}

.asd-chat-send:hover:not(:disabled) {
	background: #005a87;
}

.asd-chat-send:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.asd-error {
	background: #f44336;
	color: #fff;
	padding: 8px 12px;
	border-radius: 4px;
	margin-bottom: 12px;
	font-size: 13px;
}

@media (max-width: 768px) {
	.asd-chat-wrapper {
		max-width: 100%;
		width: 100%;
	}

	.asd-chat-form-container {
		padding: 16px;
		padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		touch-action: pan-y;
		-ms-touch-action: pan-y;
		-webkit-overflow-scrolling: touch;
	}

	.asd-chat-form {
		max-width: 100%;
	}

	.asd-form-group {
		margin-bottom: 16px;
	}

	.asd-form-group input,
	.asd-form-group textarea {
		padding: 12px;
		font-size: 16px;
		touch-action: manipulation;
		-ms-touch-action: manipulation;
	}

	.asd-form-submit {
		padding: 14px;
		font-size: 16px;
		touch-action: manipulation;
		-ms-touch-action: manipulation;
	}

	.asd-chat-messages {
		padding: 12px;
		min-height: 0;
		-webkit-overflow-scrolling: touch;
	}

	.asd-message {
		margin-bottom: 10px;
	}

	.asd-message-content {
		max-width: 85%;
		font-size: 14px;
		padding: 8px 12px;
	}

	.asd-chat-input-container {
		padding: 10px;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
		flex-shrink: 0;
	}

	.asd-chat-input {
		font-size: 16px;
		padding: 10px;
	}

	.asd-chat-body {
		min-height: 0;
		height: 0;
		flex: 1 1 0;
		display: flex;
		flex-direction: column;
	}
}

.asd-ticket-status-container {
	width: 100vw;
	height: 100vh;
	max-width: 100%;
	background: #333;
	border: none;
	border-radius: 0;
	box-shadow: none;
	z-index: 9999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	display: flex;
	justify-content: center;
	align-items: stretch;
	margin: 0;
	padding: 0;
}

.asd-ticket-status-wrapper {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 0;
	box-shadow: none;
	overflow: hidden;
}

.asd-ticket-status-header {
	background: #0073aa;
	color: #fff;
	padding: 20px 24px;
}

.asd-ticket-status-header h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 600;
}

.asd-ticket-status-content {
	padding: 24px;
	flex: 1;
	overflow-y: auto;
	background: #f0f0f1;
}

.asd-ticket-status-info {
	background: #f8f9fa;
	border-radius: 6px;
	padding: 20px;
	margin-bottom: 32px;
}

.asd-ticket-info-row {
	display: flex;
	padding: 12px 0;
	border-bottom: 1px solid #e0e0e0;
}

.asd-ticket-info-row:last-child {
	border-bottom: none;
}

.asd-ticket-info-label {
	font-weight: 600;
	color: #333;
	min-width: 120px;
	flex-shrink: 0;
}

.asd-ticket-info-value {
	color: #666;
	flex: 1;
}

.asd-ticket-status-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 13px;
	font-weight: 500;
	background: #e0e0e0;
	color: #333;
}

.asd-ticket-status-new,
.asd-ticket-status-open {
	background: #ff9800;
	color: #fff;
}

.asd-ticket-status-diagnosing {
	background: #2196f3;
	color: #fff;
}

.asd-ticket-status-quoted {
	background: #9c27b0;
	color: #fff;
}

.asd-ticket-status-waiting_approval {
	background: #ff5722;
	color: #fff;
}

.asd-ticket-status-repairing {
	background: #00bcd4;
	color: #fff;
}

.asd-ticket-status-waiting_parts {
	background: #ffc107;
	color: #333;
}

.asd-ticket-status-repaired {
	background: #4caf50;
	color: #fff;
}

.asd-ticket-status-delivered {
	background: #8bc34a;
	color: #fff;
}

.asd-ticket-status-closed {
	background: #9e9e9e;
	color: #fff;
}

.asd-ticket-timeline {
	margin-top: 32px;
}

.asd-ticket-timeline h3 {
	margin: 0 0 20px 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.asd-ticket-timeline-empty {
	color: #999;
	text-align: center;
	padding: 40px 20px;
	font-style: italic;
}

.asd-timeline {
	position: relative;
	padding-left: 24px;
}

.asd-timeline::before {
	content: '';
	position: absolute;
	left: 8px;
	top: 0;
	bottom: 0;
	width: 2px;
	background: #e0e0e0;
}

.asd-timeline-item {
	position: relative;
	margin-bottom: 24px;
}

.asd-timeline-marker {
	position: absolute;
	left: -20px;
	top: 4px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #0073aa;
	border: 2px solid #fff;
	box-shadow: 0 0 0 2px #0073aa;
}

.asd-timeline-content {
	background: #f8f9fa;
	border-radius: 6px;
	padding: 16px;
	margin-left: 16px;
}

.asd-timeline-event {
	font-weight: 500;
	color: #333;
	margin-bottom: 8px;
	font-size: 15px;
}

.asd-timeline-meta {
	display: flex;
	gap: 12px;
	font-size: 13px;
	color: #999;
}

.asd-timeline-time {
	flex-shrink: 0;
}

.asd-timeline-user {
	flex-shrink: 0;
}

.asd-ticket-status-error {
	background: #fff;
	border-radius: 0;
	box-shadow: none;
	padding: 40px;
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	height: 100%;
}

.asd-ticket-status-error p {
	margin: 0 0 12px 0;
	font-size: 18px;
	color: #333;
}

.asd-ticket-status-error p:first-child {
	font-weight: 600;
	color: #d32f2f;
}

.asd-ticket-status-hint {
	font-size: 14px;
	color: #666;
	font-style: italic;
}

@media (min-width: 769px) {
	.asd-ticket-status-wrapper {
		max-width: 800px;
		width: 100%;
	}
}

@media (max-width: 768px) {
	.asd-ticket-status-container {
		margin: 0;
		padding: 0;
	}

	.asd-ticket-status-wrapper {
		max-width: 100%;
		width: 100%;
	}

	.asd-ticket-status-content {
		padding: 16px;
	}

	.asd-ticket-status-info {
		padding: 16px;
	}

	.asd-ticket-info-row {
		flex-direction: column;
		gap: 4px;
	}

	.asd-ticket-info-label {
		min-width: auto;
		font-size: 14px;
	}

	.asd-ticket-info-value {
		font-size: 14px;
	}

	.asd-timeline-content {
		margin-left: 8px;
		padding: 12px;
	}
}
