/* ==========================================================================
   KoKo AI Chatbot - Ultra-sleek Design System & Theme Tokens
   ========================================================================== */

:root {
	--font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

	/* Color Tokens - Default Dark Theme */
	--bg-app: #0d1117;
	--bg-sidebar: #080c10;
	--bg-card: #161b22;
	--bg-card-hover: #1f242c;
	--bg-input: #12161f;
	--bg-bubble-user: #f97316;
	--bg-bubble-bot: #161b22;
	--border-subtle: #21262d;
	--border-strong: #30363d;
	--border-focus: #f97316;

	--text-primary: #f0f6fc;
	--text-secondary: #8b949e;
	--text-muted: #6e7681;
	--text-on-accent: #ffffff;

	--accent: #f97316;
	--accent-hover: #ea580c;
	--accent-glow: rgba(249, 115, 22, 0.25);
	--accent-gradient: linear-gradient(135deg, #ff7849 0%, #f43f5e 50%, #8b5cf6 100%);
	--card-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);

	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 18px;
	--radius-xl: 24px;
	--radius-full: 9999px;

	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
	--shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
	--shadow-glow: 0 0 24px rgba(249, 115, 22, 0.2);

	--transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
	--transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Midnight Theme */
[data-theme="midnight"] {
	--bg-app: #030712;
	--bg-sidebar: #02040a;
	--bg-card: #0b0f19;
	--bg-card-hover: #111827;
	--bg-input: #080c14;
	--bg-bubble-user: #6366f1;
	--bg-bubble-bot: #0b0f19;
	--border-subtle: #1e293b;
	--border-strong: #334155;
	--border-focus: #6366f1;
	--text-primary: #f8fafc;
	--text-secondary: #94a3b8;
	--text-muted: #64748b;
	--accent: #6366f1;
	--accent-hover: #4f46e5;
	--accent-glow: rgba(99, 102, 241, 0.25);
	--accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
}

/* Light Theme */
[data-theme="light"] {
	--bg-app: #f8fafc;
	--bg-sidebar: #f1f5f9;
	--bg-card: #ffffff;
	--bg-card-hover: #f1f5f9;
	--bg-input: #ffffff;
	--bg-bubble-user: #f97316;
	--bg-bubble-bot: #ffffff;
	--border-subtle: #e2e8f0;
	--border-strong: #cbd5e1;
	--border-focus: #f97316;
	--text-primary: #0f172a;
	--text-secondary: #475569;
	--text-muted: #94a3b8;
	--accent: #f97316;
	--accent-hover: #ea580c;
	--accent-glow: rgba(249, 115, 22, 0.2);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
	--shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	width: 100%;
	font-family: var(--font-sans);
	background-color: var(--bg-app);
	color: var(--text-primary);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

#root {
	height: 100%;
	width: 100%;
	display: flex;
}

/* Fullscreen Loader */
.fullscreen-loader {
	height: 100vh;
	width: 100vw;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	background: var(--bg-app);
}

.loader-text {
	font-size: 15px;
	font-weight: 500;
	color: var(--text-secondary);
	letter-spacing: 0.02em;
}

/* Mascot Animation */
.koko-avatar-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform var(--transition-smooth);
}

.koko-svg {
	width: 100%;
	height: 100%;
	filter: drop-shadow(0 4px 10px var(--accent-glow));
}

.koko-avatar-badge.animated:hover {
	transform: scale(1.06) rotate(3deg);
}

.koko-sparkle {
	animation: sparkleGlow 2s infinite alternate ease-in-out;
	transform-origin: center;
}

.eye-pulse {
	animation: eyePulse 1.2s infinite alternate ease-in-out;
}

@keyframes sparkleGlow {
	0% { opacity: 0.3; transform: scale(0.8); }
	100% { opacity: 1; transform: scale(1.2); }
}

@keyframes eyePulse {
	0% { opacity: 0.5; transform: scale(0.9); }
	100% { opacity: 1; transform: scale(1.1); }
}

/* ==========================================================================
   Auth Screen (Login / Register)
   ========================================================================== */
.auth-container {
	position: relative;
	width: 100%;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: radial-gradient(circle at 50% 20%, rgba(249, 115, 22, 0.12) 0%, transparent 60%), var(--bg-app);
	overflow-y: auto;
}

.auth-ambient-glow {
	position: absolute;
	top: 15%;
	left: 50%;
	transform: translateX(-50%);
	width: 450px;
	height: 350px;
	background: radial-gradient(circle, rgba(249, 115, 22, 0.18) 0%, rgba(244, 63, 94, 0.08) 50%, transparent 70%);
	filter: blur(50px);
	pointer-events: none;
	z-index: 0;
}

.auth-card {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 440px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-xl);
	padding: 36px 32px;
	box-shadow: var(--shadow-lg);
	backdrop-filter: blur(16px);
}

.auth-header {
	text-align: center;
	margin-bottom: 24px;
}

.auth-brand-badge {
	margin-bottom: 14px;
	display: flex;
	justify-content: center;
}

.auth-title {
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text-primary);
	margin-bottom: 8px;
}

.auth-subtitle {
	font-size: 14px;
	color: var(--text-secondary);
	line-height: 1.45;
}

.auth-tabs {
	display: flex;
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 4px;
	margin-bottom: 20px;
}

.auth-tab {
	flex: 1;
	background: transparent;
	border: none;
	padding: 9px 12px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--text-secondary);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.auth-tab.active {
	background: var(--bg-card);
	color: var(--text-primary);
	box-shadow: var(--shadow-sm);
}

.auth-error-banner {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(239, 68, 68, 0.12);
	border: 1px solid rgba(239, 68, 68, 0.3);
	color: #ef4444;
	padding: 10px 14px;
	border-radius: var(--radius-md);
	font-size: 13.5px;
	margin-bottom: 18px;
}

.auth-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.auth-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.auth-field label {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-primary);
}

.field-label-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.pwd-hint {
	font-size: 11.5px;
	color: var(--text-muted);
}

.input-icon-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.input-icon {
	position: absolute;
	left: 14px;
	color: var(--text-muted);
	pointer-events: none;
}

.input-icon-wrap input {
	width: 100%;
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 11px 40px 11px 40px;
	font-size: 14px;
	font-family: inherit;
	color: var(--text-primary);
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-icon-wrap input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.pwd-toggle-btn {
	position: absolute;
	right: 12px;
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pwd-toggle-btn:hover {
	color: var(--text-primary);
}

.auth-submit-btn {
	margin-top: 6px;
	background: var(--accent-gradient);
	border: none;
	border-radius: var(--radius-md);
	padding: 13px 20px;
	font-size: 14.5px;
	font-weight: 600;
	color: #ffffff;
	cursor: pointer;
	box-shadow: 0 4px 14px var(--accent-glow);
	transition: transform var(--transition-fast), opacity var(--transition-fast);
	display: flex;
	align-items: center;
	justify-content: center;
}

.auth-submit-btn:hover:not(:disabled) {
	transform: translateY(-1px);
	opacity: 0.95;
}

.auth-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.auth-spinner {
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

.auth-footer {
	margin-top: 24px;
	padding-top: 18px;
	border-top: 1px solid var(--border-subtle);
	text-align: center;
}

.auth-security-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--text-muted);
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */
.koko-app-shell {
	display: flex;
	width: 100vw;
	height: 100vh;
	position: relative;
	background: var(--bg-app);
}

/* Sidebar */
.koko-sidebar {
	width: 280px;
	min-width: 280px;
	height: 100%;
	background: var(--bg-sidebar);
	border-right: 1px solid var(--border-subtle);
	display: flex;
	flex-direction: column;
	z-index: 20;
	transition: transform var(--transition-smooth);
}

.sidebar-header {
	padding: 18px 16px 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	border-bottom: 1px solid var(--border-subtle);
}

.brand-lockup {
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand-info {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.brand-name {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text-primary);
}

.brand-tag {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	padding: 2px 6px;
	border-radius: var(--radius-full);
	background: rgba(249, 115, 22, 0.15);
	color: var(--accent);
}

.new-chat-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	background: var(--accent-gradient);
	border: none;
	border-radius: var(--radius-md);
	padding: 10px 14px;
	color: #ffffff;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 8px var(--accent-glow);
	transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.new-chat-btn:hover {
	transform: translateY(-1px);
	opacity: 0.95;
}

.sidebar-search {
	margin: 12px 16px 6px 16px;
	position: relative;
	display: flex;
	align-items: center;
}

.sidebar-search svg {
	position: absolute;
	left: 10px;
	color: var(--text-muted);
	pointer-events: none;
}

.sidebar-search input {
	width: 100%;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 8px 10px 8px 32px;
	font-size: 12.5px;
	color: var(--text-primary);
	outline: none;
	transition: border-color var(--transition-fast);
}

.sidebar-search input:focus {
	border-color: var(--accent);
}

/* Conversations List */
.conversations-scroll {
	flex: 1;
	overflow-y: auto;
	padding: 10px 10px;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.conv-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
	transition: background var(--transition-fast), color var(--transition-fast);
	position: relative;
	user-select: none;
}

.conv-item:hover {
	background: var(--bg-card-hover);
	color: var(--text-primary);
}

.conv-item.active {
	background: var(--bg-card);
	color: var(--text-primary);
	border-left: 3px solid var(--accent);
	font-weight: 500;
}

.conv-persona-icon {
	font-size: 16px;
	flex-shrink: 0;
}

.conv-title-wrap {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.conv-title {
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.conv-date {
	font-size: 10.5px;
	color: var(--text-muted);
}

.conv-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	opacity: 0;
	transition: opacity var(--transition-fast);
}

.conv-item:hover .conv-actions,
.conv-item.pinned .conv-actions {
	opacity: 1;
}

.action-icon-btn {
	background: none;
	border: none;
	color: var(--text-muted);
	padding: 4px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
}

.action-icon-btn:hover {
	background: var(--border-subtle);
	color: var(--text-primary);
}

.action-icon-btn.delete:hover {
	color: #ef4444;
}

.sidebar-loader, .empty-convs {
	padding: 24px 16px;
	text-align: center;
	font-size: 13px;
	color: var(--text-muted);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.mini-spinner {
	width: 18px;
	height: 18px;
	border: 2px solid var(--border-subtle);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

.mini-spinner.large {
	width: 32px;
	height: 32px;
	border-width: 3px;
}

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

/* Sidebar Footer */
.sidebar-footer {
	padding: 14px 16px;
	border-top: 1px solid var(--border-subtle);
	background: var(--bg-sidebar);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.user-profile-badge {
	display: flex;
	align-items: center;
	gap: 10px;
}

.user-avatar-circle {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--accent-gradient);
	color: #ffffff;
	font-weight: 700;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.user-profile-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.user-name {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.user-email {
	font-size: 11px;
	color: var(--text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.footer-action-row {
	display: flex;
	gap: 6px;
}

.sidebar-tool-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	padding: 6px 10px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.sidebar-tool-btn:hover {
	background: var(--bg-card-hover);
	color: var(--text-primary);
}

.sidebar-tool-btn.logout:hover {
	color: #ef4444;
	border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Main Chat View Area
   ========================================================================== */
.koko-main-area {
	flex: 1;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--bg-app);
	position: relative;
	min-width: 0;
}

/* Topbar */
.koko-topbar {
	height: 56px;
	min-height: 56px;
	border-bottom: 1px solid var(--border-subtle);
	padding: 0 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--bg-app);
	backdrop-filter: blur(12px);
	z-index: 10;
}

.topbar-left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.menu-toggle-btn {
	display: none;
	background: none;
	border: none;
	color: var(--text-primary);
	padding: 6px;
	cursor: pointer;
	border-radius: var(--radius-sm);
}

.persona-selector-pill {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-full);
	padding: 5px 12px 5px 8px;
	cursor: pointer;
	transition: all var(--transition-fast);
}

.persona-selector-pill:hover {
	border-color: var(--accent);
	background: var(--bg-card-hover);
}

.persona-avatar-icon {
	font-size: 16px;
}

.persona-name-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.persona-name {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--text-primary);
}

.persona-badge {
	font-size: 10px;
	background: rgba(249, 115, 22, 0.12);
	color: var(--accent);
	padding: 1px 6px;
	border-radius: var(--radius-full);
	font-weight: 600;
}

.topbar-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.topbar-action-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 7px 12px;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.topbar-action-btn:hover {
	background: var(--bg-card-hover);
	color: var(--text-primary);
}

.topbar-action-btn.icon-only {
	padding: 7px 9px;
	font-size: 14px;
}

/* Chat Feed */
.koko-chat-feed {
	flex: 1;
	overflow-y: auto;
	padding: 24px 20px 140px 20px;
	display: flex;
	flex-direction: column;
}

.feed-loading {
	margin: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	color: var(--text-muted);
	font-size: 14px;
}

/* Welcome Hero */
.koko-welcome-hero {
	max-width: 760px;
	margin: auto;
	width: 100%;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 40px 16px;
}

.hero-mascot-wrapper {
	margin-bottom: 20px;
}

.hero-title {
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text-primary);
	margin-bottom: 10px;
}

.hero-subtitle {
	font-size: 15px;
	color: var(--text-secondary);
	max-width: 540px;
	line-height: 1.5;
	margin-bottom: 32px;
}

.starters-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	width: 100%;
}

.starter-card {
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-lg);
	padding: 16px 18px;
	text-align: left;
	cursor: pointer;
	transition: all var(--transition-fast);
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.starter-card:hover {
	border-color: var(--accent);
	background: var(--bg-card-hover);
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

.starter-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.starter-icon {
	color: var(--accent);
	font-size: 14px;
}

.starter-arrow {
	color: var(--text-muted);
	font-size: 14px;
	transition: transform var(--transition-fast);
}

.starter-card:hover .starter-arrow {
	transform: translateX(4px);
	color: var(--accent);
}

.starter-text {
	font-size: 13.5px;
	color: var(--text-primary);
	line-height: 1.4;
	font-weight: 500;
}

/* Messages List */
.messages-list {
	max-width: 820px;
	width: 100%;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.message-row {
	display: flex;
	gap: 14px;
	width: 100%;
}

.message-avatar {
	flex-shrink: 0;
	margin-top: 2px;
}

.user-msg-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--accent-gradient);
	color: #ffffff;
	font-weight: 700;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.message-bubble-wrapper {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.message-meta-header {
	display: flex;
	align-items: baseline;
	gap: 8px;
}

.message-sender-name {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--text-primary);
}

.message-timestamp {
	font-size: 11px;
	color: var(--text-muted);
}

.message-bubble {
	padding: 14px 18px;
	border-radius: var(--radius-lg);
	font-size: 14.5px;
	line-height: 1.6;
	word-break: break-word;
}

.message-row.user .message-bubble {
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	color: var(--text-primary);
	border-top-left-radius: 4px;
}

.message-row.assistant .message-bubble {
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	color: var(--text-primary);
	border-top-left-radius: 4px;
	box-shadow: var(--shadow-sm);
}

.user-plain-content {
	white-space: pre-wrap;
}

/* Typing Cursor */
.typing-cursor {
	display: inline-block;
	width: 8px;
	height: 15px;
	background: var(--accent);
	margin-left: 4px;
	vertical-align: middle;
	animation: blink 0.8s infinite;
}

@keyframes blink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0; }
}

/* Message Actions Bar */
.message-actions-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
}

.msg-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: transparent;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-sm);
	padding: 4px 9px;
	font-size: 11.5px;
	font-weight: 500;
	color: var(--text-muted);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.msg-action-btn:hover {
	background: var(--bg-card-hover);
	color: var(--text-primary);
}

.msg-action-btn.speaking {
	color: #10b981;
	border-color: rgba(16, 185, 129, 0.4);
	background: rgba(16, 185, 129, 0.1);
}

/* Follow-up suggestions */
.follow-up-suggestions {
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.follow-up-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--text-secondary);
}

.follow-up-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.follow-up-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-full);
	padding: 6px 12px;
	font-size: 12.5px;
	color: var(--text-primary);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.follow-up-pill:hover {
	border-color: var(--accent);
	background: var(--bg-card-hover);
	color: var(--accent);
}

.pill-arrow {
	font-size: 11px;
	opacity: 0.6;
}

/* ==========================================================================
   Input Dock
   ========================================================================== */
.koko-input-dock {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 12px 20px 18px 20px;
	background: linear-gradient(180deg, transparent 0%, var(--bg-app) 35%);
	display: flex;
	flex-direction: column;
	align-items: center;
	z-index: 15;
}

.attached-file-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--bg-card);
	border: 1px solid var(--accent);
	border-radius: var(--radius-full);
	padding: 4px 12px;
	font-size: 12px;
	color: var(--text-primary);
	margin-bottom: 8px;
	box-shadow: var(--shadow-sm);
}

.attached-name {
	font-weight: 600;
}

.attached-size {
	color: var(--text-muted);
}

.remove-file-btn {
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 16px;
	cursor: pointer;
	padding: 0 2px;
}

.remove-file-btn:hover {
	color: #ef4444;
}

.input-box-container {
	max-width: 820px;
	width: 100%;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-xl);
	padding: 8px 12px;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	box-shadow: var(--shadow-lg);
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-box-container:focus-within {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-tool-btn {
	background: none;
	border: none;
	color: var(--text-muted);
	padding: 8px;
	border-radius: var(--radius-md);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--transition-fast);
	flex-shrink: 0;
}

.input-tool-btn:hover {
	color: var(--text-primary);
	background: var(--bg-card-hover);
}

.input-tool-btn.listening {
	color: #ef4444;
	animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

.prompt-textarea {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	font-family: inherit;
	font-size: 14.5px;
	color: var(--text-primary);
	resize: none;
	max-height: 160px;
	padding: 6px 4px;
	line-height: 1.45;
}

.send-btn {
	width: 36px;
	height: 36px;
	border-radius: var(--radius-full);
	background: var(--accent-gradient);
	border: none;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: transform var(--transition-fast), opacity var(--transition-fast);
	box-shadow: 0 2px 8px var(--accent-glow);
}

.send-btn:hover:not(:disabled) {
	transform: scale(1.05);
}

.send-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	box-shadow: none;
}

.send-btn.stop {
	background: #ef4444;
}

.stop-square {
	width: 12px;
	height: 12px;
	background: #ffffff;
	border-radius: 2px;
}

.input-disclaimer {
	font-size: 11px;
	color: var(--text-muted);
	margin-top: 8px;
	text-align: center;
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(8px);
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.modal-window {
	width: 100%;
	max-width: 580px;
	background: var(--bg-card);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.modal-header {
	padding: 20px 24px;
	border-bottom: 1px solid var(--border-subtle);
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
}

.modal-title-wrap h3 {
	font-size: 18px;
	font-weight: 700;
	color: var(--text-primary);
}

.modal-title-wrap p {
	font-size: 13px;
	color: var(--text-secondary);
	margin-top: 3px;
}

.modal-close-btn {
	background: none;
	border: none;
	font-size: 24px;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0 4px;
}

.modal-close-btn:hover {
	color: var(--text-primary);
}

.persona-cards-grid {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 480px;
	overflow-y: auto;
}

.persona-card {
	padding: 14px 16px;
	border-radius: var(--radius-lg);
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.persona-card:hover {
	border-color: var(--accent);
	background: var(--bg-card-hover);
}

.persona-card.selected {
	border-color: var(--accent);
	background: rgba(249, 115, 22, 0.08);
}

.pcard-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 6px;
}

.pcard-avatar {
	font-size: 20px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--bg-card);
	border: 2px solid;
}

.pcard-title-group {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pcard-name {
	font-size: 14.5px;
	font-weight: 700;
	color: var(--text-primary);
}

.pcard-active-tag {
	font-size: 10px;
	font-weight: 700;
	background: var(--accent);
	color: #ffffff;
	padding: 2px 6px;
	border-radius: var(--radius-full);
}

.pcard-desc {
	font-size: 13px;
	color: var(--text-secondary);
	line-height: 1.4;
}

/* Settings Modal Body */
.settings-body {
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-height: 480px;
	overflow-y: auto;
}

.setting-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
}

.setting-row.vertical {
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
}

.setting-info {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.setting-info label {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--text-primary);
}

.setting-info span {
	font-size: 12px;
	color: var(--text-muted);
}

.setting-slider-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.slider-val {
	font-family: var(--font-mono);
	font-size: 13px;
	font-weight: 600;
	color: var(--accent);
}

.theme-options-group {
	display: flex;
	gap: 6px;
}

.theme-pill-btn {
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--text-secondary);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.theme-pill-btn.active {
	border-color: var(--accent);
	background: rgba(249, 115, 22, 0.12);
	color: var(--accent);
	font-weight: 600;
}

.settings-slider {
	width: 100%;
	accent-color: var(--accent);
	cursor: pointer;
}

.system-prompt-textarea {
	width: 100%;
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	padding: 10px 12px;
	font-family: inherit;
	font-size: 13px;
	color: var(--text-primary);
	resize: vertical;
	outline: none;
}

.system-prompt-textarea:focus {
	border-color: var(--accent);
}

.modal-footer {
	padding: 16px 24px;
	border-top: 1px solid var(--border-subtle);
	display: flex;
	justify-content: flex-end;
}

.primary-action-btn {
	background: var(--accent-gradient);
	border: none;
	border-radius: var(--radius-md);
	padding: 8px 18px;
	font-size: 13.5px;
	font-weight: 600;
	color: #ffffff;
	cursor: pointer;
}

/* ==========================================================================
   Markdown Elements Styling
   ========================================================================== */
.md-h1, .md-h2, .md-h3, .md-h4 {
	font-weight: 700;
	color: var(--text-primary);
	margin: 18px 0 8px 0;
	line-height: 1.3;
}

.md-h1 { font-size: 20px; }
.md-h2 { font-size: 17px; }
.md-h3 { font-size: 15px; }

.md-paragraph {
	margin-bottom: 12px;
	line-height: 1.6;
}

.md-paragraph:last-child {
	margin-bottom: 0;
}

.md-inline-code {
	font-family: var(--font-mono);
	font-size: 0.88em;
	padding: 2px 6px;
	border-radius: 4px;
	background: var(--bg-input);
	border: 1px solid var(--border-subtle);
	color: #f43f5e;
}

.md-code-card {
	margin: 14px 0;
	border-radius: var(--radius-md);
	background: #0d1117;
	border: 1px solid var(--border-strong);
	overflow: hidden;
}

.md-code-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 7px 14px;
	background: #161b22;
	border-bottom: 1px solid var(--border-subtle);
}

.md-code-lang {
	font-family: var(--font-mono);
	font-size: 11.5px;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--text-muted);
}

.md-copy-btn {
	display: flex;
	align-items: center;
	gap: 5px;
	background: transparent;
	border: none;
	color: var(--text-secondary);
	font-size: 11.5px;
	cursor: pointer;
	padding: 3px 6px;
	border-radius: 4px;
	transition: all var(--transition-fast);
}

.md-copy-btn:hover {
	background: var(--bg-card-hover);
	color: var(--text-primary);
}

.md-code-block {
	padding: 14px 16px;
	overflow-x: auto;
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1.5;
	color: #e6edf3;
}

.md-table-wrap {
	overflow-x: auto;
	margin: 14px 0;
}

.md-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}

.md-table th, .md-table td {
	padding: 9px 12px;
	border: 1px solid var(--border-subtle);
	text-align: left;
}

.md-table th {
	background: var(--bg-input);
	font-weight: 600;
	color: var(--text-primary);
}

.md-blockquote {
	border-left: 3px solid var(--accent);
	padding: 6px 14px;
	margin: 12px 0;
	background: var(--bg-input);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	color: var(--text-secondary);
}

.md-list {
	padding-left: 22px;
	margin: 10px 0;
}

.md-list-item {
	margin-bottom: 6px;
}

/* ==========================================================================
   Responsive Mobile Adjustments
   ========================================================================== */
@media (max-width: 768px) {
	.menu-toggle-btn {
		display: flex;
	}

	.koko-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		transform: translateX(-100%);
		box-shadow: var(--shadow-lg);
	}

	.koko-sidebar.open {
		transform: translateX(0);
	}

	.sidebar-overlay {
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.6);
		backdrop-filter: blur(4px);
		z-index: 18;
	}

	.starters-grid {
		grid-template-columns: 1fr;
	}

	.btn-label {
		display: none;
	}

	.koko-chat-feed {
		padding: 16px 12px 130px 12px;
	}

	.koko-input-dock {
		padding: 10px 12px 14px 12px;
	}
}
