:root {
	color-scheme: light;
	--bg: #f1f5f9;
	--panel: #ffffff;
	--panel-hover: #f8fafc;
	--panel-active: #f1f5f9;
	--border: #e2e8f0;
	--border-light: #cbd5e1;
	--text: #0f172a;
	--text-secondary: #334155;
	--muted: #64748b;
	--primary: #10b981;
	--primary-hover: #059669;
	--accent: #10b981;
	--accent-hover: #059669;
	--accent-glow: rgba(16, 185, 129, 0.15);
	--success: #10b981;
	--warning: #d97706;
	--danger: #ef4444;
	--purple: #8b5cf6;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	height: 100vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* ---------- Top Bar & Brand ---------- */
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1.5rem;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.brand-logo {
	font-size: 1.3rem;
}

.topbar h1 {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0;
	color: #0f172a;
	letter-spacing: -0.01em;
}

.topbar-right {
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

.org-picker {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.org-picker label {
	color: var(--muted);
	font-size: 0.85rem;
	font-weight: 500;
}

.user-profile-wrap {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding-left: 0.75rem;
	border-left: 1px solid var(--border);
}

.user-badge {
	font-size: 0.82rem;
	color: #334155;
	font-weight: 600;
	background: #f8fafc;
	padding: 0.25rem 0.6rem;
	border-radius: 6px;
	border: 1px solid var(--border);
}

/* ---------- Forms & Inputs ---------- */
select,
input,
textarea {
	background: #ffffff;
	color: var(--text);
	border: 1px solid var(--border-light);
	border-radius: 7px;
	padding: 0.45rem 0.65rem;
	font-size: 0.85rem;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus,
input:focus,
textarea:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.btn {
	border: none;
	border-radius: 7px;
	padding: 0.45rem 0.85rem;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.btn-sm {
	padding: 0.3rem 0.6rem;
	font-size: 0.8rem;
}

.btn-xs {
	font-size: 0.72rem;
	padding: 0.2rem 0.55rem;
	border-radius: 5px;
}

.btn.primary {
	background: var(--primary);
	color: white;
}

.btn.primary:hover {
	background: var(--primary-hover);
}

.btn.secondary {
	background: #ffffff;
	color: #334155;
	border: 1px solid var(--border-light);
}

.btn.secondary:hover {
	background: #f8fafc;
	border-color: #94a3b8;
}

.btn.danger {
	background: #fee2e2;
	color: #dc2626;
	border: 1px solid #fca5a5;
}

.btn.danger:hover {
	background: #fecaca;
}

.btn-icon {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	padding: 0.2rem;
	font-size: 0.8rem;
}

.btn-icon:hover {
	color: var(--text);
}

/* ---------- Tabs Bar ---------- */
.tabs {
	display: flex;
	gap: 0.5rem;
	padding: 0 1.5rem;
	background: var(--panel);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.tab-btn {
	background: none;
	border: none;
	color: var(--muted);
	padding: 0.75rem 0.9rem;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	font-size: 0.88rem;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
	color: #0f172a;
}

.tab-btn.active {
	color: var(--primary);
	border-bottom-color: var(--primary);
}

.badge-count {
	display: inline-block;
	min-width: 1.15rem;
	padding: 0.05rem 0.4rem;
	border-radius: 999px;
	background: var(--danger);
	color: white;
	font-size: 0.72rem;
	font-weight: 700;
	text-align: center;
}

/* ---------- Main Layout ---------- */
.main-content {
	flex: 1;
	padding: 1rem 1.5rem;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.tab-panel {
	display: none !important;
	height: 100%;
}

.tab-panel.active {
	display: flex !important;
	flex-direction: column;
}

/* ---------- 2-PANE INBOX LAYOUT ---------- */
.inbox-layout {
	display: flex;
	flex: 1;
	height: 100%;
	min-height: 0;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Sidebar (Conversation List) */
.inbox-sidebar {
	width: 360px;
	min-width: 320px;
	max-width: 400px;
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	background: #ffffff;
	height: 100%;
	min-height: 0;
	overflow: hidden;
}

.sidebar-header {
	padding: 0.75rem 0.85rem;
	border-bottom: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	background: #ffffff;
	flex-shrink: 0;
}

.search-box {
	position: relative;
	display: flex;
	align-items: center;
}

.search-icon {
	position: absolute;
	left: 0.65rem;
	font-size: 0.8rem;
	color: var(--muted);
	pointer-events: none;
}

.search-box input {
	width: 100%;
	height: 36px;
	padding-left: 2rem;
	padding-right: 1.8rem;
	background: #f1f5f9;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 0.84rem;
	color: #0f172a;
	transition: all 0.15s ease;
}

.search-box input:focus {
	background: #ffffff;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.search-box .btn-icon {
	position: absolute;
	right: 0.4rem;
}

.filter-controls {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.filter-select {
	flex: 1;
	min-width: 0;
	height: 32px;
	font-size: 0.76rem;
	padding: 0.2rem 0.45rem;
	border-radius: 6px;
	background: #ffffff;
	border: 1px solid var(--border);
	color: #334155;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#refresh-conversations {
	height: 32px;
	padding: 0 0.55rem;
	font-size: 0.82rem;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.sidebar-stats {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.75rem;
	color: var(--muted);
	padding: 0 0.1rem;
}

.btn-link {
	background: none;
	border: none;
	color: var(--primary);
	cursor: pointer;
	padding: 0;
	font-size: 0.75rem;
	font-weight: 500;
}

.btn-link:hover {
	text-decoration: underline;
}

.conversation-list,
.conv-list {
	flex: 1;
	min-height: 0;
	height: 100%;
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 0;
}

.conv-empty {
	padding: 2.5rem 1rem;
	text-align: center;
	color: var(--muted);
	font-size: 0.85rem;
}

/* Modern Conversation Item */
.conv-item {
	display: flex;
	gap: 0.75rem;
	padding: 0.75rem 0.85rem;
	border-bottom: 1px solid #f8fafc;
	cursor: pointer;
	transition: all 0.15s ease;
	position: relative;
	background: #ffffff;
	border-left: 3px solid transparent;
}

.conv-item:hover {
	background: #f8fafc;
}

.conv-item.active {
	background: #f0fdf4;
	border-left-color: var(--primary);
}

.conv-item.needs-attention {
	border-left-color: #ef4444;
	background: #fff8f8;
}

.conv-item.needs-attention.active {
	background: #fee2e2;
	border-left-color: #dc2626;
}

.conv-avatar-wrap {
	position: relative;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
}

.conv-avatar {
	width: 100%;
	height: 100%;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.9rem;
	font-weight: 700;
	color: white;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.conv-status-dot {
	position: absolute;
	bottom: -2px;
	right: -2px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	border: 2px solid #ffffff;
}

.conv-status-dot.bot {
	background: #10b981;
}

.conv-status-dot.alert {
	background: #ef4444;
	box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
	animation: dotPulse 1.5s infinite ease-in-out;
}

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

.conv-status-dot.paused {
	background: #94a3b8;
}

.conv-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.conv-top-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.35rem;
}

.conv-name {
	font-weight: 700;
	font-size: 0.88rem;
	color: #0f172a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.conv-time {
	font-size: 0.7rem;
	color: #94a3b8;
	white-space: nowrap;
	font-weight: 500;
}

.conv-snippet {
	font-size: 0.78rem;
	color: #64748b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.35;
	margin: 0.05rem 0;
}

.conv-snippet.has-alert {
	color: #dc2626;
	font-weight: 600;
}

.conv-tags-row {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	flex-wrap: wrap;
	margin-top: 0.1rem;
}

.badge-channel {
	font-size: 0.65rem;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	background: #f1f5f9;
	color: #475569;
	border: 1px solid #e2e8f0;
	font-weight: 500;
}

.badge-status {
	font-size: 0.7rem;
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	font-weight: 600;
}

.badge-status.BOT_HANDLING {
	background: #dcfce7;
	color: #15803d;
}

.badge-status.NEEDS_HUMAN {
	background: #fee2e2;
	color: #dc2626;
}

.badge-status.PAUSED {
	background: #f1f5f9;
	color: var(--muted);
}

.badge-suggestion {
	font-size: 0.7rem;
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	background: #fef3c7;
	color: #b45309;
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	font-weight: 600;
}

.conv-snippet {
	font-size: 0.78rem;
	color: #64748b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin: 0;
}

.conv-alert-reason {
	font-size: 0.72rem;
	color: #dc2626;
	font-weight: 600;
	margin-top: 0.15rem;
}

/* Chat Main View */
.inbox-chat-view {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: #f8fafc;
	min-width: 0;
	position: relative;
}

.chat-placeholder {
	margin: auto;
	text-align: center;
	max-width: 320px;
	color: var(--muted);
	padding: 2rem;
}

.placeholder-icon {
	font-size: 3rem;
	margin-bottom: 0.8rem;
	opacity: 0.6;
}

.chat-placeholder h3 {
	margin: 0 0 0.5rem;
	color: var(--text);
	font-size: 1.1rem;
}

.chat-placeholder p {
	font-size: 0.85rem;
	line-height: 1.4;
	margin: 0;
}

.chat-container {
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Chat Header */
.chat-header {
	padding: 0.75rem 1.25rem;
	background: #ffffff;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.chat-user-info {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.chat-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	font-weight: 700;
	color: white;
}

.chat-meta {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.chat-name-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.chat-name-row h3 {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
}

.chat-submeta {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.75rem;
	color: var(--muted);
}

.chat-header-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.status-dropdown-wrap {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.status-label {
	font-size: 0.8rem;
	color: var(--muted);
	font-weight: 500;
}

.status-select {
	font-size: 0.82rem;
	padding: 0.35rem 0.6rem;
	background: #ffffff;
}

/* Alert Banner */
.alert-banner {
	background: #fef2f2;
	border-bottom: 1px solid #fecaca;
	padding: 0.6rem 1.25rem;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-shrink: 0;
}

.alert-banner .alert-icon {
	font-size: 1.1rem;
}

.alert-banner .alert-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	font-size: 0.82rem;
}

.alert-banner .alert-content strong {
	color: #dc2626;
}

.alert-banner .alert-content span {
	color: #991b1b;
	font-size: 0.75rem;
}

/* Messages Stream */
/* Messages Stream (Pancake Style) */
.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem 1.5rem;
	display: flex;
	flex-direction: column;
	background: #edeef0;
}

/* Date Separator Pill */
.chat-date-separator {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0.75rem 0;
}

.chat-date-separator span {
	background: rgba(0, 0, 0, 0.08);
	color: #4b5563;
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.15rem 0.65rem;
	border-radius: 12px;
}

/* Pancake Row */
.pancake-row {
	display: flex;
	gap: 0.5rem;
	width: 100%;
	margin-bottom: 3px;
	animation: bubblePop 0.12s ease-out;
}

.pancake-row.first {
	margin-top: 6px;
}

.pancake-row.customer {
	justify-content: flex-start;
	align-items: flex-end;
}

.pancake-row.shop {
	justify-content: flex-end;
	align-items: flex-end;
}

.pancake-avatar-col {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pancake-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.72rem;
	font-weight: 700;
	color: white;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.pancake-avatar-spacer {
	width: 28px;
	height: 28px;
}

.pancake-bubble-wrap {
	display: flex;
	flex-direction: column;
	width: fit-content;
	max-width: min(520px, 80%);
}

.pancake-bubble-wrap.customer {
	align-items: flex-start;
}

.pancake-bubble-wrap.shop {
	align-items: flex-end;
}

/* Pancake Bubbles (Ultra-compact & hug content) */
.pancake-bubble {
	padding: 5px 9px;
	font-size: 0.83rem;
	line-height: 1.35;
	word-break: break-word;
	white-space: pre-line;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
	width: fit-content;
	max-width: 100%;
	text-align: left;
	margin: 0;
}

.pancake-bubble.customer {
	background: #ffffff;
	color: #0f172a;
	border-radius: 10px 10px 10px 3px;
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.pancake-bubble.shop {
	background: #dcf8c6;
	color: #0f172a;
	border-radius: 10px 10px 3px 10px;
	border: 1px solid #c7ebb0;
}

.pancake-bubble.shop.agent {
	background: #cbf0be;
}

.pancake-meta {
	font-size: 0.68rem;
	color: #9ca3af;
	margin-top: 0.15rem;
	padding: 0 0.2rem;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.pancake-meta.customer {
	color: #6b7280;
}

.pancake-author {
	font-weight: 600;
	color: #0284c7;
}

.pancake-meta.shop {
	justify-content: flex-end;
}

.pancake-check {
	color: #10b981;
	font-weight: 700;
	font-size: 0.75rem;
}

.chat-img-preview-wrap {
	display: block;
	margin-top: 0.35rem;
	border-radius: 6px;
	overflow: hidden;
}

.chat-attachment-img {
	max-width: 220px;
	max-height: 180px;
	border-radius: 6px;
	display: block;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.chat-attachment-img:hover {
	transform: scale(1.03);
}

.chat-img-preview-wrap:hover .chat-attachment-img {
	transform: scale(1.03);
}

.chat-img-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.4);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.72rem;
	font-weight: 600;
	opacity: 0;
	transition: opacity 0.15s ease;
	border-radius: 8px;
}

.chat-img-preview-wrap:hover .chat-img-overlay {
	opacity: 1;
}

.chat-bubble-meta {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.7rem;
	color: var(--muted);
	margin-top: 0.25rem;
	padding: 0 0.25rem;
}

.chat-bubble-wrap.shop .chat-bubble-meta {
	justify-content: flex-end;
}

.sender-badge {
	font-weight: 700;
	font-size: 0.68rem;
	padding: 0.05rem 0.35rem;
	border-radius: 4px;
}

.sender-badge.bot {
	background: #e0f2fe;
	color: #0284c7;
	border: 1px solid #bae6fd;
}

.sender-badge.agent {
	background: #dcfce7;
	color: #15803d;
	border: 1px solid #bbf7d0;
}

/* AI Suggestion Box (Modern Copilot Card) */
.ai-suggestion-box {
	margin: 0 1.25rem 0.75rem;
	background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
	border: 1.5px solid #86efac;
	border-radius: 12px;
	padding: 0.85rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	box-shadow: 0 8px 20px rgba(16, 185, 129, 0.1);
	flex-shrink: 0;
	animation: slideUpFade 0.2s ease-out;
}

@keyframes slideUpFade {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

.ai-title {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.84rem;
	color: #15803d;
	font-weight: 700;
}

.ai-tip {
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: normal;
}

.ai-shortcut-hint {
	font-size: 0.7rem;
	color: #15803d;
	background: #dcfce7;
	padding: 0.15rem 0.5rem;
	border-radius: 6px;
	border: 1px solid #bbf7d0;
	font-weight: 600;
}

.ai-suggestion-box textarea {
	width: 100%;
	font-size: 0.86rem;
	line-height: 1.45;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	color: #0f172a;
	padding: 0.6rem 0.75rem;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-suggestion-box textarea:focus {
	border-color: #10b981;
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ai-suggestion-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.5rem;
	flex-wrap: wrap;
}

/* Direct Composer Wrap */
.chat-composer-wrap {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border-top: 1px solid var(--border);
	flex-shrink: 0;
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.composer-toolbar {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1.25rem 0;
}

.chat-composer {
	padding: 0.6rem 1.25rem 0.85rem;
	background: #ffffff;
	display: flex;
	gap: 0.6rem;
	align-items: flex-end;
}

.chat-composer textarea {
	flex: 1;
	resize: none;
	font-size: 0.88rem;
	line-height: 1.4;
	background: #f8fafc;
	border: 1px solid var(--border);
	border-radius: 9px;
	padding: 0.6rem 0.85rem;
	outline: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.chat-composer textarea:focus {
	background: #ffffff;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.chat-composer button {
	height: 40px;
	padding: 0 1.25rem;
	font-weight: 700;
	border-radius: 8px;
}

/* ---------- Panels & Tables ---------- */
.panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
}

.panel-header h2 {
	margin: 0;
	font-size: 1.1rem;
	color: #0f172a;
	font-weight: 700;
}

.inline-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.6rem;
	margin-bottom: 1rem;
	padding: 1rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 9px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.inline-form textarea {
	min-height: 4rem;
	resize: vertical;
	grid-column: 1 / -1;
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 9px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.data-table th,
.data-table td {
	text-align: left;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}

.data-table th {
	color: #475569;
	font-weight: 700;
	text-transform: uppercase;
	font-size: 0.74rem;
	background: #f8fafc;
}

.data-table tr:hover td {
	background: #f8fafc;
}

.empty-row td {
	color: var(--muted);
	text-align: center;
	padding: 2rem;
}

/* ==========================================================================
   SETTINGS TAB STYLES
   ========================================================================== */
#tab-settings {
	padding: 1.5rem 2rem 3rem;
	overflow-y: auto;
	max-width: 1200px;
	margin: 0 auto;
	width: 100%;
}

.settings-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
	gap: 1.5rem;
	margin-top: 1.25rem;
}

.settings-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-top-header {
	display: flex;
	align-items: flex-start;
	gap: 0.85rem;
	border-bottom: 1px solid var(--border);
	padding-bottom: 1rem;
}

.card-top-header .card-icon {
	font-size: 1.75rem;
	line-height: 1;
}

.card-top-header h3 {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--text);
}

.card-subdesc {
	margin: 0.25rem 0 0;
	font-size: 0.8rem;
	color: var(--muted);
}

.setting-group {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.setting-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: #334155;
}

.setting-hint {
	font-size: 0.75rem;
	color: var(--muted);
	line-height: 1.4;
}

.input-field,
.select-field {
	background: #ffffff;
	border: 1px solid var(--border-light);
	border-radius: 7px;
	padding: 0.6rem 0.85rem;
	color: var(--text);
	font-size: 0.85rem;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-field:focus,
.select-field:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.input-inline {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.input-unit {
	font-size: 0.85rem;
	color: var(--muted);
}

/* Radio Cards */
.radio-cards {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.radio-card {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	border-radius: 9px;
	border: 1px solid var(--border);
	background: #f8fafc;
	cursor: pointer;
	transition: all 0.15s ease;
}

.radio-card:hover {
	background: #f1f5f9;
	border-color: #cbd5e1;
}

.radio-card input[type="radio"] {
	margin-top: 0.25rem;
	accent-color: var(--primary);
	cursor: pointer;
}

.radio-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	flex: 1;
}

.radio-card-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.88rem;
	color: var(--text);
}

.radio-card-body p {
	margin: 0;
	font-size: 0.78rem;
	color: var(--muted);
	line-height: 1.35;
}

.badge-recommended {
	font-size: 0.68rem;
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	background: #dcfce7;
	color: #15803d;
	font-weight: 700;
	text-transform: uppercase;
}

/* Switch Toggle */
.switch-row {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem 0;
}

.switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
}

.switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #cbd5e1;
	transition: 0.2s;
	border-radius: 24px;
}

.slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: 0.2s;
	border-radius: 50%;
}

input:checked + .slider {
	background-color: var(--primary);
}

input:checked + .slider:before {
	transform: translateX(20px);
}

/* Checkboxes */
.checkboxes-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	background: #f8fafc;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	border: 1px solid var(--border);
}

.checkbox-item {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 0.8rem;
	color: #334155;
	cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
	accent-color: var(--primary);
	cursor: pointer;
}

.test-action-wrap {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	flex-wrap: wrap;
	margin-top: 0.25rem;
}

.test-status-text {
	font-size: 0.8rem;
	font-weight: 600;
}

.test-status-text.success {
	color: #15803d;
}

.test-status-text.error {
	color: #dc2626;
}

/* ==========================================================================
   ORDER SUMMARY PANEL (INBOX 3RD PANE)
   ========================================================================== */
.order-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #94a3b8;
	margin-left: 4px;
}

.order-dot.ready {
	background: #10b981;
	box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.order-dot.collecting {
	background: #f59e0b;
	box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.inbox-order-panel {
	width: 350px;
	min-width: 350px;
	max-width: 380px;
	background: #ffffff;
	border-left: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	height: 100%;
	z-index: 10;
	box-shadow: -2px 0 6px rgba(0, 0, 0, 0.02);
}

.order-panel-header {
	padding: 0.85rem 1rem;
	background: #f8fafc;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.order-header-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.92rem;
	color: var(--text);
	font-weight: 700;
}

.order-header-actions {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.order-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.order-status-badge-wrap {
	display: flex;
}

.badge-order-status {
	font-size: 0.75rem;
	font-weight: 700;
	padding: 0.3rem 0.75rem;
	border-radius: 20px;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.badge-order-status.ready {
	background: #dcfce7;
	color: #15803d;
	border: 1px solid #86efac;
}

.badge-order-status.collecting {
	background: #fef3c7;
	color: #b45309;
	border: 1px solid #fde68a;
}

.badge-order-status.confirmed {
	background: #dbeafe;
	color: #1d4ed8;
	border: 1px solid #93c5fd;
}

.order-missing-alert {
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 7px;
	padding: 0.6rem 0.8rem;
	font-size: 0.75rem;
	color: #dc2626;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.order-section {
	background: #f8fafc;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

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

.order-section-title {
	margin: 0;
	font-size: 0.8rem;
	color: #475569;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 700;
}

.order-form-row {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.order-form-row label {
	font-size: 0.74rem;
	color: var(--muted);
	font-weight: 600;
}

.order-items-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.order-item-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.5rem 0.65rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	position: relative;
}

.order-item-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--text);
}

.order-item-tags {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex-wrap: wrap;
}

.item-tag {
	font-size: 0.7rem;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	background: #f1f5f9;
	color: #334155;
}

.item-tag.size {
	background: #e0f2fe;
	color: #0369a1;
	font-weight: 600;
}

.order-item-price-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.75rem;
	color: var(--muted);
	border-top: 1px dashed #e2e8f0;
	padding-top: 0.3rem;
	margin-top: 0.1rem;
}

.order-item-remove-btn {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	font-size: 0.8rem;
	padding: 0 0.2rem;
}

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

.order-summary-box {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 7px;
	padding: 0.65rem 0.8rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.summary-line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.78rem;
	color: #334155;
}

.summary-line.highlight-deposit {
	color: #b45309;
	font-size: 0.82rem;
	font-weight: 700;
	border-top: 1px solid #f1f5f9;
	border-bottom: 1px solid #f1f5f9;
	padding: 0.35rem 0;
	margin: 0.15rem 0;
}

.order-actions-wrap {
	margin-top: 0.5rem;
}

/* ==========================================================================
   WEBHOOK HELPER BANNER (CHANNELS TAB)
   ========================================================================== */
.webhook-info-box {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	border-radius: 9px;
	padding: 1rem 1.25rem;
	margin-bottom: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.webhook-info-header {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.88rem;
	color: #1d4ed8;
	font-weight: 700;
}

.webhook-url-wrap {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.webhook-url-wrap code {
	background: #ffffff;
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	font-family: monospace;
	font-size: 0.82rem;
	color: #0284c7;
	border: 1px solid #cbd5e1;
	font-weight: 600;
}

/* ==========================================================================
   ANALYTICS & KPI DASHBOARD
   ========================================================================== */
#tab-analytics {
	padding: 1.5rem 2rem 3rem;
	overflow-y: auto;
	max-width: 1200px;
	margin: 0 auto;
	width: 100%;
}

.kpi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
	margin-top: 1.25rem;
}

.kpi-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	position: relative;
	overflow: hidden;
}

.kpi-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.kpi-title {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.05em;
}

.kpi-icon {
	font-size: 1.3rem;
}

.kpi-main {
	display: flex;
	align-items: baseline;
	gap: 0.6rem;
	margin: 0.2rem 0;
}

.kpi-value {
	font-size: 1.8rem;
	font-weight: 700;
	color: #0f172a;
	line-height: 1;
}

.kpi-subtext {
	font-size: 0.76rem;
	color: var(--muted);
}

.badge-kpi {
	font-size: 0.65rem;
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	font-weight: 700;
	text-transform: uppercase;
}

.badge-kpi.success {
	background: #dcfce7;
	color: #15803d;
}

.text-emerald { color: #059669 !important; }
.text-amber { color: #d97706 !important; }
.text-sky { color: #0284c7 !important; }

/* Analytics Breakdown Grid */
.analytics-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
	gap: 1.5rem;
	margin-top: 1.5rem;
}

.analytics-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Stat Bars */
.stat-bars-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.stat-bar-item {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.stat-bar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.8rem;
	color: #334155;
	font-weight: 500;
}

.stat-bar-track {
	width: 100%;
	height: 7px;
	background: #f1f5f9;
	border-radius: 4px;
	overflow: hidden;
}

.stat-bar-fill {
	height: 100%;
	background: var(--primary);
	border-radius: 4px;
	transition: width 0.3s ease;
}

.stat-bar-fill.red { background: #ef4444; }
.stat-bar-fill.amber { background: #f59e0b; }
.stat-bar-fill.blue { background: #3b82f6; }
.stat-bar-fill.purple { background: #8b5cf6; }

/* Status Summary Grid */
.status-summary-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
	margin-top: 0.5rem;
}

.status-summary-item {
	background: #f8fafc;
	border: 1px solid var(--border);
	border-radius: 9px;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	text-align: center;
}

.status-summary-val {
	font-size: 1.6rem;
	font-weight: 700;
}

.status-summary-lbl {
	font-size: 0.75rem;
	color: var(--muted);
	font-weight: 500;
}

.status-summary-item.green .status-summary-val { color: #15803d; }
.status-summary-item.red .status-summary-val { color: #dc2626; }
.status-summary-item.gray .status-summary-val { color: #64748b; }

/* ==========================================================================
   USER PROFILE & LOGIN MODAL
   ========================================================================== */
.login-modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(6px);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.login-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 16px;
	width: 100%;
	max-width: 400px;
	padding: 2.25rem 2rem;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.1);
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.login-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.35rem;
}

.login-brand-logo {
	font-size: 2.5rem;
	line-height: 1;
	margin-bottom: 0.25rem;
}

.login-header h2 {
	margin: 0;
	font-size: 1.25rem;
	color: #0f172a;
	font-weight: 700;
}

.login-subtext {
	margin: 0;
	font-size: 0.82rem;
	color: var(--muted);
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.login-error {
	background: #fee2e2;
	border: 1px solid #fca5a5;
	color: #dc2626;
	padding: 0.6rem 0.8rem;
	border-radius: 7px;
	font-size: 0.8rem;
	margin-bottom: 0.5rem;
	text-align: center;
	font-weight: 500;
}

.login-footer {
	text-align: center;
	border-top: 1px solid var(--border);
	padding-top: 1rem;
}

/* ==========================================================================
   FILTER CHIPS & BADGES
   ========================================================================== */
.filter-chips {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 0.15rem 0 0.25rem;
	flex-wrap: nowrap;
}

.filter-chips::-webkit-scrollbar {
	display: none;
}

.chip {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	color: #475569;
	padding: 0.25rem 0.55rem;
	border-radius: 8px;
	font-size: 0.72rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	transition: all 0.15s ease;
	user-select: none;
	flex-shrink: 0;
}

.chip:hover {
	background: #f1f5f9;
	border-color: #cbd5e1;
	color: #0f172a;
}

.chip.active {
	background: #0f172a;
	color: #ffffff;
	border-color: #0f172a;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.chip.chip-alert.active {
	background: #dc2626;
	border-color: #dc2626;
	color: #ffffff;
}

.chip.chip-suggestion.active {
	background: #d97706;
	border-color: #d97706;
	color: #ffffff;
}

.chip.chip-order.active {
	background: #059669;
	border-color: #059669;
	color: #ffffff;
}

.chip-badge {
	background: #ef4444;
	color: white;
	font-size: 0.62rem;
	font-weight: 700;
	padding: 0.05rem 0.3rem;
	border-radius: 6px;
	line-height: 1.1;
}

.chip.active .chip-badge {
	background: rgba(255, 255, 255, 0.3);
	color: white;
}

/* Badge Order in Conversation List */
.badge-order-chip {
	font-size: 0.65rem;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
}
	gap: 0.2rem;
}

.badge-order-chip.ready {
	background: #dcfce7;
	color: #15803d;
	border: 1px solid #86efac;
}

.badge-order-chip.collecting {
	background: #fef3c7;
	color: #b45309;
	border: 1px solid #fde68a;
}

/* Keyboard Hints Box */
.keyboard-hints-box {
	margin-top: 1.5rem;
	padding: 0.75rem 1rem;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 8px;
	text-align: center;
}

.keyboard-hints-box code {
	background: #f1f5f9;
	padding: 0.15rem 0.35rem;
	border-radius: 4px;
	font-size: 0.72rem;
	color: #0284c7;
	font-weight: 600;
}

/* Composer Toolbar & Wraps */
.chat-composer-wrap {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

.composer-toolbar {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 1.25rem 0;
}

.ai-shortcuts-wrap {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

/* ==========================================================================
   QUICK REPLIES MODAL
   ========================================================================== */
.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.modal-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
	width: 100%;
	max-width: 600px;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: modalSlideUp 0.2s ease-out;
}

.modal-header {
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #f8fafc;
}

.modal-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.98rem;
	color: #0f172a;
	font-weight: 700;
}

.quick-replies-search {
	padding: 0.75rem 1.25rem 0.25rem;
}

.quick-replies-search input {
	width: 100%;
}

.quick-replies-list {
	flex: 1;
	overflow-y: auto;
	padding: 0.75rem 1.25rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.quick-reply-item {
	background: #f8fafc;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.75rem 0.85rem;
	cursor: pointer;
	transition: all 0.15s ease;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.quick-reply-item:hover {
	background: #ecfdf5;
	border-color: #86efac;
}

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

.quick-reply-title {
	font-size: 0.85rem;
	font-weight: 700;
	color: #0f172a;
}

.quick-reply-tag {
	font-size: 0.68rem;
	padding: 0.1rem 0.4rem;
	border-radius: 4px;
	background: #e2e8f0;
	color: #475569;
	font-weight: 600;
}

.quick-reply-content {
	font-size: 0.8rem;
	color: #475569;
	line-height: 1.4;
	white-space: pre-wrap;
}

/* ==========================================================================
   IMAGE LIGHTBOX MODAL
   ========================================================================== */
.lightbox-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(10, 15, 26, 0.88);
	backdrop-filter: blur(8px);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	cursor: zoom-out;
}

.lightbox-content {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lightbox-content img {
	max-width: 100%;
	max-height: 90vh;
	border-radius: 8px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
	object-fit: contain;
}

.lightbox-close {
	position: absolute;
	top: -40px;
	right: 0;
	background: none;
	border: none;
	color: #ffffff;
	font-size: 1.8rem;
	cursor: pointer;
	line-height: 1;
}

/* Chat image thumbnail */
.chat-attachment-img {
	max-width: 240px;
	max-height: 180px;
	border-radius: 8px;
	cursor: pointer;
	margin-top: 0.35rem;
	border: 1px solid var(--border);
	transition: transform 0.15s ease;
}

.chat-attachment-img:hover {
	transform: scale(1.02);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
	position: fixed;
	bottom: 20px;
	right: 24px;
	z-index: 10001;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	pointer-events: none;
}

.toast {
	background: #0f172a;
	color: #ffffff;
	padding: 0.65rem 1rem;
	border-radius: 8px;
	font-size: 0.84rem;
	font-weight: 500;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	gap: 0.5rem;
	animation: toastSlideIn 0.2s ease-out;
	pointer-events: auto;
}

.toast.success {
	background: #065f46;
	border: 1px solid #10b981;
}

.toast.error {
	background: #991b1b;
	border: 1px solid #ef4444;
}

@keyframes toastSlideIn {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==========================================================================
   KNOWLEDGE BASE (TAB KNOWLEDGE) MODERN STYLES
   ========================================================================== */
.kb-container {
	max-width: 1300px;
	margin: 0 auto;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	padding: 0.5rem 1rem 3rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.kb-header-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 1.25rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	flex-wrap: wrap;
}

.kb-header-left {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex: 1;
	min-width: 280px;
}

.kb-header-icon {
	font-size: 2.2rem;
	background: #f1f5f9;
	border-radius: 12px;
	padding: 0.5rem 0.75rem;
	line-height: 1;
}

.kb-header-left h2 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	color: #0f172a;
}

.kb-header-left p {
	margin: 0.25rem 0 0;
	font-size: 0.82rem;
	color: var(--muted);
	line-height: 1.45;
}

.kb-header-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.kb-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.kb-search-box {
	position: relative;
	display: flex;
	align-items: center;
	min-width: 280px;
	flex: 1;
}

.kb-search-box input {
	width: 100%;
	padding-left: 2.2rem;
	padding-right: 2rem;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 8px;
	height: 38px;
	font-size: 0.84rem;
}

.kb-search-box .search-icon {
	position: absolute;
	left: 0.75rem;
	color: var(--muted);
	pointer-events: none;
}

.kb-search-box .btn-icon {
	position: absolute;
	right: 0.5rem;
}

.kb-category-chips {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.kb-chip {
	background: #ffffff;
	border: 1px solid var(--border-light);
	color: #475569;
	padding: 0.3rem 0.65rem;
	border-radius: 20px;
	font-size: 0.74rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	transition: all 0.15s ease;
}

.kb-chip:hover {
	background: #f1f5f9;
	border-color: #cbd5e1;
	color: #0f172a;
}

.kb-chip.active {
	background: #0f172a;
	color: #ffffff;
	border-color: #0f172a;
}

.kb-badge {
	background: #f1f5f9;
	color: #475569;
	font-size: 0.65rem;
	font-weight: 700;
	padding: 0.05rem 0.35rem;
	border-radius: 99px;
}

.kb-chip.active .kb-badge {
	background: rgba(255, 255, 255, 0.25);
	color: #ffffff;
}

/* Cards Grid */
.kb-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
	gap: 1.25rem;
}

.kb-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
	transition: all 0.2s ease;
	position: relative;
}

.kb-card:hover {
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
	transform: translateY(-2px);
	border-color: #cbd5e1;
}

.kb-card-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.kb-cat-tag {
	font-size: 0.68rem;
	font-weight: 700;
	padding: 0.15rem 0.5rem;
	border-radius: 6px;
	text-transform: uppercase;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.kb-cat-tag.PRICING { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.kb-cat-tag.SIZING { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.kb-cat-tag.FABRIC { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.kb-cat-tag.SHIPPING { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.kb-cat-tag.WARRANTY { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.kb-cat-tag.RULES { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.kb-cat-tag.FAQ { background: #fce7f3; color: #9d174d; border: 1px solid #fbcfe8; }
.kb-cat-tag.GENERAL { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }

.kb-card.inactive {
	opacity: 0.65;
	background: #f8fafc;
	border-style: dashed;
}

.kb-card.inactive:hover {
	opacity: 0.9;
}

.kb-scope-tag {
	font-size: 0.68rem;
	font-weight: 600;
	color: #64748b;
	background: #f1f5f9;
	padding: 0.15rem 0.4rem;
	border-radius: 4px;
	border: 1px solid #e2e8f0;
}

.kb-card-thumb-wrap {
	position: relative;
	margin-top: 0.4rem;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #e2e8f0;
	max-height: 110px;
	background: #000;
	cursor: pointer;
}

.kb-card-thumb-wrap img {
	width: 100%;
	height: 110px;
	object-fit: cover;
	opacity: 0.92;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.kb-card-thumb-wrap:hover img {
	opacity: 1;
	transform: scale(1.03);
}

.kb-thumb-badge {
	position: absolute;
	bottom: 6px;
	right: 6px;
	background: rgba(15, 23, 42, 0.75);
	color: #fff;
	font-size: 0.65rem;
	font-weight: 600;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	backdrop-filter: blur(4px);
}

/* Simulator Output Styles */
.sim-msg-row {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

/* ==========================================================================
   AI SIMULATOR DRAWER PLAYGROUND
   ========================================================================== */
.kb-sim-drawer {
	width: 640px !important;
	max-width: 96vw !important;
}

.kb-sim-top-bar {
	padding: 0.85rem 1.25rem;
	background: #f8fafc;
	border-bottom: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	flex-shrink: 0;
}

.kb-sim-pills-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.kb-sim-pills-list {
	display: flex;
	gap: 0.35rem;
	overflow-x: auto;
	padding-bottom: 2px;
	scrollbar-width: thin;
}

.kb-sim-pills-list::-webkit-scrollbar {
	height: 4px;
}

.kb-sim-pills-list::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.kb-sim-stream {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem 1.25rem 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.15rem;
	background: #f8fafc;
}

.kb-sim-empty-state {
	margin: auto;
	text-align: center;
	padding: 2.5rem 1.5rem;
	background: #ffffff;
	border: 1px dashed #cbd5e1;
	border-radius: 12px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.kb-sim-composer-wrap {
	padding: 0.85rem 1.25rem;
	background: #ffffff;
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

.kb-sim-form {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.kb-sim-input {
	flex: 1;
	background: #f8fafc !important;
	border-radius: 8px !important;
	padding: 0.65rem 0.85rem !important;
	font-size: 0.86rem !important;
}

.kb-sim-input:focus {
	background: #ffffff !important;
}

.kb-sim-send-btn {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.65rem 1.15rem;
	font-size: 0.84rem;
	font-weight: 600;
	border-radius: 8px;
}

.sim-turn-wrap {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.sim-bubble-user-wrap {
	display: flex;
	justify-content: flex-end;
	align-items: flex-start;
	gap: 0.5rem;
}

.sim-bubble-user {
	background: #0284c7;
	color: #ffffff;
	padding: 0.65rem 0.95rem;
	border-radius: 14px 14px 2px 14px;
	font-size: 0.84rem;
	max-width: 82%;
	box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
	line-height: 1.45;
	word-break: break-word;
}

.sim-bubble-bot-wrap {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	max-width: 88%;
}

.sim-bot-avatar-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.74rem;
	font-weight: 700;
	color: #334155;
	padding: 0 0.2rem;
}

.sim-bubble-bot {
	background: #ffffff;
	color: #0f172a;
	padding: 0.75rem 1rem;
	border-radius: 4px 14px 14px 14px;
	font-size: 0.84rem;
	border: 1px solid #e2e8f0;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
	line-height: 1.5;
	white-space: pre-line;
	word-break: break-word;
}

.sim-bubble-bot img {
	max-width: 100%;
	max-height: 220px;
	border-radius: 8px;
	margin-top: 0.5rem;
	display: block;
	border: 1px solid #e2e8f0;
	cursor: pointer;
}

.sim-inspector-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 0.5rem 0.75rem;
	font-size: 0.72rem;
	color: #475569;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.sim-inspector-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	font-weight: 600;
	color: #1e293b;
}

.sim-ref-list {
	display: flex;
	gap: 0.3rem;
	flex-wrap: wrap;
	margin-top: 0.25rem;
}

.sim-ref-chip {
	background: #eff6ff;
	color: #1d4ed8;
	border: 1px solid #bfdbfe;
	border-radius: 4px;
	padding: 0.15rem 0.4rem;
	font-size: 0.68rem;
	font-weight: 600;
}


/* ==========================================================================
   KB SIDE DRAWER (SLIDE-OVER FROM RIGHT) & IMAGE DROPZONE
   ========================================================================== */
.drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(3px);
	z-index: 999;
	display: flex;
	justify-content: flex-end;
	opacity: 0;
	transition: opacity 0.22s ease;
	pointer-events: none;
}

.drawer-backdrop.active {
	opacity: 1;
	pointer-events: auto;
}

.side-drawer,
.kb-drawer {
	width: 580px;
	max-width: 95vw;
	height: 100vh;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	box-shadow: -10px 0 35px rgba(0, 0, 0, 0.18);
	transform: translateX(100%);
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 1000;
}

.drawer-backdrop.active .side-drawer,
.drawer-backdrop.active .kb-drawer {
	transform: translateX(0);
}

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

.drawer-title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 1.05rem;
	font-weight: 700;
	color: #0f172a;
}

.drawer-body {
	padding: 1.25rem 1.5rem;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.drawer-footer {
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--border);
	background: #f8fafc;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.65rem;
	flex-shrink: 0;
}

.kb-editor-form {
	display: flex !important;
	flex-direction: column !important;
	gap: 1rem !important;
	margin-top: 1rem;
	width: 100%;
}

.kb-form-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.85rem;
	width: 100%;
}

@media (max-width: 600px) {
	.kb-form-row-2 {
		grid-template-columns: 1fr;
	}
}

.kb-field-group {
	display: flex !important;
	flex-direction: column !important;
	gap: 0.35rem !important;
	width: 100% !important;
}

.kb-field-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: #1e293b;
}

.kb-field-input {
	width: 100% !important;
	box-sizing: border-box;
}

/* Upload Dropzone */
.kb-upload-dropzone {
	border: 2px dashed #cbd5e1;
	border-radius: 10px;
	padding: 1.1rem 1rem;
	background: #f8fafc;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
}

.kb-upload-dropzone:hover,
.kb-upload-dropzone.dragover {
	background: #eff6ff;
	border-color: #3b82f6;
}

.kb-dropzone-content {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	flex-wrap: wrap;
}

.kb-dropzone-icon {
	font-size: 1.8rem;
}

.kb-dropzone-text {
	text-align: left;
	font-size: 0.82rem;
	color: #334155;
}

/* Image Preview Box */
.kb-image-preview-box {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 9px;
	padding: 0.65rem 0.85rem;
}

.kb-preview-img-wrap {
	width: 64px;
	height: 64px;
	border-radius: 6px;
	overflow: hidden;
	background: #000;
	flex-shrink: 0;
	border: 1px solid #cbd5e1;
}

.kb-preview-img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kb-preview-details {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	flex: 1;
	min-width: 0;
}

.kb-preview-name {
	font-size: 0.82rem;
	font-weight: 700;
	color: #0f172a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.kb-active-toggle-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #f8fafc;
	padding: 0.75rem 1rem;
	border-radius: 9px;
	border: 1px solid var(--border);
}



