.cgc-root { --cgc-accent: #2e7d32; --cgc-bg: #fff; --cgc-fg: #1b1b1b; --cgc-muted: #666; font-family: inherit; }
.cgc-root * { box-sizing: border-box; }
.cgc-panel { display: flex; flex-direction: column; background: var(--cgc-bg); color: var(--cgc-fg); border: 1px solid #d0d7de; border-radius: 12px; overflow: hidden; height: var(--cgc-height, 760px); max-height: 92vh; }
.cgc-panel[hidden] { display: none; }
.cgc-head { background: var(--cgc-accent); color: #fff; padding: 12px 16px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cgc-reset { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; font-weight: 500; }
.cgc-reset:hover { background: rgba(255,255,255,.32); }
.cgc-reset:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.cgc-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cgc-msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; line-height: 1.45; font-size: 15px; overflow-wrap: anywhere; }
.cgc-msg p { margin: 0 0 6px; } .cgc-msg p:last-child { margin: 0; }
.cgc-msg ul { margin: 4px 0 4px 18px; padding: 0; }
.cgc-msg a { color: var(--cgc-accent); text-decoration: underline; }
.cgc-user { align-self: flex-end; background: var(--cgc-accent); color: #fff; }
.cgc-bot { align-self: flex-start; background: #f1f3f4; }
.cgc-wait { color: var(--cgc-muted); font-style: italic; }
.cgc-notice { margin: 0; padding: 6px 12px; font-size: 11px; color: var(--cgc-muted); border-top: 1px solid #eee; }
.cgc-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #eee; }
.cgc-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #c4c9ce; border-radius: 8px; font-size: 15px; }
.cgc-form button { background: var(--cgc-accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.cgc-form button:focus-visible, .cgc-form input:focus-visible, .cgc-toggle:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.cgc-inline { width: 100%; max-width: var(--cgc-width, 720px); margin: 1em auto; }
/* The floating wrapper spans the viewport (minus 16px gutters) and lets clicks through, so a percentage
   --cgc-width resolves against the screen and not against the shrink-to-fit wrapper (was 138px on phones). */
.cgc-floating { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 99999; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.cgc-floating > * { pointer-events: auto; }
/* Never narrower than 440px (tablets), never wider than the screen, never taller than the space next to the toggle. */
.cgc-floating .cgc-panel { width: min(max(var(--cgc-width, 720px), 440px), 100%); max-height: min(92vh, calc(var(--cgc-vh, 100vh) - 96px)); box-shadow: 0 6px 24px rgba(0,0,0,.22); }
.cgc-toggle { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--cgc-accent); color: #fff; font-size: 26px; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }

.cgc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; max-height: 132px; overflow-y: auto; border-top: 1px solid #eee; background: #fafafa; }
.cgc-chip { background: #fff; color: var(--cgc-accent); border: 1px solid var(--cgc-accent); border-radius: 999px; padding: 4px 10px; font-size: 13px; line-height: 1.3; cursor: pointer; text-align: left; }
.cgc-chip:hover { background: var(--cgc-accent); color: #fff; }
.cgc-chip:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

.cgc-msg:has(.cgc-mapbox) { width: 88%; }
.cgc-map { height: 260px; border-radius: 8px; margin-top: 8px; border: 1px solid #d0d7de; background: #e8eef0; z-index: 0; }
.cgc-map-fail { display: flex; align-items: center; justify-content: center; color: var(--cgc-muted); font-size: 13px; }
.cgc-maplinks { font-size: 12px; margin: 4px 0 0 16px; }
.cgc-mapbox .leaflet-container { font-family: inherit; }

/* themes often force capitals / letter-spacing on buttons */
.cgc-chip, .cgc-reset, .cgc-form button { text-transform: none; letter-spacing: normal; }
.cgc-chip { font-weight: 400; }

/* ---- responsive: phones, tablets, touch (0.8.8) ---- */
.cgc-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cgc-headbtns { display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0; }
.cgc-reset, .cgc-close { white-space: nowrap; }
.cgc-close { display: none; width: 30px; height: 30px; padding: 0; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; font-size: 14px; line-height: 1; cursor: pointer; text-transform: none; letter-spacing: normal; }
.cgc-close:hover { background: rgba(255,255,255,.32); }
.cgc-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.cgc-log { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.cgc-inline .cgc-panel { max-height: 92dvh; }

/* Phones (portrait) and any very short screen (phone landscape): the floating chat becomes a full-screen sheet. */
@media (max-width: 600px), (max-height: 500px) {
	.cgc-floating.cgc-open { z-index: 100000; }
	.cgc-floating .cgc-panel { position: fixed; left: 0; right: 0; top: var(--cgc-vt, 0px); width: 100%; height: var(--cgc-vh, 100vh); max-height: none; border: 0; border-radius: 0; box-shadow: none; }
	.cgc-floating .cgc-close { display: inline-flex; align-items: center; justify-content: center; }
	.cgc-floating .cgc-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
	.cgc-floating .cgc-form { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
	html.cgc-lock, html.cgc-lock body { overflow: hidden; }
	.cgc-msg { max-width: 94%; }
	.cgc-msg:has(.cgc-mapbox) { width: 100%; max-width: 100%; }
	.cgc-chips { max-height: 30vh; }
	.cgc-map { height: 240px; }
}
@media (max-width: 600px) {
	.cgc-inline { margin: .5em auto; }
}
/* Phone landscape: keep as much room as possible for the conversation. */
@media (max-height: 500px) {
	.cgc-head { padding-top: 6px; padding-bottom: 6px; }
	.cgc-notice { padding: 3px 12px; font-size: 10px; line-height: 1.25; }
	.cgc-chips { max-height: 84px; }
	.cgc-map { height: 200px; }
}
/* Touch screens: larger tap targets; 16px text field stops iOS zooming the page on focus. */
@media (pointer: coarse) {
	.cgc-form input { font-size: 16px; padding: 10px 12px; }
	.cgc-form button { padding: 10px 16px; }
	.cgc-chip { padding: 8px 12px; font-size: 14px; }
	.cgc-chips { gap: 8px; }
	.cgc-reset { padding: 6px 12px; }
	.cgc-close { width: 34px; height: 34px; }
}
.cgc-lang { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; text-transform: none; letter-spacing: normal; }
.cgc-lang:hover { background: rgba(255,255,255,.32); }
.cgc-lang:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (pointer: coarse) { .cgc-lang { padding: 6px 12px; } }
