/* Diabetes Clarity Chat */
:root { --dc-primary: #0f766e; }
.dc-wrap, .dc-panel {
	--dc-bg: #ffffff;
	--dc-surface: #f4f7f7;
	--dc-text: #1f2a2e;
	--dc-muted: #5f6f74;
	--dc-border: #e1e8e9;
	--dc-radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--dc-text);
	box-sizing: border-box;
}
.dc-wrap *, .dc-panel * { box-sizing: border-box; }

.dc-wrap { position: fixed; bottom: 20px; z-index: 99999; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.dc-pos-right { right: 20px; }
.dc-pos-left { left: 20px; align-items: flex-start; }

.dc-launcher {
	width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--dc-primary); color: #fff;
	display: grid; place-items: center;
	box-shadow: 0 8px 24px rgba(0,0,0,.18);
	transition: transform .15s ease, box-shadow .15s ease;
}
.dc-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.22); }
.dc-launcher:focus-visible { outline: 3px solid rgba(15,118,110,.35); outline-offset: 3px; }
.dc-launcher .dc-ico-close { display: none; }
.dc-open .dc-launcher .dc-ico-open { display: none; }
.dc-open .dc-launcher .dc-ico-close { display: block; }

.dc-panel {
	width: 380px; height: 580px; max-height: calc(100vh - 110px);
	background: var(--dc-bg); border-radius: var(--dc-radius);
	box-shadow: 0 16px 48px rgba(0,0,0,.18);
	display: flex; flex-direction: column; overflow: hidden;
	animation: dc-in .18s ease-out;
}
.dc-panel[hidden] { display: none; }
.dc-panel.dc-inline { width: 100%; height: 100%; max-height: none; box-shadow: 0 2px 12px rgba(0,0,0,.08); border: 1px solid var(--dc-border); animation: none; }
@keyframes dc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: var(--dc-primary); color: #fff; }
.dc-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.dc-head-text { flex: 1; min-width: 0; }
.dc-title { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-sub { font-size: 12.5px; opacity: .85; }
.dc-icon-btn { background: transparent; border: 0; color: #fff; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; opacity: .85; padding: 0; }
.dc-icon-btn:hover { background: rgba(255,255,255,.15); opacity: 1; }

.dc-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--dc-surface); }
.dc-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.dc-msg p { margin: 0 0 .5em; }
.dc-msg p:last-child { margin-bottom: 0; }
.dc-msg ul { margin: .25em 0 .5em; padding-left: 1.2em; }
.dc-msg ul:last-child { margin-bottom: 0; }
.dc-msg li { margin: .15em 0; }
.dc-msg a { color: var(--dc-primary); text-decoration: underline; }
.dc-bot { align-self: flex-start; background: var(--dc-bg); border: 1px solid var(--dc-border); border-bottom-left-radius: 4px; }
.dc-user { align-self: flex-end; background: var(--dc-primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.dc-error { border-color: #f1c4c4; background: #fff5f5; color: #9b2c2c; }

.dc-typing { display: flex; gap: 4px; padding: 14px 16px; }
.dc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--dc-muted); opacity: .4; animation: dc-dot 1.2s infinite; }
.dc-typing span:nth-child(2) { animation-delay: .15s; }
.dc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dc-dot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: .9; transform: translateY(-3px); } }

.dc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px; background: var(--dc-surface); }
.dc-chips:not(:empty) { padding-bottom: 10px; }
.dc-chip { border: 1px solid var(--dc-primary); color: var(--dc-primary); background: var(--dc-bg); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit; line-height: 1.3; text-align: left; }
.dc-chip:hover { background: var(--dc-primary); color: #fff; }

.dc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--dc-border); background: var(--dc-bg); }
.dc-input { flex: 1; resize: none; border: 1px solid var(--dc-border); border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--dc-text); background: var(--dc-bg); max-height: 120px; min-height: 42px; line-height: 1.4; margin: 0; }
.dc-input:focus { outline: none; border-color: var(--dc-primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.dc-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; background: var(--dc-primary); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.dc-send:disabled { opacity: .5; cursor: default; }

.dc-disclaimer { font-size: 11.5px; color: var(--dc-muted); padding: 0 14px 10px; background: var(--dc-bg); line-height: 1.35; }

@media (max-width: 480px) {
	.dc-wrap { bottom: 14px; }
	.dc-pos-right { right: 14px; }
	.dc-pos-left { left: 14px; }
	.dc-wrap .dc-panel:not(.dc-inline) { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
	.dc-open .dc-launcher { display: none; }
	.dc-input { font-size: 16px; }
}
