/*
 * Leaf Concierge: public widget.
 * Leaf brand: Canopy, Ivory, Mist, Moss, Brass, Ink. System fonts only.
 * Radius 4px, one subtle shadow, visible focus, reduced motion respected.
 */
.lc {
	--lc-ground: #F5F1E6;
	--lc-surface: #FFFEFA;
	--lc-ink: #18201A;
	--lc-muted: #4B5749;
	--lc-rule: #D8D3C0;
	--lc-accent: #12301F;
	--lc-accent-hover: #1D4A31;
	--lc-on-accent: #F5F1E6;
	--lc-brass: #7F5F28;
	--lc-link: #12301F;
	--lc-good-bg: #DDE6D4;
	--lc-good: #4A6741;
	--lc-warn-bg: #F6ECD2;
	--lc-warn: #8A5A12;
	--lc-bad-bg: #F4DEDA;
	--lc-bad: #9B2C2C;
	--lc-shadow: 0 8px 24px rgba(18, 48, 31, .14);
	--lc-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
	--lc-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	position: fixed;
	bottom: var(--lc-y, 20px);
	z-index: 99990;
	font: 14px/1.5 var(--lc-sans);
	color: var(--lc-ink);
	-webkit-text-size-adjust: 100%;
}
.lc[data-pos="right"] { right: var(--lc-x, 20px); }
.lc[data-pos="left"] { left: var(--lc-x, 20px); }

.lc[data-theme="dark"] {
	--lc-ground: #0D1A12;
	--lc-surface: #12301F;
	--lc-ink: #F5F1E6;
	--lc-muted: #C9CFC0;
	--lc-rule: #2A4A37;
	--lc-accent: #1D4A31;
	--lc-accent-hover: #26603f;
	--lc-on-accent: #F5F1E6;
	--lc-brass: #C9A566;
	--lc-link: #C9A566;
	--lc-good-bg: #1F3D2B;
	--lc-good: #9DB394;
	--lc-warn-bg: #3A2D12;
	--lc-warn: #E5C98A;
	--lc-bad-bg: #4A1F1F;
	--lc-bad: #F2B6B0;
	--lc-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
	.lc[data-theme="auto"] {
		--lc-ground: #0D1A12;
		--lc-surface: #12301F;
		--lc-ink: #F5F1E6;
		--lc-muted: #C9CFC0;
		--lc-rule: #2A4A37;
		--lc-accent: #1D4A31;
		--lc-accent-hover: #26603f;
		--lc-brass: #C9A566;
		--lc-link: #C9A566;
		--lc-good-bg: #1F3D2B;
		--lc-good: #9DB394;
		--lc-warn-bg: #3A2D12;
		--lc-warn: #E5C98A;
		--lc-bad-bg: #4A1F1F;
		--lc-bad: #F2B6B0;
		--lc-shadow: 0 8px 24px rgba(0, 0, 0, .4);
	}
}

.lc *, .lc *::before, .lc *::after { box-sizing: border-box; }
:where(.lc) button, :where(.lc) input, :where(.lc) textarea { font: inherit; color: inherit; }
.lc [hidden] { display: none !important; }

/* Launcher ---------------------------------------------------------------- */
.lc-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	padding: 0 18px 0 14px;
	border: 0;
	border-radius: 999px;
	background: var(--lc-accent);
	color: var(--lc-on-accent);
	box-shadow: var(--lc-shadow);
	cursor: pointer;
	font-weight: 500;
}
.lc-launcher svg { width: 20px; height: 20px; flex: none; }
.lc-launcher:hover { background: var(--lc-accent-hover); }
.lc--open .lc-launcher { display: none; }
.lc button:focus-visible, .lc a:focus-visible, .lc input:focus-visible, .lc textarea:focus-visible {
	outline: 2px solid var(--lc-brass);
	outline-offset: 2px;
}

/* Panel ------------------------------------------------------------------- */
.lc-panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 2 * var(--lc-x, 20px));
	height: 560px;
	max-height: calc(100vh - 2 * var(--lc-y, 20px));
	max-height: calc(100dvh - 2 * var(--lc-y, 20px));
	background: var(--lc-ground);
	border: 1px solid var(--lc-rule);
	border-radius: 8px;
	box-shadow: var(--lc-shadow);
	overflow: hidden;
}
.lc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 12px 16px;
	background: var(--lc-accent);
	color: var(--lc-on-accent);
}
.lc-head > svg { width: 22px; height: 22px; flex: none; color: #C9A566; }
.lc-titles { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.lc-name { font: 500 17px/1.2 var(--lc-serif); letter-spacing: -.01em; }
.lc-sub { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-head .lc-quiet { color: var(--lc-on-accent); opacity: .85; }
.lc-close {
	width: 32px; height: 32px; border: 0; border-radius: 4px; background: transparent;
	color: var(--lc-on-accent); font-size: 22px; line-height: 1; cursor: pointer;
}
.lc-close:hover, .lc-head .lc-quiet:hover { background: rgba(245, 241, 230, .14); }

/* Messages ---------------------------------------------------------------- */
.lc-log { position: relative; flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.lc-msg { max-width: 92%; padding: 10px 12px; border-radius: 4px; border: 1px solid var(--lc-rule); background: var(--lc-surface); word-wrap: break-word; overflow-wrap: anywhere; }
.lc-msg--user { align-self: flex-end; background: var(--lc-accent); border-color: var(--lc-accent); color: var(--lc-on-accent); }
.lc-msg--bot { align-self: flex-start; }
.lc-msg--error { background: var(--lc-bad-bg); border-color: var(--lc-bad); color: var(--lc-bad); }
.lc-msg--wait { color: var(--lc-muted); font-style: italic; }
.lc-body p { margin: 0 0 8px; }
.lc-body p:last-child, .lc-body ul:last-child, .lc-body ol:last-child { margin-bottom: 0; }
.lc-body ul, .lc-body ol { margin: 0 0 8px; padding-left: 20px; }
.lc-body li { margin: 2px 0; }
.lc-body a { color: var(--lc-link); text-decoration: underline; text-underline-offset: 2px; }
.lc-msg--user .lc-body a { color: var(--lc-on-accent); }
.lc-body code { font: 12px ui-monospace, "SF Mono", Consolas, monospace; background: rgba(127, 127, 127, .15); padding: 1px 4px; border-radius: 3px; }
.lc-cite { font-size: 10px; margin-left: 1px; }
.lc-cite a { text-decoration: none; font-weight: 600; padding: 0 2px; }

.lc-chip { display: inline-block; margin-bottom: 6px; padding: 1px 10px; border-radius: 999px; font-size: 12px; }
.lc-chip--good { background: var(--lc-good-bg); color: var(--lc-good); }
.lc-chip--warn { background: var(--lc-warn-bg); color: var(--lc-warn); }

.lc-eyebrow { display: block; font: 500 11px ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--lc-muted); }
.lc-sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--lc-rule); }
.lc-sources ol { list-style: none; margin: 4px 0 0; padding: 0; }
.lc-sources li { margin: 2px 0; font-size: 13px; }
.lc-sources a { color: var(--lc-link); text-underline-offset: 2px; }
.lc-num { display: inline-block; min-width: 18px; margin-right: 6px; font: 11px ui-monospace, "SF Mono", Consolas, monospace; color: var(--lc-brass); }

.lc-feedback { display: flex; gap: 4px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--lc-muted); }
.lc-quiet { padding: 3px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--lc-muted); cursor: pointer; font-size: 12px; }
.lc-quiet:hover { background: var(--lc-rule); color: var(--lc-ink); }

/* Handoff form ------------------------------------------------------------- */
.lc-handoff { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--lc-rule); }
.lc-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--lc-muted); }
.lc-field input, .lc-field textarea, .lc-input {
	width: 100%; padding: 8px 10px; border: 1px solid var(--lc-rule); border-radius: 4px;
	background: var(--lc-ground); color: var(--lc-ink); font-size: 14px;
}
.lc-field textarea { resize: vertical; }
.lc-trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.lc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--lc-muted); }
.lc-consent input { margin-top: 2px; }
.lc-status { margin: 0; font-size: 13px; color: var(--lc-muted); }

/* Starters and composer ---------------------------------------------------- */
.lc-starters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.lc-starter {
	padding: 5px 12px; border: 1px solid var(--lc-rule); border-radius: 999px;
	background: var(--lc-surface); color: var(--lc-ink); font-size: 13px; cursor: pointer; text-align: left;
}
.lc-starter:hover { border-color: var(--lc-accent); }
.lc-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--lc-rule); background: var(--lc-surface); }
.lc-input { flex: 1; min-height: 40px; max-height: 120px; resize: none; line-height: 1.4; }
.lc-send {
	height: 40px; padding: 0 16px; border: 1px solid var(--lc-accent); border-radius: 4px;
	background: var(--lc-accent); color: var(--lc-on-accent); font-weight: 500; cursor: pointer;
}
.lc-send:hover { background: var(--lc-accent-hover); }
.lc-send:disabled, .lc-input:disabled { opacity: .55; cursor: not-allowed; }
.lc-note { margin: 0; padding: 6px 16px 10px; background: var(--lc-surface); font-size: 11px; line-height: 1.4; color: var(--lc-muted); }

/* Small screens ------------------------------------------------------------ */
@media (max-width: 480px) {
	.lc--open { left: 0 !important; right: 0 !important; bottom: 0 !important; }
	.lc--open .lc-panel { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border-width: 0; }
	.lc-input, .lc-field input, .lc-field textarea { font-size: 16px; } /* stops iOS zooming on focus */
}
@media (prefers-reduced-motion: no-preference) {
	.lc-panel { animation: lc-in .16s ease-out; }
	@keyframes lc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
