/**
 * DeepSeek Financial Assistant — Frontend Styles
 *
 * Luxury fintech aesthetic. Dark obsidian default with light theme support.
 * Glassmorphism, layered shadows, gold accents, smooth transitions.
 */

/* ---------- Reset & Base ---------- */
.dsfa-app,
.dsfa-app *,
.dsfa-app *::before,
.dsfa-app *::after {
	box-sizing: border-box;
}

.dsfa-app {
	/* Dark theme defaults — deep obsidian luxury */
	--dsfa-bg: #0A0E1A;
	--dsfa-bg-image:
		radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 45%),
		radial-gradient(circle at 85% 88%, rgba(124, 58, 237, 0.22) 0%, rgba(124, 58, 237, 0) 50%),
		radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0) 70%);
	--dsfa-surface: rgba(255, 255, 255, 0.045);
	--dsfa-surface-2: rgba(255, 255, 255, 0.08);
	--dsfa-surface-3: rgba(255, 255, 255, 0.12);
	--dsfa-border: rgba(255, 255, 255, 0.10);
	--dsfa-border-strong: rgba(255, 255, 255, 0.18);
	--dsfa-text: #F8FAFC;
	--dsfa-text-muted: #94A3B8;
	--dsfa-text-faint: #64748B;
	--dsfa-primary: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
	--dsfa-primary-hover: linear-gradient(135deg, #1D4ED8 0%, #6D28D9 100%);
	--dsfa-gold: #FBBF24;
	--dsfa-gold-deep: #F59E0B;
	--dsfa-green: #10B981;
	--dsfa-red: #F43F5E;
	--dsfa-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
	--dsfa-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
	--dsfa-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
	--dsfa-radius-chip: 999px;
	--dsfa-radius-card: 16px;
	--dsfa-radius-container: 24px;
	--dsfa-radius-msg: 18px;
	--dsfa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
	--dsfa-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	--dsfa-font-size: 15px;
	--dsfa-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

	/* Per-category accent gradients */
	--dsfa-cat-healthcare: linear-gradient(135deg, #F43F5E, #EC4899);
	--dsfa-cat-inflation: linear-gradient(135deg, #F59E0B, #F97316);
	--dsfa-cat-housing: linear-gradient(135deg, #10B981, #14B8A6);
	--dsfa-cat-expenses: linear-gradient(135deg, #0EA5E9, #2563EB);
	--dsfa-cat-budget: linear-gradient(135deg, #8B5CF6, #7C3AED);
	--dsfa-cat-invest: linear-gradient(135deg, #D946EF, #EC4899);

	position: relative;
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
	font-family: var(--dsfa-font);
	font-size: var(--dsfa-font-size);
	color: var(--dsfa-text);
	background-color: var(--dsfa-bg);
	background-image: var(--dsfa-bg-image);
	background-attachment: fixed;
	border: 1px solid var(--dsfa-border);
	border-radius: var(--dsfa-radius-container);
	overflow: hidden;
	box-shadow: var(--dsfa-shadow-lg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	line-height: 1.5;
}

.dsfa-app[data-theme="light"] {
	--dsfa-bg: #FAFAF7;
	--dsfa-bg-image:
		radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.10) 0%, rgba(16, 185, 129, 0) 45%),
		radial-gradient(circle at 85% 88%, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0) 50%);
	--dsfa-surface: rgba(255, 255, 255, 0.65);
	--dsfa-surface-2: rgba(255, 255, 255, 0.85);
	--dsfa-surface-3: rgba(255, 255, 255, 0.95);
	--dsfa-border: rgba(15, 23, 42, 0.10);
	--dsfa-border-strong: rgba(15, 23, 42, 0.18);
	--dsfa-text: #0F172A;
	--dsfa-text-muted: #475569;
	--dsfa-text-faint: #94A3B8;
	--dsfa-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.dsfa-app__inner {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

/* ---------- Header ---------- */
.dsfa-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px;
	background: var(--dsfa-surface);
	border-bottom: 1px solid var(--dsfa-border);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	position: relative;
	z-index: 4;
}

.dsfa-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.dsfa-brand__logo {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	font-size: 22px;
	background: linear-gradient(135deg, #2563EB 0%, #7C3AED 50%, #10B981 100%);
	border-radius: 14px;
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
	flex-shrink: 0;
}

.dsfa-brand__text {
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.dsfa-brand__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--dsfa-text);
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dsfa-brand__sub {
	font-size: 12px;
	color: var(--dsfa-text-muted);
	letter-spacing: 0.02em;
}

.dsfa-header__actions {
	display: flex;
	gap: 6px;
}

/* ---------- Buttons ---------- */
.dsfa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 14px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	border: 1px solid transparent;
	border-radius: 12px;
	cursor: pointer;
	transition: all var(--dsfa-transition);
	color: var(--dsfa-text);
	background: transparent;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.dsfa-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45);
}

.dsfa-btn--ghost {
	background: var(--dsfa-surface-2);
	border-color: var(--dsfa-border);
	color: var(--dsfa-text-muted);
	padding: 8px 10px;
	min-height: 38px;
}

.dsfa-btn--ghost:hover {
	background: var(--dsfa-surface-3);
	color: var(--dsfa-text);
	border-color: var(--dsfa-border-strong);
	transform: translateY(-1px);
}

.dsfa-btn--primary {
	background: var(--dsfa-primary);
	color: #fff;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.dsfa-btn--primary:hover {
	background: var(--dsfa-primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 8px 22px rgba(124, 58, 237, 0.45);
}

.dsfa-btn--primary:active {
	transform: translateY(0);
}

/* ---------- Quick Actions ---------- */
.dsfa-quick-actions {
	display: flex;
	gap: 8px;
	padding: 14px 22px 4px;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	position: relative;
	z-index: 3;
}

.dsfa-quick-actions::-webkit-scrollbar {
	display: none;
}

.dsfa-quick-action {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--dsfa-text);
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-radius: var(--dsfa-radius-chip);
	cursor: pointer;
	white-space: nowrap;
	transition: all var(--dsfa-transition);
	position: relative;
	overflow: hidden;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.dsfa-quick-action::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--dsfa-cat-accent, transparent);
	opacity: 0;
	transition: opacity var(--dsfa-transition);
	z-index: -1;
}

.dsfa-quick-action[data-category="healthcare"] { --dsfa-cat-accent: var(--dsfa-cat-healthcare); }
.dsfa-quick-action[data-category="inflation"]  { --dsfa-cat-accent: var(--dsfa-cat-inflation); }
.dsfa-quick-action[data-category="housing"]    { --dsfa-cat-accent: var(--dsfa-cat-housing); }
.dsfa-quick-action[data-category="expenses"]  { --dsfa-cat-accent: var(--dsfa-cat-expenses); }
.dsfa-quick-action[data-category="budget"]     { --dsfa-cat-accent: var(--dsfa-cat-budget); }
.dsfa-quick-action[data-category="invest"]     { --dsfa-cat-accent: var(--dsfa-cat-invest); }

.dsfa-quick-action:hover {
	transform: translateY(-2px);
	border-color: transparent;
	color: #fff;
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.dsfa-quick-action:hover::before {
	opacity: 1;
}

.dsfa-quick-action:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5);
}

.dsfa-quick-action__icon {
	font-size: 15px;
	line-height: 1;
}

/* ---------- Body / Messages ---------- */
.dsfa-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	position: relative;
	display: flex;
	flex-direction: column;
}

.dsfa-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 18px 22px 8px;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: var(--dsfa-surface-3) transparent;
}

.dsfa-messages::-webkit-scrollbar {
	width: 8px;
}

.dsfa-messages::-webkit-scrollbar-track {
	background: transparent;
}

.dsfa-messages::-webkit-scrollbar-thumb {
	background: var(--dsfa-surface-3);
	border-radius: 8px;
}

.dsfa-messages::-webkit-scrollbar-thumb:hover {
	background: var(--dsfa-border-strong);
}

/* Message row */
.dsfa-msg {
	display: flex;
	gap: 10px;
	margin-bottom: 14px;
	align-items: flex-start;
	animation: dsfa-pop-in 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
	max-width: 100%;
}

@keyframes dsfa-pop-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.dsfa-msg__avatar {
	width: 32px;
	height: 32px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	font-size: 16px;
	background: linear-gradient(135deg, #2563EB, #7C3AED);
	box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
	flex-shrink: 0;
}

.dsfa-msg--user .dsfa-msg__avatar {
	background: linear-gradient(135deg, #64748B, #475569);
	box-shadow: 0 4px 10px rgba(100, 116, 139, 0.3);
}

.dsfa-msg__content {
	min-width: 0;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.dsfa-msg__bubble {
	padding: 12px 16px;
	border-radius: var(--dsfa-radius-msg);
	max-width: 100%;
	overflow-wrap: break-word;
	word-break: break-word;
	font-size: var(--dsfa-font-size);
	line-height: 1.55;
}

.dsfa-msg--user {
	flex-direction: row-reverse;
}

.dsfa-msg--user .dsfa-msg__content {
	align-items: flex-end;
}

.dsfa-msg--user .dsfa-msg__bubble {
	background: var(--dsfa-primary);
	color: #fff;
	border-top-right-radius: 6px;
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
}

.dsfa-msg--ai .dsfa-msg__bubble {
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-left: 3px solid var(--dsfa-gold);
	border-top-left-radius: 6px;
	color: var(--dsfa-text);
	box-shadow: var(--dsfa-shadow-sm);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.dsfa-msg--ai.dsfa-msg--error .dsfa-msg__bubble {
	border-left-color: var(--dsfa-red);
	background: rgba(244, 63, 94, 0.10);
}

.dsfa-msg--greeting {
	background: transparent;
}

.dsfa-msg--greeting .dsfa-msg__bubble {
	background: var(--dsfa-surface);
	border-left-color: var(--dsfa-gold);
}

/* Markdown styling inside AI bubbles */
.dsfa-markdown p {
	margin: 0 0 10px;
}
.dsfa-markdown p:last-child {
	margin-bottom: 0;
}
.dsfa-markdown h1,
.dsfa-markdown h2,
.dsfa-markdown h3,
.dsfa-markdown h4 {
	margin: 14px 0 8px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--dsfa-text);
}
.dsfa-markdown h1 { font-size: 1.35em; }
.dsfa-markdown h2 { font-size: 1.2em; }
.dsfa-markdown h3 { font-size: 1.08em; }
.dsfa-markdown ul,
.dsfa-markdown ol {
	margin: 6px 0 10px;
	padding-left: 20px;
}
.dsfa-markdown li {
	margin-bottom: 4px;
}
.dsfa-markdown ul li::marker {
	color: var(--dsfa-gold);
}
.dsfa-markdown strong {
	color: var(--dsfa-gold);
	font-weight: 700;
}
.dsfa-markdown em {
	color: var(--dsfa-text-muted);
}
.dsfa-markdown code {
	font-family: var(--dsfa-mono);
	font-size: 0.88em;
	background: var(--dsfa-surface-3);
	padding: 2px 6px;
	border-radius: 6px;
	border: 1px solid var(--dsfa-border);
}
.dsfa-markdown pre {
	background: rgba(0, 0, 0, 0.25);
	border: 1px solid var(--dsfa-border);
	border-radius: 12px;
	padding: 12px 14px;
	overflow-x: auto;
	margin: 10px 0;
}
.dsfa-markdown pre code {
	background: transparent;
	border: none;
	padding: 0;
	color: #E2E8F0;
}
.dsfa-markdown blockquote {
	margin: 10px 0;
	padding: 8px 14px;
	border-left: 3px solid var(--dsfa-gold);
	background: var(--dsfa-surface);
	border-radius: 0 8px 8px 0;
	color: var(--dsfa-text-muted);
}
.dsfa-markdown a {
	color: #60A5FA;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.dsfa-markdown hr {
	border: none;
	height: 1px;
	background: var(--dsfa-border);
	margin: 14px 0;
}

/* ---------- Message action row ---------- */
.dsfa-msg__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding: 0 4px;
	flex-wrap: wrap;
}

.dsfa-msg__rating {
	display: inline-flex;
	gap: 1px;
	padding: 2px 4px;
	background: var(--dsfa-surface);
	border-radius: 999px;
	border: 1px solid var(--dsfa-border);
}

.dsfa-star-btn {
	width: 26px;
	height: 26px;
	display: grid;
	place-items: center;
	font-size: 14px;
	color: var(--dsfa-text-faint);
	background: transparent;
	border: none;
	cursor: pointer;
	transition: color var(--dsfa-transition), transform var(--dsfa-transition);
	padding: 0;
}

.dsfa-star-btn:hover {
	color: var(--dsfa-gold);
	transform: scale(1.15);
}

.dsfa-star-btn.is-active {
	color: var(--dsfa-gold);
	text-shadow: 0 0 8px rgba(251, 191, 36, 0.55);
}

.dsfa-action-btn {
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	background: var(--dsfa-surface);
	border: 1px solid var(--dsfa-border);
	border-radius: 999px;
	color: var(--dsfa-text-muted);
	cursor: pointer;
	transition: all var(--dsfa-transition);
	padding: 0;
}

.dsfa-action-btn:hover {
	background: var(--dsfa-surface-3);
	color: var(--dsfa-text);
	transform: translateY(-1px);
}

.dsfa-action-btn.is-active {
	color: var(--dsfa-gold);
	background: rgba(251, 191, 36, 0.12);
	border-color: rgba(251, 191, 36, 0.35);
}

.dsfa-action-btn[data-action="copy"].is-copied {
	color: var(--dsfa-green);
	background: rgba(16, 185, 129, 0.12);
	border-color: rgba(16, 185, 129, 0.35);
}

/* ---------- Typing indicator ---------- */
.dsfa-typing {
	display: flex;
	gap: 10px;
	margin-bottom: 14px;
	align-items: center;
	animation: dsfa-pop-in 0.32s ease;
}

.dsfa-typing .dsfa-msg__avatar {
	background: linear-gradient(135deg, #2563EB, #7C3AED);
}

.dsfa-typing__dots {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	padding: 12px 16px;
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-left: 3px solid var(--dsfa-gold);
	border-radius: var(--dsfa-radius-msg);
	border-top-left-radius: 6px;
}

.dsfa-typing__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--dsfa-text-muted);
	display: inline-block;
	animation: dsfa-bounce 1.3s infinite ease-in-out both;
}

.dsfa-typing__dot:nth-child(1) { animation-delay: -0.32s; }
.dsfa-typing__dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes dsfa-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.5;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

/* ---------- Input bar ---------- */
.dsfa-input-bar {
	flex-shrink: 0;
	padding: 10px 22px 16px;
	background: var(--dsfa-surface);
	border-top: 1px solid var(--dsfa-border);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	position: relative;
	z-index: 4;
}

.dsfa-input-bar__row {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-radius: 16px;
	padding: 8px 8px 8px 14px;
	transition: border-color var(--dsfa-transition), box-shadow var(--dsfa-transition);
}

.dsfa-input-bar__row:focus-within {
	border-color: rgba(251, 191, 36, 0.5);
	box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
}

.dsfa-input {
	flex: 1 1 auto;
	resize: none;
	border: none;
	outline: none;
	background: transparent;
	color: var(--dsfa-text);
	font-family: inherit;
	font-size: var(--dsfa-font-size);
	line-height: 1.5;
	padding: 8px 0;
	max-height: 140px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--dsfa-surface-3) transparent;
}

.dsfa-input::placeholder {
	color: var(--dsfa-text-faint);
}

.dsfa-input::-webkit-scrollbar {
	width: 6px;
}
.dsfa-input::-webkit-scrollbar-thumb {
	background: var(--dsfa-surface-3);
	border-radius: 6px;
}

.dsfa-send {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border: none;
	border-radius: 12px;
	background: var(--dsfa-primary);
	color: #fff;
	cursor: pointer;
	transition: all var(--dsfa-transition);
	flex-shrink: 0;
	position: relative;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.dsfa-send:hover {
	background: var(--dsfa-primary-hover);
	transform: translateY(-1px) scale(1.03);
	box-shadow: 0 8px 22px rgba(124, 58, 237, 0.5);
}

.dsfa-send:active {
	transform: translateY(0) scale(0.98);
}

.dsfa-send:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.dsfa-send:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5), 0 4px 14px rgba(37, 99, 235, 0.35);
}

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

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

.dsfa-input-bar__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 8px;
	padding: 0 4px;
	font-size: 11px;
	color: var(--dsfa-text-faint);
}

.dsfa-input-hint {
	letter-spacing: 0.02em;
}

/* ---------- Export dropdown ---------- */
.dsfa-export {
	position: relative;
}

.dsfa-export__trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	min-height: 28px;
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-radius: 999px;
	color: var(--dsfa-text-muted);
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--dsfa-transition);
}

.dsfa-export__trigger:hover {
	background: var(--dsfa-surface-3);
	color: var(--dsfa-text);
}

.dsfa-export__menu {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 0;
	min-width: 180px;
	background: var(--dsfa-surface-3);
	border: 1px solid var(--dsfa-border-strong);
	border-radius: 12px;
	padding: 6px;
	box-shadow: var(--dsfa-shadow-md);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	z-index: 10;
	animation: dsfa-pop-in 0.18s ease;
}

.dsfa-export__menu button {
	display: flex;
	width: 100%;
	text-align: left;
	padding: 8px 12px;
	background: transparent;
	border: none;
	color: var(--dsfa-text);
	font-family: inherit;
	font-size: 13px;
	border-radius: 8px;
	cursor: pointer;
	transition: background var(--dsfa-transition);
}

.dsfa-export__menu button:hover {
	background: var(--dsfa-surface-2);
}

/* ---------- History drawer ---------- */
.dsfa-history {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 280px;
	max-width: 85%;
	background: var(--dsfa-surface);
	backdrop-filter: blur(28px);
	-webkit-backdrop-filter: blur(28px);
	border-left: 1px solid var(--dsfa-border);
	box-shadow: -10px 0 40px rgba(0, 0, 0, 0.35);
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 20;
	display: flex;
	flex-direction: column;
	padding: 18px 14px;
}

.dsfa-history.is-open {
	transform: translateX(0);
}

.dsfa-history__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.dsfa-history__head h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--dsfa-text);
}

.dsfa-history-close {
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	background: var(--dsfa-surface-2);
	border: 1px solid var(--dsfa-border);
	border-radius: 8px;
	color: var(--dsfa-text-muted);
	cursor: pointer;
}

.dsfa-history__list {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--dsfa-surface-3) transparent;
}

.dsfa-history__list::-webkit-scrollbar {
	width: 6px;
}
.dsfa-history__list::-webkit-scrollbar-thumb {
	background: var(--dsfa-surface-3);
	border-radius: 6px;
}

.dsfa-history-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 12px;
	margin-bottom: 4px;
	background: var(--dsfa-surface-2);
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	transition: all var(--dsfa-transition);
}

.dsfa-history-item:hover {
	background: var(--dsfa-surface-3);
	border-color: var(--dsfa-border);
}

.dsfa-history-item.is-active {
	background: var(--dsfa-surface-3);
	border-color: rgba(251, 191, 36, 0.4);
}

.dsfa-history-item__title {
	font-size: 13px;
	color: var(--dsfa-text);
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	flex: 1 1 auto;
}

.dsfa-history-item__time {
	font-size: 10px;
	color: var(--dsfa-text-faint);
	white-space: nowrap;
}

.dsfa-history-item__del {
	width: 24px;
	height: 24px;
	display: grid;
	place-items: center;
	background: transparent;
	border: none;
	color: var(--dsfa-text-faint);
	cursor: pointer;
	border-radius: 6px;
	opacity: 0;
	transition: all var(--dsfa-transition);
}

.dsfa-history-item:hover .dsfa-history-item__del {
	opacity: 1;
}

.dsfa-history-item__del:hover {
	background: rgba(244, 63, 94, 0.15);
	color: var(--dsfa-red);
}

.dsfa-history__empty {
	text-align: center;
	color: var(--dsfa-text-faint);
	font-size: 13px;
	padding: 24px 8px;
}

.dsfa-history__new {
	margin-top: 12px;
	width: 100%;
}

/* ---------- Toast ---------- */
.dsfa-toast {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translate(-50%, 20px);
	background: var(--dsfa-surface-3);
	border: 1px solid var(--dsfa-border-strong);
	color: var(--dsfa-text);
	padding: 10px 18px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	box-shadow: var(--dsfa-shadow-md);
	z-index: 30;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	pointer-events: none;
}

.dsfa-toast.is-show {
	opacity: 1;
	transform: translate(-50%, 0);
}

.dsfa-toast--error {
	background: rgba(244, 63, 94, 0.95);
	color: #fff;
	border-color: rgba(244, 63, 94, 0.6);
}

.dsfa-toast--success {
	background: rgba(16, 185, 129, 0.95);
	color: #fff;
	border-color: rgba(16, 185, 129, 0.6);
}

/* ---------- Full height ---------- */
.dsfa-app[style*="height:100vh"],
.dsfa-app[style*="height: 100vh"] {
	max-width: 100%;
	border-radius: 0;
	border: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.dsfa-app {
		border-radius: 0;
		border-left: none;
		border-right: none;
		font-size: 14px;
	}

	.dsfa-header {
		padding: 14px 16px;
	}

	.dsfa-quick-actions {
		padding: 12px 16px 0;
	}

	.dsfa-messages {
		padding: 14px 16px 6px;
	}

	.dsfa-input-bar {
		padding: 10px 16px 14px;
	}

	.dsfa-brand__title {
		font-size: 15px;
	}

	.dsfa-brand__logo {
		width: 38px;
		height: 38px;
		font-size: 19px;
	}

	.dsfa-input-bar__footer {
		flex-direction: column-reverse;
		align-items: flex-start;
		gap: 6px;
	}

	.dsfa-input-hint {
		display: none;
	}
}

/* ---------- Print ---------- */
@media print {
	.dsfa-app {
		box-shadow: none;
		border: none;
	}
	.dsfa-input-bar,
	.dsfa-header__actions,
	.dsfa-quick-actions {
		display: none;
	}
}
