:root {
	/* True Monochrome "ChatGPT" Palette */
	--bg: #f9f9f9; /* Sidebar background */
	--surface: #ffffff; /* Main canvas */
	--surface-hover: #ececf1; /* Subtle gray hover */
	--surface-muted: #f4f4f5; /* Input area background */

	--border: #e5e5e5;
	--border-light: #f0f0f0;

	--text: #0d0d0d;
	--text-secondary: #5e5e5e;
	--muted: #8e8ea0;

	--primary: #000000;
	--primary-hover: #333333;
	--primary-bg: #f9f9f9;

	--success: #0f0f0f;
	--success-bg: #ececf1;
	--danger: #ef4444;
	--danger-bg: #fef2f2;

	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
	--shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
	
	--radius-sm: 6px;
	--radius: 12px;
	--radius-lg: 16px;
	--radius-full: 9999px;
	
	--font-sans: "Söhne", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: var(--font-sans);
	color: var(--text);
	background: var(--surface);
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	line-height: 1.5;
}

button, input, select, textarea {
	font: inherit;
	border: none;
	outline: none;
	background: transparent;
}

button {
	cursor: pointer;
	transition: all 0.2s ease;
}

button:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

/* Base Inputs */
input, select, textarea {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	padding: 0.75rem 1rem;
	transition: border-color 0.2s;
	font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
	border-color: var(--text-secondary);
}

textarea {
	resize: none;
	min-height: 44px;
}

label {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	color: var(--text-secondary);
	font-weight: 500;
	font-size: 0.85rem;
}

.hidden {
	display: none !important;
}

/* Layout Shell */
.app-shell {
	display: flex;
	flex-direction: column;
	background: var(--surface);
	height: 100vh;
	overflow: hidden;
}

.workspace {
	display: flex;
	flex: 1;
	min-height: 0;
	width: 100%;
	overflow: hidden;
	position: relative;
}

/* Desktop Sidebar */
.sidebar {
	width: 260px;
	background: var(--bg);
	display: flex;
	flex-direction: column;
	height: 100%;
	flex-shrink: 0;
	border-right: 1px solid var(--border);
	transition: width 0.18s ease;
}

.sidebar-header {
	padding: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.sidebar-collapse-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	flex: 0 0 auto;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
}

.sidebar-collapse-button:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.new-chat-btn {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.6rem 0.75rem;
	background: transparent;
	color: var(--text);
	border: none;
	border-radius: var(--radius-sm);
	font-weight: 500;
	font-size: 0.9rem;
	text-align: left;
}
.new-chat-btn:hover {
	background: var(--surface-hover);
}

.workspace.sidebar-collapsed .sidebar {
	display: none;
}

.workspace.sidebar-collapsed .sidebar-header {
	flex-direction: column;
	padding: 0.75rem 0.55rem;
}

.workspace.sidebar-collapsed .new-chat-btn {
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
}

.workspace.sidebar-collapsed .new-chat-btn span,
.workspace.sidebar-collapsed .sidebar-body,
.workspace.sidebar-collapsed .sidebar-footer {
	display: none;
}

.workspace.sidebar-collapsed .sidebar-collapse-button svg {
	transform: rotate(180deg);
}

.sidebar-overlay-backdrop {
	position: absolute;
	inset: 0;
	z-index: 24;
	background: linear-gradient(90deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0));
}

.workspace.sidebar-overlay-open .sidebar {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 25;
	display: flex;
	width: min(320px, calc(100vw - 32px));
	height: 100%;
	border-right: 1px solid var(--border);
	box-shadow: 20px 0 48px rgba(0, 0, 0, 0.12);
}

.workspace.sidebar-overlay-open .sidebar-header {
	flex-direction: row;
	padding: 1rem;
}

.workspace.sidebar-overlay-open .new-chat-btn {
	justify-content: flex-start;
	width: 100%;
	height: auto;
	padding: 0.6rem 0.75rem;
}

.workspace.sidebar-overlay-open .new-chat-btn span,
.workspace.sidebar-overlay-open .sidebar-body,
.workspace.sidebar-overlay-open .sidebar-footer {
	display: flex;
}

.workspace.sidebar-overlay-open .sidebar-body,
.workspace.sidebar-overlay-open .sidebar-footer {
	flex-direction: column;
}

.sidebar-body {
	flex: 1;
	overflow-y: auto;
	padding: 0 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.sidebar-section-title {
	font-size: 0.7rem;
	font-weight: 600;
	color: var(--muted);
	margin-top: 1rem;
	margin-bottom: 0.5rem;
	padding-left: 0.25rem;
}

.sidebar-section-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.sidebar-section-row .sidebar-section-title {
	margin-bottom: 0.35rem;
}

.history-header-row {
	min-height: 34px;
}

.history-expand-button {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-width: 0;
	flex: 1;
	padding: 0.25rem 0;
	color: var(--muted);
	font-size: 0.74rem;
	font-weight: 600;
	text-align: left;
}

.history-expand-button:hover {
	color: var(--text);
}

.history-expand-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	transition: transform 0.16s ease;
	font-size: 1rem;
	line-height: 1;
}

.history-expand-icon.expanded {
	transform: rotate(90deg);
}

.history-header-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	flex-shrink: 0;
}

.history-toggle-button {
	flex: 0 0 auto;
	padding: 0.25rem 0.4rem;
	border-radius: var(--radius-sm);
	color: var(--muted);
	font-size: 0.72rem;
}

.history-toggle-button:hover,
.history-toggle-button.active {
	background: var(--surface-hover);
	color: var(--text);
}

.history-search {
	position: relative;
	display: grid;
	grid-template-columns: 18px minmax(0, 1fr) 24px;
	align-items: center;
	gap: 0.35rem;
	min-height: 34px;
	padding: 0.25rem 0.35rem;
	border: 1px solid var(--border-light);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--muted);
}

.history-search:focus-within {
	border-color: var(--border);
	color: var(--text-secondary);
}

.history-search input {
	min-width: 0;
	padding: 0;
	border: none;
	box-shadow: none;
	background: transparent;
	color: var(--text);
	font-size: 0.84rem;
}

.history-search-clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: var(--radius-full);
	color: var(--muted);
	font-size: 1rem;
	line-height: 1;
}

.history-search-clear:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.history-search-modal {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.history-search-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, 0.28);
	backdrop-filter: blur(3px);
}

.history-search-dialog {
	position: relative;
	width: min(680px, 100%);
	max-height: min(680px, calc(100vh - 3rem));
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	padding: 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

.history-search-dialog-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.history-search-dialog-header h2 {
	margin: 0;
	color: var(--text);
	font-size: 1rem;
	font-weight: 600;
}

.history-search-dialog-header p {
	margin: 0.25rem 0 0;
	color: var(--muted);
	font-size: 0.82rem;
	line-height: 1.4;
}

.modal-close-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	flex: 0 0 auto;
	border-radius: var(--radius-full);
	color: var(--text-secondary);
	font-size: 1.2rem;
	line-height: 1;
}

.modal-close-button:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.history-search-results {
	min-height: 80px;
	max-height: min(440px, calc(100vh - 18rem));
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.history-search-result {
	border-radius: var(--radius-sm);
}

.history-search-result-main {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.2rem;
	padding: 0.65rem 0.7rem;
	border-radius: var(--radius-sm);
	color: var(--text);
	text-align: left;
}

.history-search-result-main:hover {
	background: var(--surface-hover);
}

.history-list {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.history-entry {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.25rem;
	border-radius: var(--radius-sm);
}

.history-entry:hover,
.history-entry.active {
	background: var(--surface-hover);
}

.history-item {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.5rem 0.75rem;
	border-radius: var(--radius-sm);
	color: var(--text);
	text-align: left;
	min-width: 0;
}
.history-entry.active .history-title { font-weight: 500; }
.history-title-row {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	min-width: 0;
}
.history-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 0.7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-unread-dot {
	width: 7px;
	height: 7px;
	border-radius: var(--radius-full);
	background: #2563eb;
	box-shadow: 0 0 0 2px var(--surface);
	flex: 0 0 auto;
}
.history-actions {
	display: flex;
	align-items: center;
	gap: 0.15rem;
	padding-right: 0.25rem;
	opacity: 0;
	pointer-events: none;
}
.history-entry:hover .history-actions,
.history-entry.active .history-actions,
.history-actions:focus-within {
	opacity: 1;
	pointer-events: auto;
}
.history-action {
	padding: 0.25rem 0.35rem;
	border-radius: var(--radius-sm);
	color: var(--muted);
	font-size: 0.72rem;
}
.history-action:hover {
	background: var(--surface);
	color: var(--text);
}
.history-action.danger:hover {
	color: var(--danger);
	background: var(--danger-bg);
}

.sidebar-footer {
	position: relative;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	border-top: 1px solid var(--border);
}

.task-status-row, .user-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.user-row {
	width: 100%;
}

.status-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.15rem 0.4rem;
	border-radius: var(--radius-sm);
	background: var(--surface-hover);
	color: var(--text-secondary);
	font-weight: 500;
	font-size: 0.7rem;
}

.task-label {
	font-size: 0.75rem;
	color: var(--muted);
	text-align: right;
	max-width: 60%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.user-menu-button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	width: 100%;
	min-width: 0;
	padding: 0.5rem 0.6rem;
	border-radius: var(--radius-sm);
	color: var(--text);
	text-align: left;
}

.user-menu-button:hover {
	background: var(--surface-hover);
}

.session-label {
	display: block;
	min-width: 0;
	flex: 1;
	font-size: 0.85rem;
	color: var(--text);
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Main Content Area */
.main-content {
	flex: 1;
	background: var(--surface);
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	position: relative;
}

.main-header {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.75rem;
	min-height: 56px;
	padding: 0.75rem 1.5rem;
	flex-shrink: 0;
	border-bottom: 1px solid var(--border-light);
}

.main-sidebar-open-button {
	display: none;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	flex: 0 0 auto;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
}

.main-sidebar-open-button:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.workspace.sidebar-collapsed .main-sidebar-open-button {
	display: inline-flex;
}

.brand {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--text);
}

.download-group {
	display: flex;
	gap: 0.5rem;
}

/* Scrollable Canvas */
.scrollable-canvas {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1.25rem 1.5rem 12rem;
}

.conversation-navigator {
	position: fixed;
	right: 1.25rem;
	top: 50%;
	z-index: 35;
	display: flex;
	align-items: center;
	gap: 0.7rem;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%) translateX(10px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.conversation-navigator.visible {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(-50%) translateX(0);
}

.conversation-navigator-list {
	display: grid;
	justify-items: stretch;
	gap: 0.24rem;
	width: 2.35rem;
	padding: 0.55rem 0.4rem;
	border: 1px solid var(--border-light);
	border-radius: 1rem;
	background: rgba(255, 255, 255, 0.78);
	box-shadow: var(--shadow-sm);
	backdrop-filter: blur(12px);
	transition: width 0.16s ease, padding 0.16s ease, border-radius 0.16s ease;
}

.conversation-navigator:hover .conversation-navigator-list,
.conversation-navigator:focus-within .conversation-navigator-list {
	width: 22rem;
	padding: 0.55rem;
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: var(--shadow);
}

.conversation-navigator-item {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	min-width: 0;
	height: 1.45rem;
	padding: 0 0.25rem;
	border-radius: var(--radius-sm);
	color: var(--muted);
	transition: background 0.16s ease, color 0.16s ease, height 0.16s ease, padding 0.16s ease;
}

.conversation-navigator-line {
	display: block;
	width: 100%;
	height: 2px;
	border-radius: var(--radius-full);
	background: #9ca3af;
	transition: width 0.15s ease, opacity 0.12s ease, background 0.15s ease, height 0.15s ease;
}

.conversation-navigator-item.active .conversation-navigator-line {
	width: 100%;
	height: 3px;
	background: #111827;
}

.conversation-navigator-title {
	display: none;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 0.98rem;
	font-weight: 550;
	line-height: 1.15;
}

.conversation-navigator:hover .conversation-navigator-item,
.conversation-navigator:focus-within .conversation-navigator-item {
	height: 2.05rem;
	padding: 0 0.75rem;
}

.conversation-navigator:hover .conversation-navigator-item:hover,
.conversation-navigator:focus-within .conversation-navigator-item:focus-visible,
.conversation-navigator:hover .conversation-navigator-item.active,
.conversation-navigator:focus-within .conversation-navigator-item.active {
	background: rgba(17, 24, 39, 0.06);
	color: var(--text);
}

.conversation-navigator:hover .conversation-navigator-line,
.conversation-navigator:focus-within .conversation-navigator-line {
	display: none;
}

.conversation-navigator:hover .conversation-navigator-title,
.conversation-navigator:focus-within .conversation-navigator-title {
	display: block;
}

.conversation-navigator-item.active .conversation-navigator-title {
	font-weight: 650;
}

.conversation-navigator-preview {
	max-width: min(300px, 40vw);
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: var(--shadow);
	color: var(--text);
	font-size: 0.86rem;
	line-height: 1.45;
	backdrop-filter: blur(12px);
}

/* Tabs */
.tabs {
	z-index: 8;
	display: flex;
	justify-content: center;
	gap: 0.25rem;
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	padding: 0.35rem;
	overflow-x: auto;
	flex-shrink: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: var(--shadow);
	backdrop-filter: blur(10px);
}

.scrollable-canvas.artifact-mode .tabs {
	position: sticky;
	top: 0;
}
.tabs button {
	flex: 0 0 auto;
	min-height: 36px;
	padding: 0.45rem 0.7rem;
	color: var(--muted);
	font-weight: 400;
	font-size: 0.9rem;
	border-radius: var(--radius-sm);
	white-space: nowrap;
}
.tabs button:hover:not(.active):not(:disabled) {
	background: var(--surface-muted);
	color: var(--text-secondary);
}
.tabs button.active {
	background: var(--text);
	color: var(--surface);
	font-weight: 500;
}
.tabs .archive-tab {
	border-left: 1px solid var(--border-light);
}
.tabs .back-tab {
	color: var(--text);
	font-weight: 500;
}

/* Artifact Content */
.artifact-content {
	max-width: 880px;
	margin: 0 auto;
	width: 100%;
	padding: 0 0 2.5rem;
	flex: 1;
}

.scrollable-canvas.conversation-mode .artifact-content {
	display: none;
}

.scrollable-canvas.artifact-mode {
	gap: 0.75rem;
}

.scrollable-canvas.artifact-mode .artifact-content {
	padding-top: 0.25rem;
}

.artifact-grid { display: flex; flex-direction: column; gap: 2rem; }
.artifact-card {
	background: transparent;
	padding: 0 0 1.5rem 0;
	border-bottom: 1px solid var(--border-light);
}
.artifact-card:last-child { border-bottom: none; }
.artifact-title { font-size: 1.25rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }
.artifact-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; font-size: 0.8rem; color: var(--muted); }
.artifact-body { font-size: 0.95rem; line-height: 1.7; color: var(--text); word-break: break-word; }

.artifact-body:not(.markdown-body) {
	white-space: pre-wrap;
}

.compact-markdown h1,
.compact-markdown h2,
.compact-markdown h3 {
	margin-top: 0.9rem;
	margin-bottom: 0.35rem;
	font-size: 1rem;
}

.compact-markdown h1:first-child,
.compact-markdown h2:first-child,
.compact-markdown h3:first-child,
.compact-markdown p:first-child,
.compact-markdown ul:first-child,
.compact-markdown ol:first-child {
	margin-top: 0;
}

.compact-markdown p,
.compact-markdown ul,
.compact-markdown ol,
.compact-markdown table {
	margin-bottom: 0.75rem;
}

.compact-markdown > :last-child {
	margin-bottom: 0;
}

/* Bottom Input Area */
.input-container {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 1rem 1.5rem 0.75rem;
	background: linear-gradient(0deg, var(--surface) 82%, rgba(255,255,255,0) 100%);
	display: flex;
	flex-direction: column;
	align-items: center;
	z-index: 10;
}

/* Realtime Message List - Pinned above input */
.conversation-panel {
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
}

.message-list-bottom {
	width: 100%;
	max-width: none;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.75rem;
	overflow: visible;
}
.message-list-bottom:empty { display: none; }
.message-list-bottom .message {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	width: fit-content;
	max-width: min(760px, 82%);
	color: var(--text);
}
.message-list-bottom .message.user {
	align-self: flex-end;
}
.message-list-bottom .message.assistant,
.message-list-bottom .message.system {
	align-self: flex-start;
}
.message-list-bottom .message.error {
	align-self: flex-start;
	color: var(--danger);
}

.message-list-bottom .message-bubble {
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	background: var(--surface-muted);
	box-shadow: var(--shadow-sm);
}

.message-list-bottom .message.user .message-bubble {
	background: var(--text);
	color: var(--surface);
}

.message-list-bottom .message.error .message-bubble {
	background: var(--danger-bg);
	border-color: rgba(239, 68, 68, 0.2);
}

.message-actions {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.2rem;
	min-height: 28px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.14s ease;
}

.message-list-bottom .message.user .message-actions {
	justify-content: flex-end;
}

.message-list-bottom .message:hover .message-actions,
.message-list-bottom .message:focus-within .message-actions {
	opacity: 1;
	pointer-events: auto;
}

.message-action-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 28px;
	border-radius: var(--radius-sm);
	color: var(--muted);
}

.message-action-button:hover:not(:disabled),
.message-action-button:focus-visible {
	background: var(--surface-hover);
	color: var(--text);
}

.message-action-button.copied {
	color: #059669;
}

.message-list-bottom .message-body {
	white-space: pre-wrap;
	word-break: break-word;
}

.message-list-bottom .message-body.markdown-body {
	white-space: normal;
}

.message-list-bottom .message.report {
	align-self: stretch;
	width: 100%;
	max-width: 100%;
}

.message-list-bottom .message.report .message-bubble {
	background: transparent;
	border-color: var(--border-light);
	box-shadow: none;
}

.report-artifact-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem;
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	background: var(--surface);
}

.report-artifact-controls button {
	flex: 0 0 auto;
	min-height: 34px;
	padding: 0.42rem 0.65rem;
	border-radius: var(--radius-sm);
	color: var(--muted);
	font-size: 0.88rem;
	white-space: nowrap;
}

.report-artifact-controls button:hover:not(:disabled),
.report-artifact-controls button:focus-visible {
	background: var(--surface-muted);
	color: var(--text-secondary);
}

.report-artifact-controls .archive-tab {
	border-left: 1px solid var(--border-light);
	color: var(--text-secondary);
}

.conversation-panel.compact {
	padding-bottom: 0.4rem;
	border-bottom: 1px solid var(--border-light);
}

.conversation-panel.compact .message-list-bottom {
	max-height: none;
	overflow: visible;
}

.conversation-panel.compact .message-list-bottom .message {
	font-size: 0.9rem;
}

.conversation-panel.compact .message-list-bottom .message-bubble {
	padding: 0.55rem 0.75rem;
}

.conversation-panel.compact .message-list-bottom .message.report {
	display: none;
}

.thinking-panel {
	width: 100%;
	overflow: visible;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
}

.thinking-toggle {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.55rem;
	width: 100%;
	min-height: 42px;
	padding: 0.65rem 1rem;
	border-bottom: 1px solid var(--border-light);
	color: var(--text-secondary);
	font-size: 0.88rem;
	font-weight: 500;
}

.thinking-toggle:hover {
	background: var(--surface-muted);
	color: var(--text);
}

.thinking-toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1rem;
	color: var(--text-secondary);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.9rem;
}

.thinking-step-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 0.35rem;
	border-radius: var(--radius-full);
	background: var(--surface-muted);
	color: var(--text-secondary);
	font-size: 0.76rem;
}

.thinking-list {
	display: grid;
	gap: 0.85rem;
	overflow: visible;
	padding: 1rem;
}

.thinking-panel.collapsed .thinking-list {
	display: none;
}

.thinking-panel.collapsed .thinking-toggle {
	border-bottom: none;
}

.task-thinking-panel {
	margin-bottom: 0.7rem;
	box-shadow: none;
}

.message.report .task-thinking-panel {
	width: 100%;
}

.thinking-step {
	display: grid;
	grid-template-columns: 18px minmax(0, 1fr);
	gap: 0.65rem;
	color: var(--text);
}

.thinking-step-dot {
	width: 8px;
	height: 8px;
	margin: 0.45rem auto 0;
	border-radius: var(--radius-full);
	background: var(--muted);
}

.thinking-step.active .thinking-step-dot {
	background: #2563eb;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.thinking-step.done .thinking-step-dot {
	background: #059669;
}

.thinking-step.error .thinking-step-dot,
.thinking-step.warning .thinking-step-dot {
	background: var(--danger);
}

.thinking-step-title {
	font-size: 0.94rem;
	font-weight: 600;
	color: var(--text);
}

.thinking-step-detail {
	margin-top: 0.2rem;
	color: var(--text-secondary);
	font-size: 0.88rem;
	line-height: 1.55;
}

.thinking-step-meta {
	margin-top: 0.25rem;
	color: var(--muted);
	font-size: 0.74rem;
}

.chat-input-box {
	width: 100%;
	max-width: 768px;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 0.5rem 0.75rem;
	box-shadow: var(--shadow-sm);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	transition: border-color 0.2s;
}
.chat-input-box:focus-within {
	border-color: var(--muted);
}

.upload-message {
	padding: 0 0.25rem;
	color: var(--text-secondary);
	font-size: 0.8rem;
}

.voice-input-message {
	padding: 0 0.25rem;
	color: var(--text-secondary);
	font-size: 0.8rem;
}

.attachment-list {
	display: grid;
	gap: 0.45rem;
	max-height: 142px;
	overflow-y: auto;
	padding: 0 0.15rem 0.1rem;
}

.attachment-card {
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	min-height: 52px;
	padding: 0.5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
}

.attachment-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	color: var(--text-secondary);
}

.attachment-content {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.attachment-title {
	overflow: hidden;
	color: var(--text);
	font-size: 0.86rem;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.attachment-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	color: var(--muted);
	font-size: 0.74rem;
	line-height: 1.2;
}

.attachment-meta span:not(:last-child)::after {
	content: "·";
	margin-left: 0.35rem;
	color: var(--border);
}

.attachment-progress {
	width: 100%;
	height: 4px;
	overflow: hidden;
	border-radius: var(--radius-full);
	background: var(--border-light);
}

.attachment-progress span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--text);
	transition: width 0.2s ease;
}

.attachment-message {
	overflow: hidden;
	color: var(--text-secondary);
	font-size: 0.75rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.attachment-card.upload-error {
	border-color: rgba(239, 68, 68, 0.35);
	background: var(--danger-bg);
}

.attachment-download {
	padding: 0.25rem 0.45rem;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	font-size: 0.76rem;
	white-space: nowrap;
}

.attachment-download:hover {
	background: var(--surface-muted);
	color: var(--text);
}

.attachment-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
}

.attachment-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: var(--radius-full);
	color: var(--text-secondary);
	font-size: 1rem;
	line-height: 1;
}

.attachment-remove:hover {
	background: var(--surface-muted);
	color: var(--text);
}

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	background: transparent;
	transition: background 0.2s, color 0.2s;
}
.icon-button:hover:not(:disabled) {
	background: var(--border);
	color: var(--text);
}

.upload-menu-wrapper {
	position: relative;
	flex-shrink: 0;
	margin-bottom: 0.25rem;
}
.upload-menu-button {
	border: 1px solid var(--border);
	border-radius: var(--radius-full);
	background: var(--surface);
}

.voice-input-button {
	flex-shrink: 0;
	margin-bottom: 0.25rem;
	border: 1px solid transparent;
	border-radius: var(--radius-full);
}

.voice-input-button.recording {
	border-color: rgba(239, 68, 68, 0.35);
	background: var(--danger-bg);
	color: var(--danger);
}

.voice-input-button:disabled {
	color: var(--muted);
	cursor: not-allowed;
}
.upload-menu {
	position: absolute;
	left: 0;
	bottom: calc(100% + 0.5rem);
	width: 168px;
	padding: 0.35rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
	box-shadow: var(--shadow-md);
	z-index: 30;
}
.upload-menu-item {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	min-height: 38px;
	padding: 0.5rem 0.6rem;
	border-radius: var(--radius-sm);
	color: var(--text);
	font-size: 0.9rem;
	text-align: left;
}
.upload-menu-item:hover {
	background: var(--surface-muted);
}
.upload-menu-item svg {
	color: var(--text-secondary);
	flex-shrink: 0;
}

.history-file-panel {
	position: absolute;
	left: 0;
	bottom: calc(100% + 0.5rem);
	width: min(320px, calc(100vw - 2rem));
	max-height: 300px;
	padding: 0.45rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-md);
	z-index: 35;
}

.history-file-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.3rem 0.35rem 0.45rem;
	color: var(--text-secondary);
	font-size: 0.78rem;
	font-weight: 600;
}

.history-file-header button {
	width: auto;
	color: var(--muted);
	font-size: 0.76rem;
}

.history-file-list {
	display: grid;
	gap: 0.2rem;
	max-height: 238px;
	overflow-y: auto;
}

.history-file-option {
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 44px;
	padding: 0.45rem;
	border-radius: var(--radius-sm);
	text-align: left;
}

.history-file-option:hover:not(:disabled) {
	background: var(--surface-muted);
}

.history-file-option.selected {
	background: var(--surface-muted);
}

.history-file-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	color: var(--text-secondary);
}

.history-file-text {
	min-width: 0;
	display: grid;
	gap: 0.1rem;
}

.history-file-title {
	overflow: hidden;
	color: var(--text);
	font-size: 0.82rem;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.history-file-meta {
	overflow: hidden;
	color: var(--muted);
	font-size: 0.72rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chat-input-wrapper {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
}

.chat-input-wrapper textarea {
	background: transparent;
	border: none;
	box-shadow: none;
	padding: 0.25rem;
	font-size: 1rem;
	line-height: 1.5;
	min-height: 24px;
	max-height: 200px;
	overflow-y: hidden;
	color: var(--text);
	flex: 1;
}

.send-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-full);
	background: var(--text);
	color: var(--surface);
	flex-shrink: 0;
	margin-bottom: 0.25rem;
}
.send-button:hover:not(:disabled) {
	background: var(--text-secondary);
}
.send-button.running {
	background: var(--danger);
	color: white;
}
.send-button.running:hover:not(:disabled) {
	background: #b91c1c;
}
.send-stop-icon {
	display: block;
}
.send-button:disabled {
	background: var(--border);
	color: var(--text-secondary);
}

.input-footer {
	font-size: 0.75rem;
	color: var(--muted);
	margin-top: 0.75rem;
	text-align: center;
}

/* Common Buttons */
.primary-button, .secondary-button, .ghost-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	font-weight: 500;
	font-size: 0.9rem;
	padding: 0.6rem 1rem;
	white-space: nowrap;
}
.primary-button { background: var(--primary); color: white; }
.primary-button:hover:not(:disabled) { background: var(--primary-hover); }

.secondary-button { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.secondary-button:hover:not(:disabled) { background: var(--surface-hover); }

.ghost-button { color: var(--text-secondary); }
.ghost-button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.compact { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.settings-popover {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 4.25rem;
	width: 100%;
	max-height: min(560px, calc(100vh - 6rem));
	overflow-y: auto;
	padding: 0.9rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-md);
	z-index: 20;
}

.settings-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text);
	margin-bottom: 0.75rem;
}

.settings-menu-item {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 0.65rem 0;
	border-top: 1px solid var(--border-light);
	color: var(--text);
	font-size: 0.9rem;
	font-weight: 500;
	text-align: left;
}

.settings-menu-item:hover {
	background: var(--surface-hover);
	color: var(--text);
}

.settings-menu-item.active {
	background: var(--surface-hover);
}

.settings-menu-item.danger {
	color: var(--danger);
}

.archived-history-page {
	flex: 1;
	overflow-y: auto;
	padding: 2rem 1.5rem 8rem;
	max-width: 900px;
	width: 100%;
	margin: 0 auto;
}

.archived-history-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.archived-history-page-header h2 {
	margin: 0 0 0.25rem;
	font-size: 1.35rem;
}

.archived-history-page-header p {
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
}

.archived-history-list {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.settings-history-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.25rem;
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
}

.settings-history-item .history-item {
	padding: 0.5rem 0.6rem;
}

.visible-actions {
	opacity: 1;
	pointer-events: auto;
}

.cloud-storage-panel {
	display: grid;
	gap: 0.45rem;
	padding: 0.2rem 0 0.85rem;
	border-bottom: 1px solid var(--border-light);
}

.cloud-storage-panel .sidebar-section-title {
	padding-left: 0;
}

.cloud-storage-meter {
	width: 100%;
	height: 5px;
	overflow: hidden;
	border-radius: var(--radius-full);
	background: var(--border-light);
}

.cloud-storage-meter span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: var(--text);
	transition: width 0.2s ease;
}

.cloud-drive-page {
	flex: 1;
	overflow-y: auto;
	padding: 1.5rem;
}

.cloud-drive-page > * {
	max-width: 820px;
	margin-left: auto;
	margin-right: auto;
}

.cloud-drive-header {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--border-light);
}

.cloud-drive-header h2 {
	margin: 0 0 0.25rem;
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--text);
}

.cloud-drive-header p {
	margin: 0;
	color: var(--text-secondary);
	font-size: 0.9rem;
}

.cloud-drive-summary {
	display: grid;
	gap: 0.45rem;
	padding: 1rem 0;
}

.cloud-drive-storage-text {
	color: var(--text-secondary);
	font-size: 0.9rem;
}

.cloud-drive-meter {
	width: 100%;
	height: 6px;
	overflow: hidden;
	border-radius: var(--radius-full);
	background: var(--border-light);
}

.cloud-drive-meter span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: var(--text);
	transition: width 0.2s ease;
}

.cloud-drive-list {
	display: grid;
	gap: 0.55rem;
	padding-bottom: 2rem;
}

.cloud-drive-file {
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.65rem;
	min-height: 56px;
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--border-light);
}

/* Enterprise Management */
.enterprise-admin-page {
	flex: 1;
	overflow-y: auto;
	padding: 2rem 1.5rem 8rem;
	max-width: 900px;
	width: 100%;
	margin: 0 auto;
}

.enterprise-admin-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.enterprise-admin-page-header h2 {
	margin: 0 0 0.25rem;
	font-size: 1.35rem;
}

.enterprise-admin-page-header p {
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
}

.enterprise-usage-summary {
	padding: 0 0 1rem;
	border-bottom: 1px solid var(--border-light);
	color: var(--text-secondary);
	font-size: 0.9rem;
}

.enterprise-member-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.65rem;
	padding: 1rem 0;
}

.enterprise-member-form input,
.enterprise-member-form select {
	width: 100%;
	min-width: 0;
	padding: 0.7rem 0.8rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font-size: 0.9rem;
}

.enterprise-member-form button {
	grid-column: 1 / -1;
	justify-self: start;
}

.enterprise-member-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-top: 0.75rem;
}

.management-card {
	padding: 0.55rem 0;
	border-bottom: 1px solid var(--border-light);
	font-size: 0.82rem;
}

.management-card:last-child {
	border-bottom: none;
}

.management-card .artifact-title {
	font-size: 0.85rem;
	margin-bottom: 0.2rem;
}

.management-card .artifact-meta {
	margin-bottom: 0;
	font-size: 0.74rem;
}

@media (max-width: 720px) {
	.enterprise-admin-page-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.enterprise-member-form {
		grid-template-columns: 1fr;
	}
}

/* Empty States */
.empty-state, .compact-empty {
	display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
	padding: 4rem 2rem; color: var(--muted); font-size: 0.95rem;
}

.inline-message { font-size: 0.8rem; color: var(--muted); }

/* SVG */
.graph-svg, .map-svg { width: 100%; min-height: 400px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* Markdown styling */
.markdown-body { font-size: 0.95rem; line-height: 1.6; color: var(--text); }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-weight: 600; color: var(--text); margin-top: 1.5em; margin-bottom: 0.5em; }
.markdown-body h1 { font-size: 1.25rem; }
.markdown-body h2 { font-size: 1.15rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin-bottom: 1em; }

/* Mobile Support */
@media (max-width: 768px) {
	.app-shell { height: 100dvh; }
	.workspace { flex-direction: column; }
	.sidebar {
		display: flex;
		width: 100%;
		height: auto;
		max-height: 40vh;
		border-right: none;
		border-bottom: 1px solid var(--border);
	}
	.workspace.sidebar-collapsed .sidebar {
		display: none;
	}
	.workspace.sidebar-overlay-open .sidebar {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 25;
		display: flex;
		width: min(320px, calc(100vw - 32px));
		height: 100%;
		max-height: none;
		border-right: 1px solid var(--border);
		border-bottom: none;
	}
	.main-content { padding-bottom: 0; }
}

/* Auth Layout */
.auth-layout { display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: 4rem 2rem; align-items: center; justify-content: center; flex: 1; overflow-y: auto; width: 100%; }
.auth-copy { text-align: center; margin-bottom: 2rem; width: max-content; max-width: 100%; }
.auth-copy h1 { margin: 0; font-size: 1.5rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.auth-card { width: 100%; display: flex; flex-direction: column; gap: 1.25rem; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: var(--radius-sm); padding: 0.25rem; gap: 0.25rem; }
.segmented-control button { padding: 0.5rem; color: var(--text-secondary); font-weight: 500; border-radius: 6px; }
.segmented-control button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.enterprise-contact-prompt {
	margin: -0.25rem 0 -0.5rem;
	color: var(--text-secondary);
	font-size: 0.85rem;
	text-align: center;
}
.enterprise-contact-actions {
	display: flex;
	justify-content: center;
	gap: 0.75rem;
}
.icon-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	background: var(--surface);
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.icon-link:hover {
	background: var(--surface-hover);
	border-color: var(--text-secondary);
	color: var(--text);
}

@media (max-width: 768px) {
	.auth-copy h1 { white-space: normal; }
}

/* Sandbox Modal */
.sandbox-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sandbox-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(4px);
}

.sandbox-content {
	position: relative;
	width: 90%;
	max-width: 1200px;
	height: 90vh;
	background: var(--surface);
	border-radius: var(--radius-lg);
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border);
	animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
	from { opacity: 0; transform: translateY(20px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.sandbox-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1.5rem;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.sandbox-title {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 60%;
}

.sandbox-actions {
	display: flex;
	gap: 0.5rem;
}

.sandbox-iframe-container {
	flex: 1;
	background: var(--surface-muted);
	position: relative;
}

.sandbox-iframe-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
	background: var(--surface);
}
