/*
 * Self-contained palette so the tool looks the same inside any theme
 * (same approach as the other EducationalEngine generators).
 */
.ee-cb-app {
	--ee-cb-bg: #ffffff;
	--ee-cb-surface: #f1f5f9;
	--ee-cb-text: #1e293b;
	--ee-cb-muted: #52606d;
	--ee-cb-border: #cbd5e1;
	--ee-cb-accent: #1d4ed8;
	--ee-cb-accent-hover: #1e40af;
	--ee-cb-accent-soft: #eff6ff;
	--ee-cb-danger: #b91c1c;
	--ee-cb-warning-soft: #fffbeb;
	--ee-cb-warning: #92400e;

	max-width: 1180px;
	margin: 0 auto 48px;
	padding: 24px;
	background: var(--ee-cb-bg);
	border: 1px solid var(--ee-cb-border);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
	color: var(--ee-cb-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	line-height: 1.55;
}
.ee-cb-app * { box-sizing: border-box; }
.ee-cb-app button, .ee-cb-app input, .ee-cb-app select, .ee-cb-app textarea {
	font-family: inherit; box-shadow: none; text-shadow: none; background-image: none;
}
.ee-cb-app [hidden] { display: none !important; }
.ee-cb-app .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

.ee-cb-quota-bar {
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center;
	background: var(--ee-cb-surface); border: 1px solid var(--ee-cb-border); border-radius: 6px;
	padding: 10px 16px; margin-bottom: 16px; font-size: 0.9em;
}
.ee-cb-quota-label { font-weight: 700; }
.ee-cb-quota-count { color: var(--ee-cb-muted); }
.ee-cb-quota-count a { color: var(--ee-cb-accent); }

/* Layout: sidebar + main. */
.ee-cb-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.ee-cb-sidebar { border-right: 1px solid var(--ee-cb-border); padding-right: 16px; min-width: 0; }
.ee-cb-new-btn { width: 100%; justify-content: center; }
.ee-cb-side-title { font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ee-cb-muted); margin: 18px 0 6px; }
.ee-cb-chat-list { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow-y: auto; }
.ee-cb-chat-list li { margin: 0; padding: 0; }
.ee-cb-chat-link {
	display: block; width: 100%; text-align: left; background: transparent !important; border: 0; border-radius: 6px;
	padding: 8px 10px; cursor: pointer; color: var(--ee-cb-text) !important;
}
.ee-cb-chat-link:hover { background: var(--ee-cb-surface) !important; }
.ee-cb-chat-link.is-active { background: var(--ee-cb-accent-soft) !important; box-shadow: inset 3px 0 0 var(--ee-cb-accent); }
.ee-cb-chat-link-title { display: block; font-weight: 600; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ee-cb-chat-link-meta { display: block; font-size: 0.75em; color: var(--ee-cb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ee-cb-empty { color: var(--ee-cb-muted); font-size: 0.88em; padding: 6px 10px; }
.ee-cb-main { min-width: 0; }

/* Forms and buttons. */
.ee-cb-heading { margin: 0 0 4px; font-size: 1.35em; }
.ee-cb-field { margin-bottom: 14px; flex: 1 1 0; min-width: 0; }
.ee-cb-field label, .ee-cb-label { display: block; font-weight: 600; font-size: 0.9em; margin-bottom: 4px; color: var(--ee-cb-text); }
.ee-cb-field input, .ee-cb-field select, .ee-cb-field textarea, .ee-cb-input {
	width: 100%; padding: 8px 10px; height: auto; min-height: 40px; border: 1px solid var(--ee-cb-border); border-radius: 6px;
	background: #fff !important; color: var(--ee-cb-text) !important; font-size: 0.95em;
}
.ee-cb-input:focus, .ee-cb-field textarea:focus { outline: 2px solid var(--ee-cb-accent); outline-offset: 0; border-color: var(--ee-cb-accent); }
textarea.ee-cb-input { resize: vertical; line-height: 1.5; }
.ee-cb-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ee-cb-row .ee-cb-field { min-width: 200px; }
.ee-cb-hint { font-size: 0.82em; color: var(--ee-cb-muted); margin: 4px 0 0; }
.ee-cb-hint:empty { display: none; }
.ee-cb-privacy { margin-top: 18px; }

.ee-cb-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.ee-cb-mode {
	position: relative; display: block; border: 1px solid var(--ee-cb-border); border-radius: 8px; padding: 10px 12px;
	cursor: pointer; background: #fff; transition: border-color 0.15s, background 0.15s;
}
.ee-cb-mode:hover { border-color: var(--ee-cb-accent); }
.ee-cb-mode input { position: absolute; opacity: 0; pointer-events: none; }
.ee-cb-mode.is-selected { border-color: var(--ee-cb-accent); background: var(--ee-cb-accent-soft); box-shadow: inset 0 0 0 1px var(--ee-cb-accent); }
.ee-cb-mode:focus-within { outline: 2px solid var(--ee-cb-accent); outline-offset: 2px; }
.ee-cb-mode.is-disabled { opacity: 0.5; cursor: not-allowed; }
.ee-cb-mode-label { display: block; font-weight: 700; font-size: 0.92em; margin-bottom: 2px; }
.ee-cb-mode-blurb { display: block; font-size: 0.8em; color: var(--ee-cb-muted); line-height: 1.4; }

.ee-cb-roleplay { background: var(--ee-cb-surface); border-radius: 8px; padding: 12px 14px 2px; margin-bottom: 14px; }

.ee-cb-drop .ee-cb-picker { border: 2px dashed var(--ee-cb-border); border-radius: 8px; padding: 12px; background: var(--ee-cb-surface); }
.ee-cb-drop .ee-cb-picker input[type="file"] { border: 0; background: transparent !important; padding: 0; min-height: 0; }
.ee-cb-drop .ee-cb-picker.is-dragover { border-color: var(--ee-cb-accent); background: var(--ee-cb-accent-soft); }
.ee-cb-file-name { display: block; font-weight: 600; font-size: 0.9em; margin-top: 6px; word-break: break-all; }
.ee-cb-file-name:empty { display: none; }
.ee-cb-file-name.is-error, .ee-cb-attach-name.is-error { color: var(--ee-cb-danger); }

.ee-cb-starters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.ee-cb-starters:empty { display: none; }
.ee-cb-starter {
	background: var(--ee-cb-surface) !important; border: 1px solid var(--ee-cb-border); border-radius: 999px; padding: 4px 10px;
	font-size: 0.8em; color: var(--ee-cb-text) !important; cursor: pointer; text-align: left; line-height: 1.35;
}
.ee-cb-starter:hover { border-color: var(--ee-cb-accent); color: var(--ee-cb-accent) !important; }

.ee-cb-btn {
	display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 6px; cursor: pointer;
	border: 1px solid var(--ee-cb-border); background: #fff !important; color: var(--ee-cb-text) !important;
	font-weight: 600; font-size: 0.9em; text-decoration: none !important; line-height: 1.2;
}
.ee-cb-btn:hover { border-color: var(--ee-cb-accent); color: var(--ee-cb-accent) !important; }
.ee-cb-btn:focus-visible { outline: 2px solid var(--ee-cb-accent); outline-offset: 2px; }
.ee-cb-btn-primary { background: var(--ee-cb-accent) !important; border-color: var(--ee-cb-accent); color: #fff !important; padding: 10px 18px; font-size: 1em; }
.ee-cb-btn-primary:hover { background: var(--ee-cb-accent-hover) !important; color: #fff !important; }
.ee-cb-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.ee-cb-btn-small { padding: 5px 10px; font-size: 0.82em; }
.ee-cb-btn-danger:hover { border-color: var(--ee-cb-danger); color: var(--ee-cb-danger) !important; }
.ee-cb-cost-badge { background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 2px 8px; font-size: 0.78em; font-weight: 600; }
.ee-cb-cost-badge:empty { display: none; }
.ee-cb-link { background: none !important; border: 0; padding: 0; color: var(--ee-cb-accent) !important; font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; }
.ee-cb-actions { margin-top: 4px; }

.ee-cb-status { margin: 12px 0 0; font-weight: 600; color: var(--ee-cb-accent); }
.ee-cb-status:empty { display: none; }
.ee-cb-status.is-error { color: var(--ee-cb-danger); }
.ee-cb-status.is-working::before {
	content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
	border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ee-cb-spin 0.9s linear infinite;
}
@keyframes ee-cb-spin { to { transform: rotate(360deg); } }

/* Conversation. */
.ee-cb-chat-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--ee-cb-border); }
.ee-cb-chat-heading { min-width: 0; flex: 1 1 280px; }
.ee-cb-chat-type { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72em; font-weight: 700; color: var(--ee-cb-accent); margin: 0 0 2px; }
.ee-cb-chat-title { margin: 0; font-size: 1.25em; word-break: break-word; }
.ee-cb-chat-meta { color: var(--ee-cb-muted); font-size: 0.85em; margin: 2px 0 0; }
.ee-cb-chat-meta:empty { display: none; }
.ee-cb-chat-tools { display: flex; flex-wrap: wrap; gap: 6px; }

.ee-cb-notices { margin: 10px 0 0; }
.ee-cb-notices:empty { display: none; }
.ee-cb-notice, .ee-cb-doc-chip { font-size: 0.86em; margin: 0 0 6px; padding: 6px 10px; border-radius: 6px; background: var(--ee-cb-surface); }
.ee-cb-doc-chip { display: inline-block; font-weight: 600; word-break: break-all; }
.ee-cb-notice.is-warning { background: var(--ee-cb-warning-soft); color: var(--ee-cb-warning); }
.ee-cb-notice.is-info { background: var(--ee-cb-accent-soft); }
.ee-cb-carry { font-size: 0.86em; border: 1px solid var(--ee-cb-border); border-radius: 6px; padding: 6px 10px; margin: 0 0 6px; }
.ee-cb-carry summary { cursor: pointer; font-weight: 600; color: var(--ee-cb-accent); }
.ee-cb-carry-body { margin-top: 6px; }

.ee-cb-messages { max-height: 62vh; min-height: 160px; overflow-y: auto; padding: 14px 4px; display: flex; flex-direction: column; gap: 12px; }
.ee-cb-msg { max-width: 86%; border-radius: 12px; padding: 10px 14px; position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.ee-cb-msg-user { align-self: flex-end; background: var(--ee-cb-accent-soft); border: 1px solid #c7d7fb; border-bottom-right-radius: 4px; }
.ee-cb-msg-ai { align-self: flex-start; background: #fff; border: 1px solid var(--ee-cb-border); border-bottom-left-radius: 4px; }
.ee-cb-msg-who { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ee-cb-muted); margin-bottom: 2px; }
.ee-cb-msg-body > :first-child { margin-top: 0; }
.ee-cb-msg-body > :last-child { margin-bottom: 0; }
.ee-cb-msg-body p { margin: 0 0 8px; }
.ee-cb-msg-body h3, .ee-cb-msg-body h4, .ee-cb-msg-body h5, .ee-cb-msg-body h6 { margin: 12px 0 6px; font-size: 1em; }
.ee-cb-msg-body h3 { font-size: 1.08em; }
.ee-cb-msg-body ul, .ee-cb-msg-body ol { margin: 0 0 8px; padding-left: 22px; }
.ee-cb-msg-body li { margin: 2px 0; }
.ee-cb-msg-body li.is-nested { margin-left: 18px; list-style-type: circle; }
.ee-cb-msg-body code { background: var(--ee-cb-surface); border-radius: 4px; padding: 1px 4px; font-size: 0.9em; }
.ee-cb-msg-body pre { background: var(--ee-cb-surface); border-radius: 6px; padding: 10px; overflow-x: auto; font-size: 0.85em; }
.ee-cb-msg-body pre code { background: none; padding: 0; }
.ee-cb-msg-body blockquote { margin: 0 0 8px; padding: 4px 12px; border-left: 3px solid var(--ee-cb-border); color: var(--ee-cb-muted); }
.ee-cb-msg-body hr { border: 0; border-top: 1px solid var(--ee-cb-border); margin: 10px 0; }
.ee-cb-msg-body a { color: var(--ee-cb-accent); }
.ee-cb-table { overflow-x: auto; margin: 0 0 8px; }
.ee-cb-table table { border-collapse: collapse; font-size: 0.88em; width: 100%; }
.ee-cb-table th, .ee-cb-table td { border: 1px solid var(--ee-cb-border); padding: 5px 8px; text-align: left; vertical-align: top; }
.ee-cb-table th { background: var(--ee-cb-surface); }
.ee-cb-msg-tools { margin-top: 6px; text-align: right; }
.ee-cb-msg-copy { background: none !important; border: 0; padding: 0; font-size: 0.75em; color: var(--ee-cb-muted) !important; cursor: pointer; }
.ee-cb-msg-copy:hover { color: var(--ee-cb-accent) !important; }
.ee-cb-pending.ee-cb-msg-user { opacity: 0.75; }
.ee-cb-typing .ee-cb-msg-body { color: var(--ee-cb-muted); font-size: 0.9em; }
.ee-cb-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.ee-cb-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--ee-cb-muted); animation: ee-cb-blink 1.2s infinite ease-in-out; }
.ee-cb-dots span:nth-child(2) { animation-delay: 0.2s; }
.ee-cb-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ee-cb-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
	.ee-cb-dots span, .ee-cb-status.is-working::before { animation: none; }
}

.ee-cb-limit { background: var(--ee-cb-warning-soft); border: 1px solid #fcd34d; border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.ee-cb-limit-text { margin: 0 0 10px; font-size: 0.9em; color: var(--ee-cb-warning); }

.ee-cb-composer { border-top: 1px solid var(--ee-cb-border); padding-top: 12px; }
.ee-cb-composer-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.ee-cb-attach { cursor: pointer; }
.ee-cb-attach-name { font-size: 0.82em; font-weight: 600; word-break: break-all; }
.ee-cb-attach-name:empty { display: none; }
.ee-cb-turns { font-size: 0.78em; color: var(--ee-cb-muted); margin-left: auto; }
.ee-cb-send-btn { flex: 0 0 auto; }

.ee-cb-upsells { margin: 18px 0 0; border: 1px solid var(--ee-cb-border); border-radius: 8px; padding: 8px 14px; }
.ee-cb-upsells summary { cursor: pointer; font-weight: 700; color: var(--ee-cb-accent); }
.ee-cb-upsells-body { margin-top: 10px; }
.ee-cb-disclaimer { font-size: 0.78em; color: var(--ee-cb-muted); margin: 14px 0 0; }

.ee-cb-login-notice { padding: 12px 16px; background: #f1f5f9; border-radius: 6px; }

@media (max-width: 800px) {
	.ee-cb-app { padding: 14px; }
	.ee-cb-layout { grid-template-columns: 1fr; }
	.ee-cb-sidebar { border-right: 0; border-bottom: 1px solid var(--ee-cb-border); padding: 0 0 12px; }
	.ee-cb-chat-list { max-height: 180px; }
	.ee-cb-msg { max-width: 94%; }
	.ee-cb-messages { max-height: none; }
	.ee-cb-turns { margin-left: 0; width: 100%; order: 3; }
}
