* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

:root {

	--bg-primary: #090a11;
	--bg-secondary: #15172a;
	--bg-tertiary: #1e2136;
	--border: #2c2e40;
	--text-primary: #f5f6f7;
	--text-secondary: #bec3c9;
	--text-muted: #7f8497;
	--accent: #10a37f;
	--accent-hover: #0f8a6b;
	--error: #f85149;
	--success: #238636;
	--warning: #ffa500;


	--shadow-modal: inset 1px 1px 0 0 var(--border), 0 3px 8px 0 #000309;
	--shadow-button: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgba(3, 4, 9, 0.3);
	--shadow-footer: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), 0 -4px 8px 0 rgba(0, 0, 0, 0.2);


	--transition: all 0.2s ease;
	--transition-slow: all 0.3s ease;


	--space-xs: 4px;
	--space-sm: 8px;
	--space-md: 12px;
	--space-lg: 16px;
	--space-xl: 20px;


	--radius-sm: 4px;
	--radius-md: 6px;
	--radius-lg: 8px;
	--radius-xl: 18px;
	--radius-pill: 20px;

	--sidebar-width: 280px;
}


html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg-primary);
	color: var(--text-primary);
}


.app-container {
	display: flex;
	height: 100%;
	position: relative;
}

.sidebar {
	width: var(--sidebar-width);
	min-width: 220px;
	max-width: 500px;
	background: var(--bg-secondary);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 1000;
	transition: margin-left var(--transition-slow);
	flex-shrink: 0;
}

.sidebar-header {
	padding: var(--space-lg);
	border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
	font-size: 18px;
	margin-bottom: var(--space-md);
}

.sidebar-resizer {
	width: 5px;
	background: var(--border);
	cursor: col-resize;
	z-index: 1001;
	transition: background-color 0.2s ease;
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
	background: var(--accent);
}

.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: var(--bg-primary);
	min-width: 0;
	min-height: 0;
	position: relative;
}

.main-content.drag-over {
  border: 2px dashed var(--accent);
  background-color: rgba(16, 163, 127, 0.1);
}
.sessions-section {
	flex: 1;
	padding: var(--space-lg);
	overflow-y: auto;
}

.sessions-section h3 {
	font-size: 14px;
	color: var(--text-muted);
	margin-bottom: var(--space-md);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.sessions-list {
	display: flex;
	flex-direction: column-reverse;
	gap: var(--space-xs);
}


.sidebar-footer {
	border-top: 1px solid var(--border);
	background: var(--bg-tertiary);
	padding: var(--space-md);
	padding-left: 10px;
}

.sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999;
}

.sidebar-overlay.show {
	display: block;
}


.config-section {
	padding: var(--space-md) var(--space-lg);
	background: var(--bg-secondary);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow-modal);
}

.header-controls {
	display: flex;
	align-items: center;
	gap: var(--space-md);
}

.main-config-area {
	flex-grow: 1;
	min-width: 0;
}

.api-key-container {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	flex: 2;
	min-width: 200px;
}

.api-endpoint-container,
.api-proxy-container {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin-bottom: var(--space-sm);
}

.endpoint-hint {
	font-size: 11px;
	color: var(--text-muted);
}

.submit-key-btn {
	padding: var(--space-sm) var(--space-md);
	background: var(--accent);
	color: white;
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	font-size: 14px;
	transition: var(--transition);
	margin: 0 0 6px 0px;
}

.submit-key-btn:hover {
	background: var(--accent-hover);
}

.submit-key-btn:disabled {
	background: var(--border);
	color: var(--text-muted);
	cursor: not-allowed;
}

.api-key-status {
	font-size: 12px;
	padding: var(--space-xs);
	border-radius: var(--radius-sm);
	text-align: center;
}

.api-key-status.waiting {
	color: var(--text-muted);
	background: var(--bg-tertiary);
}

.api-key-status.error {
	color: var(--error);
	background: rgba(248, 81, 73, 0.1);
	border: 1px solid var(--error);
}

.api-key-status.success {
	color: var(--success);
	background: rgba(35, 134, 54, 0.1);
	border: 1px solid var(--success);
}

.remember-key-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	width: fit-content;
	color: var(--text-secondary);
	font-size: 12px;
	line-height: 15px;
	cursor: pointer;
}

.remember-key-toggle .checkbox {
	width: 15px;
	height: 15px;
	margin: 0;
	flex: 0 0 15px;
	top: 2px;
}

.remember-key-toggle .checkbox:checked::after {
	top: -3px;
	left: 1px;
	font-size: 11px;
}

.mobile-menu-toggle {
	display: none;
	flex-shrink: 0;
	z-index: 1001;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-lg);
	padding: var(--space-md);
	cursor: pointer;
	flex-direction: column;
	gap: var(--space-xs);
	transition: var(--transition-slow);
}

.mobile-menu-toggle span {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--text-primary);
	transition: var(--transition-slow);
}

@media (max-width: 768px) {
	.sidebar {
		position: absolute;
		height: 100%;
		margin-left: calc(-1 * var(--sidebar-width));
		border-right: 1px solid var(--border);
	}

	.sidebar.show {
		margin-left: 0;
		box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
	}

	.sidebar-resizer {
		display: none;
	}

	.mobile-menu-toggle {
		display: flex;
		position: absolute;
		top: 10px;
		left: 10px;
		z-index: 1002;
		width: 42px;
		height: 42px;
		align-items: center;
		justify-content: center;
		background: var(--bg-secondary);
		border-color: var(--border);
		box-shadow: var(--shadow-button);
	}

	.main-content.mobile-menu-open .mobile-menu-toggle {
		display: none;
	}

	.main-controls {
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	.main-controls .model-select {
		width: 100%;
		max-width: none;
		margin-bottom: var(--space-sm);
	}
	
	.api-key-wrapper {
		flex-direction: column;
		gap: var(--space-sm);
	}
	
	.api-key-submit-btn {
		width: 100%;
		min-width: unset;
	}
	
	.api-key-status,
	.api-key-error-message {
		font-size: 12px;
		padding: var(--space-sm);
	}
	.api-key-container > div {
		flex-direction: column !important;
		gap: var(--space-sm) !important;
	}
	
	.api-key-input {
		width: 100% !important;
	}
	
	.submit-key-btn {
		width: 100%;
	}
}

/* Glass panel overrides were moved to the end of the file. */
.mobile-menu-toggle span {
	width: 20px;
	height: 2px;
	background: var(--text-primary);
	transition: var(--transition-slow);
}

.mobile-menu-toggle.active span:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
	opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
	transform: rotate(-45deg) translate(7px, -6px);
}


.btn {
	padding: var(--space-md);
	border: 1px solid transparent;
	border-radius: var(--radius-lg);
	cursor: pointer;
	font-size: 14px;
	transition: var(--transition);
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.btn-primary {
	background: var(--accent);
	color: white;
}

.btn-primary:hover {
	background: var(--accent-hover);
}

.btn-secondary {
	background: var(--bg-tertiary);
	color: var(--text-primary);
	border-color: var(--border);
}

.btn-secondary:hover {
	background: var(--border);
	box-shadow: var(--shadow-button);
}

.btn-success {
	background: var(--success);
	color: white;
}

.btn-success:hover {
	background: #2ea043;
}

.btn-error {
	background: transparent;
	color: var(--error);
	border-color: transparent;
}

.btn-error:hover {
	background: rgba(248, 81, 73, 0.1);
	border-color: var(--error);
}

.btn:disabled {
	background: var(--border);
	color: var(--text-muted);
	cursor: not-allowed;
	transform: none;
}

.btn-icon {
	width: 40px;
	height: 40px;
	padding: 10px;
	background: transparent;
	color: var(--text-muted);
}

.btn-icon:hover {
	background: var(--bg-tertiary);
	color: var(--text-primary);
	border-color: var(--border);
}

.btn-icon:disabled {
	opacity: 0.5;
}


.action-buttons-group {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.form-input {
	padding: var(--space-md);
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	color: var(--text-primary);
	font-size: 14px;
	transition: var(--transition);
	font-family: inherit;
}

.form-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.form-input::placeholder {
	color: var(--text-muted);
}

.form-select {
	padding: var(--space-md);
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	color: var(--text-primary);
	font-size: 14px;
	transition: var(--transition);
	font-family: inherit;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23bec3c9' viewBox='0 0 16 16'%3E%3Cpath d='M8 10.5L4 6.5h8L8 10.5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px;
	padding-right: 40px;
}


.new-chat-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-sm);
	width: 100%;
	padding: var(--space-md);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: var(--transition);
	background: var(--bg-tertiary);
	color: var(--text-primary);
	text-decoration: none;
}

.new-chat-btn:hover {
	background: var(--border);
	box-shadow: var(--shadow-button);
}

.new-chat-btn span {
	font-size: 18px;
}

.api-key-input,
.api-endpoint-input,
.api-proxy-input,
.model-select {
	flex: 1;
	min-width: 200px;
}


.streaming-toggle {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	color: var(--text-secondary);
	font-size: 14px;
	height: 40px;
	padding: 0 var(--space-md);
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	transition: var(--transition);
}

.streaming-toggle:hover {
	background: var(--border);
}

.streaming-toggle.checked {
	color: var(--accent);
	border-color: var(--accent);
}

.streaming-toggle .checkbox {
	display: none;
}

.streaming-toggle label {
	cursor: pointer;
}


.file-input {
	display: none;
}

.send-button {
	padding: 10px var(--space-lg);
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--bg-tertiary);
	color: var(--text-primary);
	cursor: pointer;
	transition: var(--transition);
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	font-size: 14px;
}

.file-upload-btn:hover {
	background: var(--border);
	box-shadow: var(--shadow-button);
}

.send-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: var(--accent);
	color: white;
	border: none;
	cursor: pointer;
	transition: var(--transition);
	flex-shrink: 0;
}

.send-button:hover {
	background: var(--accent-hover);
}

.send-button:disabled,
.clear-button:disabled {
	background: var(--border);
	color: var(--text-muted);
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.checkbox {
	appearance: none;
	width: 18px;
	height: 18px;
	border: 2px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-primary);
	cursor: pointer;
	position: relative;
	transition: var(--transition);
}

.checkbox:checked {
	background: var(--accent);
	border-color: var(--accent);
}

.checkbox:checked::after {
	content: '✓';
	position: absolute;
	top: -2px;
	left: 2px;
	color: white;
	font-size: 12px;
	font-weight: bold;
}

.chat-container {
	flex: 1;
	display: flex;
	flex-direction: column;

	overflow: hidden;
}


.config-row:last-child {
	margin-bottom: 0;
}

.chat-messages {
	flex: 1;
	padding: var(--space-xl);
	overflow-y: auto;
	background: var(--bg-primary);
}

.message {
	margin-bottom: 24px;
	animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.message.user {
	text-align: right;
	max-width: 1600px;
}

.message.assistant {
	text-align: left;
}

.message-copy-u {
	top: -11px;
	position: relative;
	right: 11px;
	border-width: 1px;
	border-radius: 4px;
	background: #546c30;
}

.message-copy {
	top: -11px;
	position: relative;
	right: -15px;
	border-width: 1px;
	border-radius: 4px;
	background: #30346c;
}

.message-content {
	display: inline-block;
	max-width: 80%;
	padding: var(--space-lg) var(--space-xl);
	border-radius: var(--radius-xl);
	word-wrap: break-word;
	line-height: 1.5;
	font-size: 15px;
	white-space: pre-wrap;
}

.message.user .message-content {
	background: var(--accent);
	color: white;
}

.message.assistant .message-content {
	background: var(--bg-secondary);
	color: var(--text-primary);
	border: 1px solid var(--border);
	box-shadow: var(--shadow-modal);
}


.input-section {
	padding: var(--space-lg);
	background: var(--bg-secondary);
	border-top: 1px solid var(--border);
	box-shadow: var(--shadow-footer);
}

.session-name-row {
	display: flex;
	align-items: center;
	gap: 7px;
}

.confirm-session-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex: 0 0 36px;
	border: 1px solid rgba(54, 214, 176, 0.32);
	border-radius: 10px;
	background: rgba(54, 214, 176, 0.1);
	color: var(--accent);
	font-size: 18px;
	cursor: pointer;
	transition: var(--transition);
}

.confirm-session-btn:hover,
.confirm-session-btn.confirmed {
	background: var(--accent);
	border-color: var(--accent);
	color: #06130f;
	box-shadow: 0 0 18px rgba(54, 214, 176, 0.25);
}

.input-container {
	display: flex;
	gap: var(--space-sm);
	align-items: flex-end;
	width: 100%;
}

.message-input {
	flex: 1;
	min-width: 100px;
	min-height: 44px;
	max-height: 200px;
	padding: 12px var(--space-lg);
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	resize: none;
	font-size: 15px;
	font-family: inherit;
	color: var(--text-primary);
	transition: var(--transition);
}

.message-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 1px rgba(16, 163, 127, 0.3);
}


.file-upload-container {
	display: flex;
	align-items: flex-end;
	gap: var(--space-sm);
	padding-bottom: 2px;
}

.uploaded-files {
	display: flex;
	gap: var(--space-md);
	flex-wrap: wrap;
	margin-bottom: var(--space-sm);
	align-items: center;
	max-width: 260px;
	max-height: 35px;
	order: 1;
	top: 3px;

}

.uploaded-file {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	background: var(--bg-tertiary);
	color: var(--text-primary);
	padding: var(--space-xs) var(--space-sm);
	border-radius: 16px;
	font-size: 12px;
	border: 1px solid var(--border);
	max-width: 150px;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.uploaded-file img {
	width: 14px;
	height: 14px;
	border-radius: 2px;
	object-fit: cover;
}

.uploaded-file-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 65px;
	display: inline-block;
}

.remove-file-btn {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	font-size: 12px;
	line-height: 1;
}

.remove-file-btn:hover {
	color: var(--error);
}

.uploaded-file-preview {
	padding: var(--space-xs) 11px;
	background: rgba(30, 33, 54, 0.5);
	border-radius: var(--radius-md);
	font-size: 12px;
	color: var(--text-primary);
	border: 1px solid var(--border);
	display: inline-block;
}


.action-buttons {
	display: flex;
	align-items: flex-end;
	gap: var(--space-sm);
}

#clearButton {
	background-color: var(--bg-tertiary);
}

#clearButton:hover {
	background-color: var(--error);
	color: white;
	border-color: var(--error);
}


.code-block {
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	margin: var(--space-md) 0;
	overflow: hidden;
	box-shadow: var(--shadow-modal);
}

.code-block-header {
	background: var(--bg-tertiary);
	color: var(--text-muted);
	padding: var(--space-sm) var(--space-md);
	font-size: 12px;
	font-weight: 600;
	border-bottom: 1px solid var(--border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.code-block-content {
	padding: var(--space-lg);
	overflow-x: auto;
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
	font-size: 13px;
	line-height: 1.45;
	color: var(--text-primary);
	white-space: pre;
	text-align: start;
}

.copy-btn {
	background: var(--border);
	border: none;
	color: var(--text-muted);
	padding: var(--space-xs) var(--space-sm);
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: 11px;
	transition: var(--transition);
}

.copy-btn:hover {
	background: #484f58;
	color: var(--text-primary);
}


.message-content code {
	background: var(--bg-secondary);
	color: #8ec2db;
	padding: 2px var(--space-md);
	border-radius: var(--radius-sm);
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
	font-size: 13px;
	border: 1px solid var(--border);
}

.message-content pre {
	background: var(--bg-primary);
	color: var(--text-primary);
	padding: var(--space-lg);
	border-radius: var(--radius-lg);
	overflow-x: auto;
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
	font-size: 13px;
	line-height: 1.45;
	border: 1px solid var(--border);
	white-space: pre-wrap;
	text-align: start;
}

.markdown-table-wrapper {
	max-width: 100%;
	margin: 12px 0;
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

.markdown-table {
	width: 100%;
	min-width: 640px;
	border-collapse: collapse;
	table-layout: auto;
	font-size: 14px;
	white-space: normal;
}

.markdown-table th,
.markdown-table td {
	padding: 9px 12px;
	border-right: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	vertical-align: top;
	min-width: 92px;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.markdown-table th {
	background: var(--bg-primary);
	color: var(--text-primary);
	font-weight: 700;
}

.markdown-table tr:last-child td {
	border-bottom: 0;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
	border-right: 0;
}


.message.assistant .markdown-heading {
	color: #dbfaff;
	font-weight: bold;
	margin: 0.8em 0 0.4em 0;
	line-height: 1.3;
}

.message.assistant h1.markdown-heading {
	font-size: 1.5em;
	border-bottom: 2px solid #1f6feb;
	padding-bottom: 0.2em;
}

.message.assistant h2.markdown-heading {
	font-size: 1.3em;
	border-bottom: 1px solid #1f6feb;
	padding-bottom: 0.1em;
}

.message.assistant h3.markdown-heading {
	font-size: 1.2em;
}

.message.assistant h4.markdown-heading {
	font-size: 1.1em;
}

.message.assistant .markdown-bold {
	font-weight: bold;
	color: #dbfaff;
}

.code-block-content *,
.code-block-content .markdown-heading,
.code-block-content .markdown-bold {
	color: inherit !important;
	font-weight: inherit !important;
	border: none !important;
}


.latex-display {
	margin: 10px 0;
	text-align: center;
	overflow-x: auto;
}

.latex-inline {
	display: inline;
}

.MathJax {
	font-size: 1em !important;
}

.api-key-input {
	flex: 2;
	min-width: 200px;
	padding: 12px;
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: 8px;
	color: var(--chat-text-primary);
	font-size: 14px;
	transition: border-color 0.2s;
}

.model-select {
	flex: 1;
	min-width: 150px;
	padding: 12px;
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: 8px;
	color: var(--chat-text-primary);
	font-size: 14px;
	transition: border-color 0.2s;
}


.session-item {
	padding: var(--space-md);
	background: var(--bg-primary);
	border: 1px solid var(--bg-tertiary);
	border-radius: var(--radius-lg);
	cursor: pointer;
	transition: var(--transition);
	font-size: 14px;
	color: var(--text-primary);
	position: relative;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.session-item:hover {
	background: var(--bg-tertiary);
	border-color: var(--border);
}

.session-item.active {
	background: var(--accent);
	border-color: var(--accent-hover);
	color: white;
}

.session-item .session-date {
	font-size: 11px;
	color: var(--text-muted);
	margin-top: var(--space-xs);
}

.session-item .created-date {
	margin-top: 2px;
	opacity: 0.7;
}

.session-item.active .session-date {
	color: rgba(255, 255, 255, 0.8);
}

.session-delete-btn {
	position: absolute;
	right: var(--space-sm);
	top: 50%;
	transform: translateY(-50%);
	background: var(--error);
	color: white;
	border: none;
	border-radius: var(--radius-sm);
	width: 20px;
	height: 20px;
	font-size: 12px;
	cursor: pointer;
	opacity: 0;
	transition: opacity var(--transition);
}

.session-item:hover .session-delete-btn {
	opacity: 1;
}


.session-controls {
	display: flex;
	gap: var(--space-md);
	margin-top: var(--space-md);
	align-items: center;
	flex-wrap: wrap;
}

.session-name-input {


	padding: var(--space-sm) var(--space-md);
	background: var(--bg-primary);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	color: var(--text-primary);
	font-size: 13px;
	transition: var(--transition);
}

.session-name-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.auto-save-indicator {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	font-size: 12px;
	color: var(--text-muted);
	opacity: 0;
	transition: opacity var(--transition-slow);
	transform: translate(130%, -20%);
}

.auto-save-indicator.show {
	opacity: 1;
}

.auto-save-indicator.saving {
	color: var(--warning);
}

.auto-save-indicator.saved {
	color: var(--success);
}


.sidebar-actions {
	display: flex;
	gap: var(--space-sm);
	margin-top: var(--space-md);
}

.sidebar-action-btn {
	flex: 1;
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	background: var(--bg-primary);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: var(--transition);
	text-align: center;
}

.sidebar-action-btn:hover {
	background: var(--border);
	color: var(--text-primary);
}

.sidebar-action-btn.delete {
	background: var(--bg-primary);
	border-color: var(--error);
	color: var(--error);
}

.sidebar-action-btn.delete:hover {
	background: var(--error);
	color: white;
}


.streaming-cursor {
	display: inline-block;
	width: 2px;
	height: 20px;
	background: var(--accent);
	margin-left: 2px;
	animation: blink 1s infinite;
}

@keyframes blink {

	0%,
	50% {
		opacity: 1;
	}

	51%,
	100% {
		opacity: 0;
	}
}

.typing-indicator {
	display: none;
	position: absolute;
	left: 50%;
	bottom: 118px;
	transform: translateX(-50%);
	z-index: 20;
	padding: 8px 16px;
	font-style: normal;
	font-size: 13px;
	color: var(--text-secondary);
	background: rgba(10, 18, 30, 0.78);
	border: 1px solid rgba(93, 133, 156, 0.22);
	border-radius: 999px;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
	pointer-events: none;
	white-space: nowrap;
}

:root[data-theme="light"] .typing-indicator {
	background: rgba(255, 255, 255, 0.85);
	border-color: rgba(35, 74, 65, 0.18);
	color: #5a6b66;
}

.typing-dots::after {
	content: '';
	animation: dots 1.5s infinite;
}

@keyframes dots {

	0%,
	20% {
		content: '.';
	}

	40% {
		content: '..';
	}

	60%,
	100% {
		content: '...';
	}
}

.error-message {
	background: var(--bg-tertiary);
	color: var(--error);
	padding: var(--space-lg);
	border-radius: var(--radius-lg);
	margin: var(--space-md) 0;
	border: 1px solid var(--error);
	font-size: 14px;
}

.model-info {
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: -5px;
	margin-top: 1px;
	line-height: 1.4;
	text-align: center;
}

.loading {
	opacity: 0.6;
	pointer-events: none;
}

.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2px solid var(--border);
	border-top: 2px solid var(--accent);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}

	100% {
		transform: rotate(360deg);
	}
}


.file-summary {
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	margin: var(--space-sm) 0;
	overflow: hidden;
}

.file-summary-header {
	display: flex;
	align-items: center;
	padding: var(--space-md) var(--space-lg);
	background: var(--bg-tertiary);
	border-bottom: 1px solid var(--border);
	cursor: pointer;
	user-select: none;
	transition: var(--transition);
}

.file-summary-header:hover {
	background: var(--border);
}

.file-summary-icon {
	margin-right: var(--space-sm);
	font-size: 16px;
	color: var(--text-secondary);
	transition: transform var(--transition);
}

.file-summary.collapsed .file-summary-icon {
	transform: rotate(-90deg);
}

.file-summary-info {
	flex: 1;
	display: flex;
	align-items: center;
	gap: var(--space-md);
}

.file-summary-name {
	font-weight: 600;
	color: var(--accent);
}

.file-summary-stats {
	color: var(--text-muted);
	font-size: 14px;
}

.file-summary-content {
	max-height: 300px;
	overflow: auto;
	transition: max-height var(--transition-slow);
}

.file-summary.collapsed .file-summary-content {
	max-height: 0;
	overflow: hidden;
}

.file-summary-text {
	padding: var(--space-lg);
	background: var(--bg-primary);
	color: var(--text-primary);
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
	font-size: 13px;
	line-height: 1.4;
	white-space: pre;
	word-break: break-word;
	border: none;
	margin: 0;
	overflow: auto;
}


.chat-messages::-webkit-scrollbar,
.sessions-list::-webkit-scrollbar,
.uploaded-files::-webkit-scrollbar {
	width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.sessions-list::-webkit-scrollbar-track,
.uploaded-files::-webkit-scrollbar-track {
	background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb,
.sessions-list::-webkit-scrollbar-thumb,
.uploaded-files::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: var(--radius-sm);
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sessions-list::-webkit-scrollbar-thumb:hover,
.uploaded-files::-webkit-scrollbar-thumb:hover {
	background: #484f58;
}


@media (max-width: 480px) {

	.config-section {
		padding: var(--space-sm);
	}

	.chat-messages {
		padding: var(--space-md) var(--space-sm);
	}

	.input-section {
		padding: var(--space-md) var(--space-sm);
	}

	.message-content {
		max-width: 98%;
		font-size: 13px;
		padding: 10px 14px;
	}

	.sidebar {
		position: absolute;
		height: 100%;
		margin-left: calc(-1 * var(--sidebar-width));
		border-right: 1px solid var(--border);
	}

	.session-controls {
		gap: var(--space-sm);
	}

	.auto-save-indicator {
		font-size: 11px;
	}


	.main-controls {
		flex-wrap: nowrap;
		gap: var(--space-sm);
	}

	.main-controls .model-select {
		width: auto;
		margin-bottom: 0;
		flex-grow: 1;
		min-width: 100px;
		max-width: 150px;
		padding: var(--space-sm);
		font-size: 12px;
		height: 40px;
	}

	.action-buttons-group {
		flex-shrink: 0;
	}


	.action-buttons-group .top-btn,
	.action-buttons-group .streaming-toggle {
		height: 40px;
		padding: var(--space-sm);
	}
	
	.api-key-wrapper {
		gap: var(--space-xs);
	}
	
	.api-key-submit-btn {
		padding: var(--space-sm) var(--space-md);
		font-size: 13px;
	}


}

@media (prefers-color-scheme: dark) {
	:root {
		--bg-primary: #090a11;
		--bg-secondary: #15172a;
		--bg-tertiary: #1e2136;
	}
}

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
	.preview-image {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
}


.slim-config-container {
	display: none;
	align-items: center;
	gap: var(--space-md);
	padding: var(--space-sm) 0;
}

.slim-config-container .model-select {
	flex-grow: 1;
	min-width: 150px;
	padding: var(--space-sm);
	font-size: 13px;
	height: 38px;
}

.slim-config-container .streaming-toggle {
	flex-shrink: 0;
}

.top-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: var(--radius-md);
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	color: var(--text-primary);
	font-size: 18px;
	cursor: pointer;
	transition: var(--transition);
	flex-shrink: 0;
}

.top-btn:hover {
	background: var(--border);
	border-color: var(--accent);
}


.icon-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: var(--radius-md);
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	color: var(--text-primary);
	font-size: 18px;
	cursor: pointer;
	transition: var(--transition);
	flex-shrink: 0;
}

.icon-btn:hover {
	background: var(--border);
	border-color: var(--accent);
}

.icon-btn:disabled {
	background: var(--bg-tertiary);
	color: var(--text-muted);
	cursor: not-allowed;
	border-color: var(--border);
}


.config-section.api-key-valid .api-key-container {
	display: none;
}

.config-section.api-key-valid .main-controls {
	display: flex;
	width: 100%;
}


.main-controls {
	display: none;
	align-items: center;
	gap: var(--space-sm);
	width: 100%;

	justify-content: space-between;
}


.main-controls .model-select {
	flex-grow: 1;
	max-width: 350px;
}


.chat-messages {
	-webkit-overflow-scrolling: touch;
}


.uploaded-files {
	position: relative;
}

.file-list-popup {
	display: none;
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	width: 150px;
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	padding: var(--space-sm);
	z-index: 1010;
}

.uploaded-files.active .file-list-popup {
	display: block;
}

.file-list-popup .uploaded-file {
	display: flex;
	justify-content: space-between;
	width: 100%;
	margin: 0;
	padding: var(--space-sm) var(--space-md);
}

.file-list-popup .uploaded-file:not(:last-child) {
	margin-bottom: var(--space-xs);
}

.file-list-popup .uploaded-file-name {
	max-width: 180px;
}

.message.error .message-content {
	background: rgba(248, 81, 73, 0.15);
	color: var(--error);
	border: 1px solid var(--error);
	box-shadow: none;
}

.message.error .message-content strong {
	color: var(--text-primary);

}

/* Nova visual system: dark grid by default, light mode via [data-theme="light"] */
:root {
	--bg-primary: #080e13;
	--bg-secondary: rgba(13, 22, 29, 0.9);
	--bg-tertiary: rgba(19, 34, 41, 0.88);
	--border: rgba(119, 170, 173, 0.2);
	--text-primary: #e6f2f0;
	--text-secondary: #9ab0ae;
	--text-muted: #6d8584;
	--accent: #36d6b0;
	--accent-hover: #5ae7c6;
	--error: #ff7180;
	--success: #35d0a8;
	--shadow-modal: 0 18px 50px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	--shadow-button: 0 0 22px rgba(54, 214, 176, 0.17);
	--shadow-footer: 0 -12px 30px rgba(0, 0, 0, 0.18);
	--radius-sm: 8px;
	--radius-md: 10px;
	--radius-lg: 14px;
	--radius-xl: 20px;
	--radius-pill: 999px;
}

:root[data-theme="light"] {
	--bg-primary: #f4f8f7;
	--bg-secondary: rgba(255, 255, 255, 0.92);
	--bg-tertiary: #edf5f2;
	--border: #dce9e5;
	--text-primary: #172522;
	--text-secondary: #60736e;
	--text-muted: #8a9b96;
	--accent: #16a889;
	--accent-hover: #0d8e72;
	--error: #d94b55;
	--success: #168c70;
	--shadow-modal: 0 12px 34px rgba(33, 76, 66, 0.08);
	--shadow-button: 0 5px 15px rgba(24, 168, 137, 0.16);
	--shadow-footer: 0 -8px 24px rgba(33, 76, 66, 0.05);
}

body {
	font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
	background-color: var(--bg-primary);
	background-image: radial-gradient(circle at 72% 8%, rgba(35, 184, 163, 0.16), transparent 31%), radial-gradient(circle at 10% 90%, rgba(22, 111, 145, 0.12), transparent 28%);
	background-size: auto, auto;
	color: var(--text-primary);
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: -1;
	background-image:
		linear-gradient(rgba(91, 169, 164, 0.32) 1px, transparent 1px),
		linear-gradient(90deg, rgba(91, 169, 164, 0.32) 1px, transparent 1px),
		radial-gradient(circle at 50% -20%, rgba(94, 255, 217, 0.1), transparent 36%);
	background-size: 36px 36px, 36px 36px, auto;
	background-position: 0 0, 0 0, 0 0;
}

:root[data-theme="light"] body {
	background-image: radial-gradient(circle at 75% 0%, rgba(66, 201, 174, 0.12), transparent 32%);
	background-size: auto;
}

:root[data-theme="light"] body::before {
	background-image:
		linear-gradient(rgba(57, 131, 119, 0.2) 1px, transparent 1px),
		linear-gradient(90deg, rgba(57, 131, 119, 0.2) 1px, transparent 1px),
		radial-gradient(circle at 50% -20%, rgba(66, 201, 174, 0.1), transparent 36%);
	background-size: 36px 36px, 36px 36px, auto;
	background-position: 0 0, 0 0, 0 0;
}

.sidebar {
	background: rgba(8, 16, 22, 0.82);
	border-right: 1px solid var(--border);
	backdrop-filter: blur(22px);
	box-shadow: 12px 0 34px rgba(0, 0, 0, 0.16), inset -1px 0 rgba(255, 255, 255, 0.035);
}

:root[data-theme="light"] .sidebar {
	background: rgba(255, 255, 255, 0.86);
}

.sidebar-header {
	padding: 24px 20px 18px;
	border-bottom: 0;
}

.sidebar-header h2 {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0;
}

.brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 10px;
	background: linear-gradient(145deg, var(--accent), #168db2);
	color: #fff;
	font-size: 16px;
	box-shadow: 0 5px 12px rgba(24, 168, 137, 0.22);
}

.new-chat-btn {
	margin-top: 4px;
	padding: 10px 12px;
	background: rgba(27, 49, 56, 0.72);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	border-radius: 12px;
	box-shadow: none;
}

.new-chat-btn:hover {
	background: rgba(54, 214, 176, 0.12);
	border-color: rgba(54, 214, 176, 0.42);
	color: var(--accent);
}

.sessions-section {
	padding: 14px 12px;
}

.sessions-section h3 {
	padding: 0 8px;
	font-size: 12px;
	color: var(--text-muted);
	letter-spacing: 0;
}

.sidebar-footer {
	padding: 14px 12px;
	background: rgba(9, 20, 26, 0.74);
	border-top: 1px solid var(--border);
	box-shadow: var(--shadow-footer);
}

.sidebar-actions {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
}

.sidebar-action-btn {
	min-height: 34px;
	padding: 7px 6px;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: rgba(27, 49, 56, 0.72);
	color: var(--text-secondary);
	font-size: 12px;
	transition: var(--transition);
}

.sidebar-action-btn:hover {
	background: rgba(54, 214, 176, 0.12);
	border-color: rgba(54, 214, 176, 0.42);
	color: var(--accent);
}

.sidebar-action-btn.delete {
	background: rgba(255, 113, 128, 0.06);
	color: #db8791;
}

.sidebar-action-btn.delete:hover {
	background: rgba(255, 113, 128, 0.14);
	border-color: rgba(255, 113, 128, 0.42);
	color: var(--error);
}

:root[data-theme="light"] .new-chat-btn,
:root[data-theme="light"] .sidebar-action-btn {
	background: #f1f7f5;
}

:root[data-theme="light"] .sidebar-action-btn.delete {
	background: #fff4f4;
}

.main-content {
	background: transparent;
}

.chat-container {
	max-width: 1280px;
	width: 100%;
	margin: 0 auto;
}

.config-section {
	margin: 18px 24px 0;
	padding: 20px 22px 16px;
	background: rgba(13, 25, 32, 0.58);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-modal);
	backdrop-filter: blur(24px) saturate(125%);
}

:root[data-theme="light"] .config-section {
	background: rgba(255, 255, 255, 0.92);
}

.api-endpoint-container label,
.api-proxy-container label,
.api-key-container label {
	display: block;
	margin-bottom: 6px;
	font-size: 12px;
	font-weight: 700;
	color: var(--text-secondary);
}

.api-endpoint-input,
.api-key-input,
.api-proxy-input,
.model-select,
.session-name-input {
	border: 1px solid var(--border);
	background: rgba(5, 14, 19, 0.68);
	color: var(--text-primary);
	border-radius: 10px;
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="light"] .api-endpoint-input,
:root[data-theme="light"] .api-key-input,
:root[data-theme="light"] .api-proxy-input,
:root[data-theme="light"] .model-select,
:root[data-theme="light"] .session-name-input {
	background: #fbfdfc;
}

.api-endpoint-input:focus,
.api-key-input:focus,
.api-proxy-input:focus,
.model-select:focus,
.session-name-input:focus,
.message-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(24, 168, 137, 0.12);
}

.api-endpoint-input,
.api-key-input,
.api-proxy-input {
	min-height: 42px;
	padding: 10px 13px;
}

.endpoint-hint {
	margin-top: 1px;
	font-size: 11px;
}

.submit-key-btn {
	min-height: 42px;
	margin: 0 0 0 0;
	padding: 10px 20px;
	border-radius: 10px;
	background: var(--accent);
	box-shadow: var(--shadow-button);
}

.submit-key-btn:hover {
	background: var(--accent-hover);
}

.main-controls {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.main-controls .model-select {
	max-width: none;
	min-height: 42px;
	padding: 0 12px;
}

.top-btn,
.icon-btn {
	background: rgba(27, 49, 56, 0.72);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	border-radius: 10px;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 5px 14px rgba(0, 0, 0, 0.12);
}

.top-btn:hover,
.icon-btn:hover {
	background: rgba(54, 214, 176, 0.16);
	border-color: rgba(54, 214, 176, 0.46);
	color: var(--accent);
}

.streaming-toggle {
	background: rgba(27, 49, 56, 0.72);
	border-color: var(--border);
	border-radius: 10px;
}

.streaming-toggle.checked {
	color: var(--accent);
	border-color: rgba(54, 214, 176, 0.46);
	background: rgba(54, 214, 176, 0.12);
}

.model-info {
	margin-top: 12px;
	padding: 9px 12px;
	border-radius: 9px;
	background: rgba(54, 214, 176, 0.07);
	color: var(--text-muted);
	font-size: 12px;
}

.chat-messages {
	padding: 28px 24px 150px;
}

.message .message-content {
	border-radius: 14px;
	box-shadow: 0 4px 14px rgba(35, 74, 65, 0.05);
}

.input-section {
	padding: 14px 24px 24px;
	background: linear-gradient(180deg, rgba(8, 14, 19, 0), rgba(8, 14, 19, 0.96) 30%);
}

:root[data-theme="light"] .input-section {
	background: linear-gradient(180deg, rgba(244, 248, 247, 0), rgba(244, 248, 247, 0.97) 30%);
}

.input-container {
	max-width: 900px;
	margin: 0 auto;
	padding: 9px 10px 9px 14px;
	background: rgba(10, 21, 27, 0.68);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: 0 10px 28px rgba(35, 74, 65, 0.1);
	backdrop-filter: blur(24px) saturate(125%);
}

:root[data-theme="light"] .input-container {
	background: #fff;
}

:root[data-theme="light"] .sidebar {
	box-shadow: 10px 0 30px rgba(35, 74, 65, 0.1), inset -1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .config-section,
:root[data-theme="light"] .input-container {
	background: rgba(255, 255, 255, 0.62);
	box-shadow: 0 14px 34px rgba(35, 74, 65, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(24px) saturate(125%);
}

.session-delete-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: auto 8px auto 4px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 9px;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	opacity: 0.72;
	transition: var(--transition);
}

.session-delete-btn svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.session-item:hover .session-delete-btn,
.session-delete-btn:focus-visible {
	opacity: 1;
	color: #ff8993;
	border-color: rgba(255, 113, 128, 0.28);
	background: rgba(255, 113, 128, 0.1);
	outline: none;
}

.session-delete-btn:hover {
	color: #fff;
	background: var(--error);
	border-color: var(--error);
box-shadow: 0 0 14px rgba(255, 113, 128, 0.22);
}

:root[data-theme="light"] .session-delete-btn {
	color: #78908a;
}

:root[data-theme="light"] .session-item:hover .session-delete-btn,
:root[data-theme="light"] .session-delete-btn:focus-visible {
	color: #c53747;
	background: #fff0f1;
	border-color: #f0b5bb;
}

:root[data-theme="light"] .top-btn,
:root[data-theme="light"] .icon-btn {
	background: #edf7f3;
	border-color: #b9d8d0;
	color: #176c5d;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 4px 10px rgba(35, 74, 65, 0.08);
}

:root[data-theme="light"] .top-btn:hover,
:root[data-theme="light"] .icon-btn:hover {
	background: #dff3ec;
	border-color: #75bca9;
	color: #08735e;
}

:root[data-theme="light"] .streaming-toggle {
	background: #edf7f3;
	border-color: #b9d8d0;
	color: #176c5d;
}

:root[data-theme="light"] .streaming-toggle.checked {
	background: #dff3ec;
	border-color: #75bca9;
	color: #08735e;
}

:root[data-theme="light"] .icon-btn svg,
:root[data-theme="light"] .top-btn {
	color: #176c5d;
}

.message-input {
	color: var(--text-primary);
}

.send-button {
	width: 42px;
	height: 42px;
	padding: 0;
	justify-content: center;
	border: 0;
	border-radius: 12px;
	background: var(--accent);
	color: #fff;
	box-shadow: var(--shadow-button);
}

.send-button:hover {
	background: var(--accent-hover);
}

.send-button:disabled {
	background: #35534f;
	color: #fff;
}

.icon-btn svg,
.send-button svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.send-button svg {
	fill: currentColor;
	stroke: none;
}

.theme-toggle {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	margin-top: 12px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: rgba(26, 45, 51, 0.68);
	color: var(--text-secondary);
	cursor: pointer;
	font: inherit;
	font-size: 12px;
	text-align: left;
	transition: var(--transition);
}

.theme-toggle:hover {
	border-color: rgba(54, 214, 176, 0.42);
	background: rgba(54, 214, 176, 0.1);
	color: var(--accent);
}

.theme-toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 8px;
	background: rgba(54, 214, 176, 0.14);
	color: var(--accent);
	font-size: 16px;
}

:root[data-theme="light"] .sidebar-footer,
:root[data-theme="light"] .theme-toggle {
	background: rgba(239, 247, 244, 0.82);
}

.file-list-popup {
	background: rgba(13, 25, 32, 0.98);
	border-color: rgba(119, 170, 173, 0.26);
	box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34), 0 0 20px rgba(54, 214, 176, 0.08);
}

:root[data-theme="light"] .file-list-popup {
	background: #fff;
	box-shadow: var(--shadow-modal);
}

@media (max-width: 768px) {
	.config-section {
		margin: 10px 12px 0;
		padding: 16px;
	}

	.chat-messages {
		padding: 20px 14px 145px;
	}

	.input-section {
		padding: 10px 12px 16px;
	}

	.header-controls {
		align-items: flex-start;
	}

	.main-config-area {
		width: 100%;
	}

	.main-controls {
		align-items: stretch;
		flex-wrap: wrap;
	}

	.main-controls .model-select {
		flex: 1 1 100%;
		min-width: 0;
	}

	.action-buttons-group {
		width: 100%;
		justify-content: flex-start;
		flex-wrap: wrap;
	}
}

/* ============ FINAL: glass panels with substance (1pkapi style) ============ */
/* Outer panels get a translucent deep-blue glass fill so the app stays readable. */
.sidebar,
.main-content {
	background-color: rgba(8, 15, 27, 0.82);
}

/* Sidebar is more opaque for practicality. */
.sidebar {
	background-color: rgba(7, 13, 23, 0.93);
	border-right: 1px solid rgba(93, 133, 156, 0.18);
	box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35), inset -1px 0 rgba(255, 255, 255, 0.05);
}

/* Inner regions inherit the outer glass; keep them clear to avoid stacking too dark. */
.sessions-section,
.sidebar-footer,
.chat-container,
.chat-messages,
.input-section {
	background-color: transparent;
	background-image: none;
}

.sidebar-footer {
	border-top: 1px solid rgba(93, 133, 156, 0.14);
}

/* Floating cards: translucent, edged, rounded like the reference. */
.config-section,
.input-container {
	background-color: rgba(10, 18, 30, 0.9);
	border: 1px solid rgba(93, 133, 156, 0.2);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 36px rgba(0, 0, 0, 0.3);
}

.config-section {
	border-radius: 16px;
}

/* Keep the input field itself readable on the glass surface. */
.message-input {
	background: rgba(6, 12, 20, 0.42);
}

:root[data-theme="light"] .sidebar,
:root[data-theme="light"] .main-content {
	background-color: rgba(255, 255, 255, 0.85);
}

:root[data-theme="light"] .sidebar {
	background-color: rgba(255, 255, 255, 0.93);
	border-right: 1px solid rgba(35, 74, 65, 0.14);
	box-shadow: 10px 0 30px rgba(35, 74, 65, 0.1), inset -1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .sessions-section,
:root[data-theme="light"] .sidebar-footer,
:root[data-theme="light"] .chat-container,
:root[data-theme="light"] .chat-messages,
:root[data-theme="light"] .input-section {
	background-color: transparent;
	background-image: none;
}

:root[data-theme="light"] .config-section,
:root[data-theme="light"] .input-container {
	background-color: rgba(255, 255, 255, 0.93);
	border: 1px solid rgba(35, 74, 65, 0.16);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 14px 36px rgba(35, 74, 65, 0.1);
}

:root[data-theme="light"] .message-input {
	background: rgba(255, 255, 255, 0.55);
}

/* Keep dark-theme control text readable over the grid (dark only). */
:root:not([data-theme="light"]) .new-chat-btn,
:root:not([data-theme="light"]) .sidebar-action-btn,
:root:not([data-theme="light"]) .theme-toggle,
:root:not([data-theme="light"]) .top-btn,
:root:not([data-theme="light"]) .icon-btn,
:root:not([data-theme="light"]) .streaming-toggle,
:root:not([data-theme="light"]) .config-section label,
:root:not([data-theme="light"]) .endpoint-hint,
:root:not([data-theme="light"]) .model-info {
	color: #c9dbd8;
}

/* Tech feel: deep blue-black canvas behind the glass panels. */
body {
	background-color: #040b16;
}

:root[data-theme="light"] body {
	background-color: #f2f6f5;
}

/* ============ Collapsible API config bar ============ */
.config-section {
	padding: 10px;
}

.config-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 auto;
	padding: 8px 18px;
	border: 1px solid rgba(93, 133, 156, 0.2);
	border-radius: 999px;
	background: rgba(10, 18, 30, 0.85);
	color: var(--text-secondary);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.config-bar:hover {
	border-color: rgba(54, 214, 176, 0.5);
	box-shadow: 0 0 16px rgba(54, 214, 176, 0.18);
	color: var(--text-primary);
}

.config-bar-status {
	font-weight: 600;
	color: var(--accent);
}

.config-bar-hint {
	color: var(--text-muted);
}

.config-bar-arrow {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.25s ease;
}

.config-section.expanded .config-bar-arrow {
	transform: rotate(180deg);
}

.config-panel {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.35s ease;
}

.config-panel > .header-controls,
.config-panel > .model-info {
	padding: 6px 12px 0;
}

.config-section.expanded .config-panel {
	max-height: 620px;
}

:root[data-theme="light"] .config-bar {
	background: rgba(255, 255, 255, 0.9);
	border-color: rgba(35, 74, 65, 0.16);
	color: #176c5d;
}

:root[data-theme="light"] .config-bar-hint {
	color: #6d8584;
}

/* ============ Conversation layout: full width, left/right bubbles, right scrollbar ============ */
.chat-container {
	max-width: none;
}

.chat-messages {
	padding-right: 14px;
	scrollbar-gutter: stable;
}

.message.user {
	text-align: right;
	max-width: none;
}

.message-content {
	max-width: 92%;
}

.chat-messages::-webkit-scrollbar,
.sessions-list::-webkit-scrollbar,
.uploaded-files::-webkit-scrollbar {
	width: 10px;
}

.chat-messages::-webkit-scrollbar-track,
.sessions-list::-webkit-scrollbar-track,
.uploaded-files::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.25);
}

.chat-messages::-webkit-scrollbar-thumb,
.sessions-list::-webkit-scrollbar-thumb,
.uploaded-files::-webkit-scrollbar-thumb {
	background: rgba(119, 170, 173, 0.35);
	border-radius: 6px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sessions-list::-webkit-scrollbar-thumb:hover,
.uploaded-files::-webkit-scrollbar-thumb:hover {
	background: rgba(54, 214, 176, 0.55);
}

@media (max-width: 768px) {
	.message-content {
		max-width: 96%;
	}
}

/* ============ Bottom input: drop the container frame, keep the field ============ */
.input-container {
	position: relative;
	background: transparent;
	border: none;
	box-shadow: none;
	padding: 0;
	max-width: none;
}

:root[data-theme="light"] .input-container {
	background: transparent;
	border: none;
	box-shadow: none;
}

/* ============ Drag & drop overlay ============ */
.main-content.drag-over {
	border: 2px dashed rgba(54, 214, 176, 0.7);
	background: rgba(54, 214, 176, 0.08);
	box-shadow: inset 0 0 60px rgba(54, 214, 176, 0.12);
}

.main-content.drag-over::after {
	content: '松开以添加文件';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 20;
	padding: 16px 30px;
	background: rgba(10, 18, 30, 0.88);
	border: 1px solid rgba(54, 214, 176, 0.45);
	border-radius: 14px;
	color: var(--accent);
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
	pointer-events: none;
}

:root[data-theme="light"] .main-content.drag-over {
	border-color: #168c70;
	background: rgba(22, 140, 112, 0.08);
	box-shadow: inset 0 0 60px rgba(22, 140, 112, 0.1);
}

:root[data-theme="light"] .main-content.drag-over::after {
	background: rgba(255, 255, 255, 0.94);
	border-color: rgba(22, 140, 112, 0.45);
	color: #08735e;
	box-shadow: 0 10px 30px rgba(35, 74, 65, 0.15);
}

/* ============ Uploaded files: tags above the input field ============ */
.input-container {
	flex-wrap: wrap;
}

.uploaded-files {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
	max-width: none;
	max-height: none;
	padding: 0 4px 10px;
}

.uploaded-file {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	padding: 5px 8px 5px 10px;
	background: rgba(27, 49, 56, 0.72);
	border: 1px solid rgba(93, 133, 156, 0.24);
	border-radius: 10px;
	color: var(--text-secondary);
	font-size: 12px;
}

.uploaded-file-icon {
	font-size: 14px;
	line-height: 1;
}

.uploaded-file-name {
	max-width: 220px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.uploaded-file .remove-file-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.uploaded-file .remove-file-btn:hover {
	background: rgba(255, 113, 128, 0.18);
	color: #ff8993;
}

.uploaded-file .remove-file-btn svg {
	width: 12px;
	height: 12px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

:root[data-theme="light"] .uploaded-file {
	background: rgba(255, 255, 255, 0.85);
	border-color: rgba(35, 74, 65, 0.16);
	color: #5a6b66;
}

:root[data-theme="light"] .uploaded-file .remove-file-btn:hover {
	background: rgba(197, 55, 71, 0.12);
	color: #c53747;
}

/* ============ Resizer: visible green, brighter on hover ============ */
.sidebar-resizer {
	background: rgba(54, 214, 176, 0.6);
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
	background: rgba(54, 214, 176, 0.95);
}

:root[data-theme="light"] .sidebar-resizer {
	background: rgba(23, 108, 93, 0.5);
}

:root[data-theme="light"] .sidebar-resizer:hover,
:root[data-theme="light"] .sidebar-resizer.resizing {
	background: rgba(8, 115, 94, 0.85);
}

/* ============ Sidebar footer: stable layout, no jumping ============ */
.sidebar-footer {
	position: relative;
}

.session-controls {
	flex-wrap: nowrap;
}

.session-name-row {
	flex: 1;
	min-width: 0;
}

.session-name-input {
	flex: 1;
	min-width: 0;
	width: auto;
}

.auto-save-indicator {
	position: absolute;
	top: 8px;
	right: 12px;
	transform: none;
}

/* ============ Config panel: fully expand so model info is not clipped ============ */
.config-section.expanded .config-panel {
	max-height: 800px;
}

.config-panel > .model-info {
	padding: 6px 12px 16px;
}

/* ============ Message input: themed thin scrollbar (no white bar) ============ */
.message-input {
	scrollbar-width: thin;
	scrollbar-color: rgba(119, 170, 173, 0.14) transparent;
}

.message-input::-webkit-scrollbar {
	width: 6px;
}

.message-input::-webkit-scrollbar-track {
	background: transparent;
}

.message-input::-webkit-scrollbar-thumb {
	background: rgba(119, 170, 173, 0.14);
	border-radius: 3px;
}

.message-input::-webkit-scrollbar-thumb:hover {
	background: rgba(54, 214, 176, 0.24);
}

:root[data-theme="light"] .message-input {
	scrollbar-color: rgba(35, 74, 65, 0.12) transparent;
}

:root[data-theme="light"] .message-input::-webkit-scrollbar-thumb {
	background: rgba(35, 74, 65, 0.12);
}

/* Ensure panels do NOT create their own backdrop layer, so the single
   fixed grid stays perfectly aligned while resizing the sidebar. */
.sidebar,
.main-content,
.config-section,
.input-container {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

/* ============ Session list readability ============ */
.session-item {
	background: rgba(13, 22, 29, 0.5);
	border-color: rgba(93, 133, 156, 0.14);
}

.session-item:hover {
	background: rgba(13, 22, 29, 0.72);
	border-color: rgba(54, 214, 176, 0.32);
}

:root[data-theme="light"] .session-item {
	background: rgba(255, 255, 255, 0.55);
	border-color: rgba(35, 74, 65, 0.12);
}

:root[data-theme="light"] .session-item:hover {
	background: rgba(255, 255, 255, 0.85);
	border-color: rgba(35, 74, 65, 0.22);
}

:root[data-theme="light"] .new-chat-btn,
:root[data-theme="light"] .sidebar-action-btn {
	color: #176c5d;
}

:root[data-theme="light"] .theme-toggle,
:root[data-theme="light"] .theme-toggle-label,
:root[data-theme="light"] .config-section label,
:root[data-theme="light"] .endpoint-hint,
:root[data-theme="light"] .model-info {
	color: #5a6b66;
}

/* ============ Active session item readability ============ */
.session-item.active {
	background: rgba(54, 214, 176, 0.16);
	border-color: rgba(54, 214, 176, 0.45);
	color: var(--text-primary);
}

.session-item.active .session-date,
.session-item.active .created-date {
	color: var(--text-secondary);
}

:root[data-theme="light"] .session-item.active {
	background: rgba(22, 140, 112, 0.14);
	border-color: rgba(22, 140, 112, 0.4);
	color: #0c3b31;
}

:root[data-theme="light"] .session-item.active .session-date,
:root[data-theme="light"] .session-item.active .created-date {
	color: #176c5d;
}

/* ============ Message copy button (glass, appears on hover) ============ */
.message {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	position: relative;
}

.message.user {
	justify-content: flex-end;
	text-align: left;
}

.message-actions {
	position: static;
	flex-shrink: 0;
	align-self: flex-end;
	z-index: 2;
	opacity: 0;
	transform: translateY(2px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.message.user .message-actions {
	order: -1;
}

.message:hover .message-actions,
.message-actions:focus-within {
	opacity: 1;
	transform: translateY(0);
}

.message-copy,
.message-copy-u,
.message-copy-s {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid rgba(119, 170, 173, 0.25);
	border-radius: 9px;
	background: rgba(10, 18, 30, 0.72);
	color: var(--text-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.message-copy:hover,
.message-copy-u:hover,
.message-copy-s:hover {
	border-color: rgba(54, 214, 176, 0.5);
	background: rgba(54, 214, 176, 0.12);
	color: var(--accent);
	box-shadow: 0 0 14px rgba(54, 214, 176, 0.18);
}

.message-copy.copied,
.message-copy-u.copied,
.message-copy-s.copied {
	border-color: rgba(54, 214, 176, 0.6);
	background: rgba(54, 214, 176, 0.18);
	color: var(--accent);
}

.message-copy svg,
.message-copy-u svg,
.message-copy-s svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

:root[data-theme="light"] .message-copy,
:root[data-theme="light"] .message-copy-u,
:root[data-theme="light"] .message-copy-s {
	background: rgba(255, 255, 255, 0.78);
	border-color: rgba(35, 74, 65, 0.18);
	color: #5a6b66;
}

:root[data-theme="light"] .message-copy:hover,
:root[data-theme="light"] .message-copy-u:hover,
:root[data-theme="light"] .message-copy-s:hover {
	border-color: rgba(22, 140, 112, 0.45);
	background: rgba(22, 140, 112, 0.12);
	color: #08735e;
}

/* Make the chat container the positioning context for the floating indicator. */
.chat-container {
	position: relative;
}

/* ============ Page frame: green outline that resizes with the window ============ */
.page-frame {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
	border: 4px solid rgba(54, 214, 176, 0.6);
	border-radius: 0;
	box-shadow: inset 0 0 24px rgba(54, 214, 176, 0.12);
}

:root[data-theme="light"] .page-frame {
	border-color: rgba(13, 90, 72, 0.8);
	box-shadow: inset 0 0 24px rgba(13, 90, 72, 0.18);
}

/* ============ Mobile adaption (desktop untouched) ============ */
@media (max-width: 768px) {
	.page-frame {
		border-width: 2px;
	}

	/* Sidebar drawer fits the phone width */
	.sidebar {
		width: min(85vw, 320px);
		max-width: min(85vw, 320px);
		min-width: min(85vw, 320px);
		margin-left: calc(-1 * min(85vw, 320px));
	}

	/* Copy button always visible on touch (no hover) */
	.message-actions,
	.message.user .message-actions {
		position: static;
		opacity: 1;
		transform: none;
	}

	.message {
		gap: 6px;
	}

	/* Typing indicator sits above the input on small screens */
	.typing-indicator {
		bottom: 92px;
	}

	/* Touch-friendly input row */
	.input-container {
		gap: 6px;
	}

	.file-upload-container .icon-btn,
	.action-buttons .icon-btn,
	.send-button {
		width: 36px;
		height: 36px;
	}

	/* Compact messages */
	.message {
		margin-bottom: 16px;
	}

	.message-content {
		font-size: 14px;
		padding: 12px 14px;
	}

	/* Config bar and panel */
	.config-bar {
		font-size: 12px;
		padding: 7px 14px;
	}

	.config-panel > .header-controls,
	.config-panel > .model-info {
		padding: 6px 6px 0;
	}

	/* Session name row on narrow sidebar */
	.session-name-input {
		min-width: 0;
	}
}

@media (max-width: 480px) {
	.message-content {
		max-width: 100%;
	}

	.chat-messages {
		padding: 16px 10px 130px;
	}

	.config-section {
		margin: 8px 8px 0;
	}

	.action-buttons-group {
		gap: 6px;
	}
}

/* ============ API config / exit button ============ */
.api-config-btn {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	margin-top: 10px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: rgba(26, 45, 51, 0.68);
	color: var(--text-secondary);
	cursor: pointer;
	font: inherit;
	font-size: 12px;
	text-align: left;
	transition: var(--transition);
}

.api-config-btn:hover {
	border-color: rgba(54, 214, 176, 0.42);
	background: rgba(54, 214, 176, 0.1);
	color: var(--accent);
}

.api-config-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 8px;
	background: rgba(54, 214, 176, 0.14);
	color: var(--accent);
	flex-shrink: 0;
}

.api-config-icon svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

:root[data-theme="light"] .api-config-btn {
	background: rgba(239, 247, 244, 0.82);
	color: #5a6b66;
}

:root[data-theme="light"] .api-config-btn:hover {
	background: rgba(22, 140, 112, 0.1);
	color: #08735e;
}

/* ============ Model select: custom arrow, glass look ============ */
.model-select-label {
	font-size: 12px;
	font-weight: 700;
	color: var(--text-secondary);
	white-space: nowrap;
	flex-shrink: 0;
}

:root[data-theme="light"] .model-select-label {
	color: #5a6b66;
}

.model-select {
	-webkit-appearance: none !important;
	appearance: none !important;
	padding-right: 32px !important;
	background-color: rgba(5, 14, 19, 0.68);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%239ab0ae' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat !important;
	background-position: right 10px center !important;
	background-size: 14px 14px !important;
	cursor: pointer;
}

.model-select:hover {
	border-color: rgba(54, 214, 176, 0.4);
}

:root[data-theme="light"] .model-select {
	background-color: #fbfdfc;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23176c5d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat !important;
	background-position: right 10px center !important;
	background-size: 14px 14px !important;
}

/* ============ Custom confirm modal ============ */
.modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(4, 8, 16, 0.55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* hidden must actually remove the overlay from view/pick so it never blocks clicks */
.modal-overlay[hidden] {
	display: none !important;
}

.modal-overlay.show {
	opacity: 1;
}

.modal-card {
	width: 100%;
	max-width: 400px;
	padding: 24px;
	background: rgba(13, 22, 30, 0.97);
	border: 1px solid rgba(93, 133, 156, 0.28);
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
	transform: translateY(10px) scale(0.98);
	transition: transform 0.22s ease;
}

.modal-overlay.show .modal-card {
	transform: translateY(0) scale(1);
}

.modal-title {
	font-size: 16px;
	margin-bottom: 10px;
	color: var(--text-primary);
}

.modal-message {
	font-size: 13px;
	line-height: 1.6;
	color: var(--text-secondary);
	margin-bottom: 20px;
}

.modal-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

.modal-btn {
	padding: 9px 18px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: rgba(27, 49, 56, 0.72);
	color: var(--text-secondary);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	transition: var(--transition);
}

.modal-btn:hover {
	border-color: rgba(54, 214, 176, 0.4);
	color: var(--text-primary);
}

.modal-btn.danger {
	background: rgba(255, 113, 128, 0.12);
	border-color: rgba(255, 113, 128, 0.4);
	color: #ff8993;
}

.modal-btn.danger:hover {
	background: var(--error);
	border-color: var(--error);
	color: #fff;
}

body.modal-open {
	overflow: hidden;
}

:root[data-theme="light"] .modal-card {
	background: rgba(255, 255, 255, 0.97);
	border-color: rgba(35, 74, 65, 0.18);
}

:root[data-theme="light"] .modal-btn {
	background: #f1f7f5;
	color: #5a6b66;
}

:root[data-theme="light"] .modal-btn.danger {
	background: #fff4f4;
	color: #c53747;
}

:root[data-theme="light"] .modal-btn.danger:hover {
	background: #e05260;
	border-color: #e05260;
	color: #fff;
}

/* ============ Light theme: readable markdown text in assistant replies ============ */
:root[data-theme="light"] .message.assistant .markdown-heading,
:root[data-theme="light"] .message.assistant .markdown-bold {
	color: #0e3d33;
}

:root[data-theme="light"] .message-content code {
	color: #0b4a6b;
	background: rgba(11, 74, 107, 0.08);
}

:root[data-theme="light"] .message-content pre {
	background: rgba(11, 74, 107, 0.06);
	border-color: rgba(11, 74, 107, 0.14);
}

