/* ==========================================================================
   Zetlink Unified Chat — one design for customers, publishers, visitors & team
   ========================================================================== */
.zt-chat,
.zt-chat * { box-sizing: border-box; }

.zt-chat {
	--ztc-primary: #6455F7;
	--ztc-primary-dark: #4F46E5;
	--ztc-primary-soft: #EEF2FF;
	--ztc-bg: #ffffff;
	--ztc-surface: #F8FAFC;
	--ztc-border: #E2E8F0;
	--ztc-text: #0F172A;
	--ztc-muted: #64748B;
	--ztc-faint: #94A3B8;
	--ztc-ok: #22C55E;
	--ztc-warn: #F59E0B;
	--ztc-warn-bg: #FEF3C7;
	--ztc-danger: #EF4444;
	--ztc-radius: 16px;
	--ztc-shadow: 0 18px 50px rgba(15, 23, 42, .22);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ztc-text);
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 2147483000;
}
.zt-chat[hidden] { display: none !important; }

/* ---------- bubble ---------- */
.zt-chat__bubble {
	position: relative;
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--ztc-primary), var(--ztc-primary-dark));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 12px 30px rgba(100, 85, 247, .45);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .18s ease, box-shadow .18s ease;
}
.zt-chat__bubble:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(100, 85, 247, .5); }
.zt-chat__bubble svg { width: 26px; height: 26px; transition: opacity .15s, transform .15s; position: absolute; }
.zt-chat__bubble-x { opacity: 0; transform: rotate(-90deg) scale(.6); }
.zt-chat--open .zt-chat__bubble-ic { opacity: 0; transform: rotate(90deg) scale(.6); }
.zt-chat--open .zt-chat__bubble-x { opacity: 1; transform: none; }
.zt-chat--docked .zt-chat__bubble { display: none; }
.zt-chat__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: var(--ztc-danger);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.zt-chat__badge[hidden] { display: none; }
.zt-chat__badge.is-waiting { background: var(--ztc-warn); color: #1f2937; }
@keyframes ztc-ring { 0% { box-shadow: 0 0 0 0 rgba(100,85,247,.55); } 100% { box-shadow: 0 0 0 18px rgba(100,85,247,0); } }
.zt-chat__bubble.is-pulse { animation: ztc-ring 1.4s ease-out 2; }

/* ---------- panel ---------- */
.zt-chat__panel {
	position: fixed;
	right: 22px;
	bottom: 92px;
	width: 390px;
	height: min(680px, calc(100vh - 116px));
	background: var(--ztc-bg);
	border-radius: var(--ztc-radius);
	box-shadow: var(--ztc-shadow);
	border: 1px solid var(--ztc-border);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(.98);
	transition: opacity .18s ease, transform .18s ease;
	pointer-events: none;
}
.zt-chat__panel[hidden] { display: none; }
.zt-chat--open .zt-chat__panel { opacity: 1; transform: none; pointer-events: auto; }
.zt-chat--team .zt-chat__panel { width: 820px; height: min(720px, calc(100vh - 116px)); }
.zt-chat--expanded .zt-chat__panel { right: 18px; bottom: 18px; top: 18px; left: 18px; width: auto; height: auto; }
.zt-chat--expanded .zt-chat__bubble { display: none; }

/* docked (Messages page) */
.zt-chat--docked { position: static; }
.zt-chat--docked .zt-chat__panel {
	position: relative;
	right: auto;
	bottom: auto;
	width: 100%;
	height: calc(100vh - 190px);
	min-height: 560px;
	opacity: 1;
	transform: none;
	pointer-events: auto;
	box-shadow: 0 6px 24px rgba(15, 23, 42, .07);
}
.zt-chat-page-wrap { width: 100%; }
#zt-chat-page { min-height: 400px; }
.zt-chat-page-loading { padding: 40px; text-align: center; color: #94A3B8; font-size: 13px; }

/* ---------- header ---------- */
.zt-chat__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: linear-gradient(135deg, var(--ztc-primary), var(--ztc-primary-dark));
	color: #fff;
	flex-shrink: 0;
}
.zt-chat__head-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255,255,255,.18);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 15px;
	overflow: hidden;
	flex-shrink: 0;
}
.zt-chat__head-avatar img { width: 100%; height: 100%; object-fit: cover; }
.zt-chat__head-avatar svg { width: 20px; height: 20px; }
.zt-chat__head-text { flex: 1 1 auto; min-width: 0; }
.zt-chat__head-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__head-sub { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.zt-chat__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ztc-ok); display: inline-block; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.zt-chat__dot.is-off { background: #cbd5e1; }
.zt-chat__dot.is-wait { background: var(--ztc-warn); }
.zt-chat__head-actions { display: flex; gap: 4px; flex-shrink: 0; }
.zt-chat__ibtn {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 9px;
	background: rgba(255,255,255,.14);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}
.zt-chat__ibtn:hover { background: rgba(255,255,255,.26); }
.zt-chat__ibtn svg { width: 17px; height: 17px; }
.zt-chat__ibtn.is-dark { background: var(--ztc-surface); color: var(--ztc-muted); border: 1px solid var(--ztc-border); }
.zt-chat__ibtn.is-dark:hover { background: #eef2ff; color: var(--ztc-primary); }

/* ---------- banners ---------- */
.zt-chat__banner {
	padding: 9px 14px;
	font-size: 12px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	border-bottom: 1px solid var(--ztc-border);
}
.zt-chat__banner.is-wait { background: var(--ztc-warn-bg); color: #92400E; }
.zt-chat__banner.is-ok { background: #DCFCE7; color: #166534; }
.zt-chat__banner.is-muted { background: var(--ztc-surface); color: var(--ztc-muted); }
.zt-chat__banner.is-closed { background: #F1F5F9; color: #475569; }
.zt-chat__banner[hidden] { display: none; }
.zt-chat__spin { width: 14px; height: 14px; border: 2px solid rgba(146,64,14,.25); border-top-color: #92400E; border-radius: 50%; animation: ztc-spin .9s linear infinite; flex-shrink: 0; }
@keyframes ztc-spin { to { transform: rotate(360deg); } }

/* ---------- tabs (team) ---------- */
.zt-chat__tabs { display: flex; border-bottom: 1px solid var(--ztc-border); background: var(--ztc-bg); flex-shrink: 0; }
.zt-chat__tab {
	flex: 1 1 0;
	padding: 10px 6px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: var(--ztc-muted);
	font-weight: 600;
	font-size: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: color .15s, border-color .15s;
}
.zt-chat__tab:hover { color: var(--ztc-text); }
.zt-chat__tab.is-active { color: var(--ztc-primary); border-bottom-color: var(--ztc-primary); }
.zt-chat__pill {
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: #E2E8F0;
	color: #475569;
	font-size: 10px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.zt-chat__pill.is-hot { background: var(--ztc-danger); color: #fff; }
.zt-chat__pill.is-warn { background: var(--ztc-warn); color: #1f2937; }
.zt-chat__pill[hidden] { display: none; }

/* ---------- body layouts ---------- */
.zt-chat__body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.zt-chat__split { flex: 1 1 auto; min-height: 0; display: flex; }
.zt-chat__col-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--ztc-border); display: flex; flex-direction: column; min-height: 0; background: var(--ztc-bg); }
.zt-chat--expanded .zt-chat__col-list, .zt-chat--docked .zt-chat__col-list { width: 340px; }
.zt-chat__col-thread { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--ztc-surface); }

/* list tools */
.zt-chat__tools { padding: 10px 10px 6px; display: flex; gap: 6px; flex-shrink: 0; }
.zt-chat__search { flex: 1 1 auto; min-width: 0; height: 34px; border: 1px solid var(--ztc-border); border-radius: 9px; padding: 0 10px 0 32px; font-size: 12px; background: var(--ztc-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center / 15px; outline: none; color: var(--ztc-text); }
.zt-chat__search:focus { border-color: var(--ztc-primary); background-color: #fff; }
.zt-chat__chips { display: flex; gap: 5px; padding: 0 10px 8px; flex-wrap: wrap; flex-shrink: 0; }
.zt-chat__chip { border: 1px solid var(--ztc-border); background: #fff; color: var(--ztc-muted); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer; }
.zt-chat__chip.is-active { background: var(--ztc-primary-soft); border-color: #c7d2fe; color: var(--ztc-primary); }

/* conversation list */
.zt-chat__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.zt-chat__item {
	display: flex;
	gap: 10px;
	padding: 10px 12px;
	border-bottom: 1px solid #F1F5F9;
	cursor: pointer;
	transition: background .12s;
	position: relative;
}
.zt-chat__item:hover { background: var(--ztc-surface); }
.zt-chat__item.is-active { background: var(--ztc-primary-soft); }
.zt-chat__item.is-waiting::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ztc-warn); }
.zt-chat__avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
	color: #312e81;
	font-weight: 700;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
	position: relative;
}
.zt-chat__avatar img { width: 100%; height: 100%; object-fit: cover; }
.zt-chat__avatar .zt-chat__dot { position: absolute; right: 0; bottom: 0; box-shadow: 0 0 0 2px #fff; }
.zt-chat__item-main { flex: 1 1 auto; min-width: 0; }
.zt-chat__item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.zt-chat__item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__item-time { font-size: 10px; color: var(--ztc-faint); flex-shrink: 0; }
.zt-chat__item-prev { font-size: 12px; color: var(--ztc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.zt-chat__item.has-unread .zt-chat__item-prev { color: var(--ztc-text); font-weight: 600; }
.zt-chat__item-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.zt-chat__tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #E2E8F0; color: #475569; text-transform: uppercase; letter-spacing: .3px; }
.zt-chat__tag.is-waiting { background: var(--ztc-warn-bg); color: #92400E; }
.zt-chat__tag.is-active { background: #DCFCE7; color: #166534; }
.zt-chat__tag.is-closed { background: #F1F5F9; color: #64748B; }
.zt-chat__tag.is-assigned { background: var(--ztc-primary-soft); color: var(--ztc-primary); text-transform: none; }
.zt-chat__empty { padding: 34px 16px; text-align: center; color: var(--ztc-faint); font-size: 12.5px; }
.zt-chat__more { display: block; width: calc(100% - 20px); margin: 8px 10px; padding: 8px; border: 1px dashed var(--ztc-border); background: #fff; color: var(--ztc-muted); border-radius: 9px; cursor: pointer; font-size: 12px; }

/* thread header (team) */
.zt-chat__thead { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--ztc-border); flex-shrink: 0; }
.zt-chat__thead-text { flex: 1 1 auto; min-width: 0; }
.zt-chat__thead-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__thead-name a { color: inherit; text-decoration: none; }
.zt-chat__thead-name a:hover { color: var(--ztc-primary); }
.zt-chat__thead-sub { font-size: 11px; color: var(--ztc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__thead-actions { display: flex; gap: 5px; flex-shrink: 0; }
.zt-chat__btn {
	height: 30px;
	padding: 0 11px;
	border-radius: 8px;
	border: 1px solid var(--ztc-border);
	background: #fff;
	color: var(--ztc-text);
	font-size: 11.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.zt-chat__btn:hover { border-color: #c7d2fe; color: var(--ztc-primary); background: var(--ztc-primary-soft); }
.zt-chat__btn.is-primary { background: var(--ztc-primary); border-color: var(--ztc-primary); color: #fff; }
.zt-chat__btn.is-primary:hover { background: var(--ztc-primary-dark); }
.zt-chat__btn.is-danger:hover { border-color: #fecaca; color: var(--ztc-danger); background: #fef2f2; }
.zt-chat__btn svg { width: 14px; height: 14px; }
.zt-chat__btn[disabled] { opacity: .5; cursor: default; }
.zt-chat__back { display: none; }

/* order filter bar */
.zt-chat__orderbar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: #fff; border-bottom: 1px solid var(--ztc-border); flex-shrink: 0; }
.zt-chat__orderbar[hidden] { display: none; }
.zt-chat__orderbar label { font-size: 11px; color: var(--ztc-muted); font-weight: 600; white-space: nowrap; }
.zt-chat__select { flex: 1 1 auto; min-width: 0; height: 30px; border: 1px solid var(--ztc-border); border-radius: 8px; background: var(--ztc-surface); font-size: 12px; padding: 0 8px; color: var(--ztc-text); outline: none; }
.zt-chat__select:focus { border-color: var(--ztc-primary); }
.zt-chat__orderlink { font-size: 11px; color: var(--ztc-primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.zt-chat__orderlink:hover { text-decoration: underline; }

/* ---------- messages ---------- */
.zt-chat__msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; background: var(--ztc-surface); }
.zt-chat__day { align-self: center; font-size: 10.5px; color: var(--ztc-faint); background: #fff; border: 1px solid var(--ztc-border); border-radius: 999px; padding: 2px 10px; margin: 8px 0 4px; font-weight: 600; }
.zt-chat__row { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.zt-chat__row.is-me { align-self: flex-end; align-items: flex-end; }
.zt-chat__row.is-sys { align-self: center; align-items: center; max-width: 92%; }
.zt-chat__row + .zt-chat__row.is-cont { margin-top: -2px; }
.zt-chat__who { font-size: 10.5px; color: var(--ztc-muted); font-weight: 600; margin: 4px 6px 2px; }
.zt-chat__bub {
	background: #fff;
	border: 1px solid var(--ztc-border);
	color: var(--ztc-text);
	border-radius: 14px;
	border-top-left-radius: 5px;
	padding: 8px 12px;
	font-size: 13px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
	box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.zt-chat__row.is-me .zt-chat__bub { background: var(--ztc-primary); border-color: var(--ztc-primary); color: #fff; border-radius: 14px; border-top-right-radius: 5px; }
.zt-chat__row.is-sys .zt-chat__bub { background: #F1F5F9; border-color: #E2E8F0; color: #475569; font-size: 12px; border-radius: 10px; text-align: center; }
.zt-chat__bub a { color: inherit; text-decoration: underline; }
.zt-chat__ochip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 10.5px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--ztc-primary-soft);
	color: var(--ztc-primary);
	text-decoration: none !important;
	margin-bottom: 5px;
	white-space: nowrap;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
}
.zt-chat__row.is-me .zt-chat__ochip { background: rgba(255,255,255,.2); color: #fff; }
.zt-chat__ochip svg { width: 11px; height: 11px; flex-shrink: 0; }
.zt-chat__att { display: block; margin-top: 6px; }
.zt-chat__att img { max-width: 240px; max-height: 200px; border-radius: 10px; display: block; border: 1px solid rgba(0,0,0,.08); }
.zt-chat__file { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 9px; background: rgba(15,23,42,.06); text-decoration: none !important; font-size: 12px; font-weight: 600; color: inherit; }
.zt-chat__row.is-me .zt-chat__file { background: rgba(255,255,255,.18); }
.zt-chat__file svg { width: 14px; height: 14px; flex-shrink: 0; }
.zt-chat__meta { font-size: 10px; color: var(--ztc-faint); margin: 3px 6px 0; display: flex; align-items: center; gap: 4px; }
.zt-chat__ticks { font-size: 11px; letter-spacing: -2px; color: var(--ztc-faint); }
.zt-chat__ticks.is-seen { color: var(--ztc-primary); }
.zt-chat__row.is-pending .zt-chat__bub { opacity: .7; }
.zt-chat__row.is-failed .zt-chat__bub { border-color: var(--ztc-danger); }
.zt-chat__hint { text-align: center; color: var(--ztc-faint); font-size: 12px; padding: 26px 10px; margin: auto; }

/* ---------- composer ---------- */
.zt-chat__composer { border-top: 1px solid var(--ztc-border); background: #fff; padding: 8px 10px 10px; flex-shrink: 0; }
.zt-chat__composer[hidden] { display: none; }
.zt-chat__ctx { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11px; color: var(--ztc-muted); flex-wrap: wrap; }
.zt-chat__ctx[hidden] { display: none; }
.zt-chat__ctx-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--ztc-primary-soft); color: var(--ztc-primary); border-radius: 999px; padding: 2px 8px 2px 10px; font-weight: 700; }
.zt-chat__ctx-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.zt-chat__file-chip { display: inline-flex; align-items: center; gap: 6px; background: #F1F5F9; color: #475569; border-radius: 999px; padding: 2px 8px 2px 10px; font-weight: 600; max-width: 220px; }
.zt-chat__file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zt-chat__file-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.zt-chat__input-row { display: flex; align-items: flex-end; gap: 6px; }
.zt-chat__ta {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 40px;
	max-height: 140px;
	resize: none;
	border: 1px solid var(--ztc-border);
	border-radius: 12px;
	padding: 9px 12px;
	font: inherit;
	font-size: 13px;
	line-height: 1.45;
	color: var(--ztc-text);
	background: var(--ztc-surface);
	outline: none;
	overflow-y: auto;
}
.zt-chat__ta:focus { border-color: var(--ztc-primary); background: #fff; }
.zt-chat__send {
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 12px;
	background: var(--ztc-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background .15s, transform .1s;
}
.zt-chat__send:hover { background: var(--ztc-primary-dark); }
.zt-chat__send:active { transform: scale(.96); }
.zt-chat__send[disabled] { opacity: .45; cursor: default; }
.zt-chat__send svg { width: 18px; height: 18px; }
.zt-chat__tool { width: 36px; height: 40px; border: 0; background: transparent; color: var(--ztc-faint); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0; }
.zt-chat__tool:hover { color: var(--ztc-primary); background: var(--ztc-primary-soft); }
.zt-chat__tool svg { width: 19px; height: 19px; }
.zt-chat__tool.is-on { color: var(--ztc-primary); }
.zt-chat__composer input[type=file] { display: none; }
.zt-chat__menu { position: relative; }
.zt-chat__pop {
	position: absolute;
	bottom: 44px;
	left: 0;
	width: 300px;
	max-height: 260px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--ztc-border);
	border-radius: 12px;
	box-shadow: 0 12px 30px rgba(15,23,42,.16);
	z-index: 5;
	padding: 6px;
}
.zt-chat__pop[hidden] { display: none; }
.zt-chat__pop-title { font-size: 10.5px; font-weight: 700; color: var(--ztc-faint); text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px 4px; }
.zt-chat__pop-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--ztc-text); }
.zt-chat__pop-item:hover { background: var(--ztc-surface); }
.zt-chat__pop-item.is-active { background: var(--ztc-primary-soft); color: var(--ztc-primary); }
.zt-chat__pop-item small { color: var(--ztc-faint); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__pop-item b { font-weight: 700; white-space: nowrap; }
.zt-chat__pop-item .zt-chat__tag { margin-left: auto; }
.zt-chat__error { color: var(--ztc-danger); font-size: 11.5px; padding: 4px 2px 0; }
.zt-chat__error:empty { display: none; }

/* ---------- visitor start form ---------- */
.zt-chat__start { padding: 22px 18px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.zt-chat__start h4 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.zt-chat__start p { margin: 0 0 6px; color: var(--ztc-muted); font-size: 12.5px; }
.zt-chat__field { height: 40px; border: 1px solid var(--ztc-border); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 13px; background: var(--ztc-surface); outline: none; color: var(--ztc-text); }
.zt-chat__field:focus { border-color: var(--ztc-primary); background: #fff; }
textarea.zt-chat__field { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.zt-chat__start .zt-chat__btn.is-primary { height: 42px; justify-content: center; font-size: 13px; border-radius: 10px; }

/* ---------- new chat (team) ---------- */
.zt-chat__newchat { padding: 10px; border-bottom: 1px solid var(--ztc-border); background: #fff; }
.zt-chat__newchat[hidden] { display: none; }
.zt-chat__results { max-height: 220px; overflow-y: auto; margin-top: 6px; }
.zt-chat__result { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.zt-chat__result:hover { background: var(--ztc-surface); }
.zt-chat__result .zt-chat__avatar { width: 30px; height: 30px; font-size: 12px; }
.zt-chat__result-name { font-size: 12.5px; font-weight: 600; }
.zt-chat__result-mail { font-size: 11px; color: var(--ztc-faint); }

/* ---------- toast ---------- */
.zt-chat__toast { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); background: #0F172A; color: #fff; font-size: 12px; padding: 8px 14px; border-radius: 999px; box-shadow: 0 8px 20px rgba(0,0,0,.25); z-index: 6; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s; }
.zt-chat__toast.is-on { opacity: 1; }
.zt-chat__jump { position: absolute; left: 50%; bottom: 82px; transform: translateX(-50%); background: var(--ztc-primary); color: #fff; font-size: 11.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 0; cursor: pointer; box-shadow: 0 8px 20px rgba(100,85,247,.4); z-index: 6; }
.zt-chat__jump[hidden] { display: none; }
.zt-chat__col-thread, .zt-chat__body { position: relative; }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
	.zt-chat--team .zt-chat__panel { width: calc(100vw - 44px); }
	.zt-chat__split { position: relative; }
	.zt-chat__col-list { width: 100%; border-right: 0; }
	.zt-chat__col-thread { position: absolute; inset: 0; background: var(--ztc-surface); transform: translateX(100%); transition: transform .2s ease; z-index: 2; }
	.zt-chat__split.is-thread .zt-chat__col-thread { transform: none; }
	.zt-chat__back { display: inline-flex; }
}
@media (max-width: 640px) {
	.zt-chat { right: 14px; bottom: 14px; }
	.zt-chat__panel, .zt-chat--team .zt-chat__panel, .zt-chat--expanded .zt-chat__panel {
		position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0;
	}
	.zt-chat--docked .zt-chat__panel { position: relative; inset: auto; height: calc(100vh - 140px); min-height: 480px; border-radius: 12px; }
	.zt-chat--open .zt-chat__bubble { display: none; }
	.zt-chat__row { max-width: 90%; }
	body.zt-chat-lock { overflow: hidden; }
}

/* ---------- contact card + thread header (v1.12) ---------- */
.zt-chat__av { position: relative; flex-shrink: 0; }
.zt-chat__av-flag {
	position: absolute; right: -4px; bottom: -3px;
	width: 18px; height: 13px; border-radius: 3px; object-fit: cover;
	border: 1.5px solid #fff; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
}
.zt-chat__flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; vertical-align: -2px; margin-right: 5px; }
.zt-chat__flag-txt { font-size: 9px; font-weight: 700; letter-spacing: .3px; padding: 0 4px; border-radius: 3px; background: #E2E8F0; color: #475569; margin-right: 5px; vertical-align: 1px; }
.zt-chat__item-sub { font-size: 11px; color: var(--ztc-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.zt-chat__thead-name { flex-wrap: wrap; white-space: normal; }
.zt-chat__thead-nm { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zt-chat__role { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; padding: 1px 7px 1px 5px; border-radius: 999px; background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; letter-spacing: .2px; white-space: nowrap; }
.zt-chat__role svg { width: 10px; height: 10px; }
.zt-chat__role.is-customer  { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.zt-chat__role.is-reseller  { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.zt-chat__role.is-agency    { background: #F5F3FF; color: #6D28D9; border-color: #DDD6FE; }
.zt-chat__role.is-publisher { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }
.zt-chat__role.is-visitor   { background: #F1F5F9; color: #475569; border-color: #E2E8F0; }
.zt-chat__thead { flex-wrap: wrap; row-gap: 3px; }
.zt-chat__thead .zt-chat__thead-text { flex: 1 1 0; min-width: 0; }
.zt-chat__thead-line { flex: 1 0 100%; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ztc-muted); white-space: nowrap; overflow: hidden; }
.zt-chat__thead-line svg { width: 12px; height: 12px; flex-shrink: 0; }
.zt-chat__thead-line a { color: var(--ztc-primary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.zt-chat__thead-line a:hover { text-decoration: underline; }
.zt-chat__sep { color: var(--ztc-faint); margin: 0 2px; }
#zt-chat .zt-chat__copy { width: 20px !important; height: 20px !important; border-radius: 5px !important; display: inline-flex !important; align-items: center; justify-content: center; color: var(--ztc-faint); cursor: pointer; flex-shrink: 0; }
#zt-chat .zt-chat__copy:hover { background: var(--ztc-primary-soft); color: var(--ztc-primary); }
#zt-chat .zt-chat__copy svg { width: 12px; height: 12px; }
#zt-chat a.zt-chat__btn { text-decoration: none; }
#zt-chat .zt-chat__btn.is-icon { width: 30px; padding: 0 !important; justify-content: center; color: var(--ztc-muted) !important; }
#zt-chat .zt-chat__btn.is-icon:hover { color: var(--ztc-primary) !important; background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__btn.is-icon svg { width: 15px; height: 15px; }

.zt-chat__card { flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--ztc-border); }
#zt-chat .zt-chat__card-toggle {
	width: 100% !important; display: flex !important; align-items: center; gap: 8px;
	padding: 6px 14px !important; font-size: 11.5px !important; color: var(--ztc-muted); cursor: pointer; text-align: left;
}
#zt-chat .zt-chat__card-toggle:hover { background: var(--ztc-surface); }
.zt-chat__card-toggle b { color: var(--ztc-text); font-weight: 600; flex-shrink: 0; }
.zt-chat__card-brief { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: none; }
.zt-chat__card.is-collapsed .zt-chat__card-brief { display: block; }
.zt-chat__card-toggle svg { width: 14px; height: 14px; flex-shrink: 0; transition: transform .15s; }
.zt-chat__card.is-collapsed .zt-chat__card-toggle svg { transform: rotate(-90deg); }
.zt-chat__card-grid {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 6px 14px; padding: 0 14px 10px;
}
.zt-chat__card.is-collapsed .zt-chat__card-grid { display: none; }
.zt-chat__ci { min-width: 0; }
.zt-chat__ci-l { font-size: 10.5px; color: var(--ztc-faint); display: flex; align-items: center; gap: 4px; line-height: 1.3; }
.zt-chat__ci-l svg { width: 12px; height: 12px; flex-shrink: 0; }
.zt-chat__ci-v { font-size: 12px; color: var(--ztc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.45; }
.zt-chat__ci-v a { color: var(--ztc-primary); text-decoration: none; }
.zt-chat__ci-v a:hover { text-decoration: underline; }
.zt-chat__ci-v small { color: var(--ztc-faint); font-size: 10.5px; }
.zt-chat--expanded .zt-chat__card-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width: 640px) {
	.zt-chat__thead-actions .zt-chat__btn.is-icon { display: none; }
	.zt-chat__thead-line { font-size: 11px; }
	.zt-chat__card-grid { grid-template-columns: 1fr 1fr; }
}
.zt-chat__av .zt-chat__avatar .zt-chat__dot { bottom: auto; top: 1px; right: 1px; }
.zt-chat__thead .zt-chat__av .zt-chat__avatar { width: 40px; height: 40px; }

/* =====================================================================
   v1.13 — design pass.
   chat-widget.php prints a "guard" reset (#zt-chat button/input/select/a {…!important})
   so the dashboard theme can't bleed into the widget — but it also flattened the widget's
   own search box, filter chips, tabs, dropdown, chips and links into bare text. Every rule
   below carries #zt-chat (+ !important where the guard uses it) so the intended design wins.
   ===================================================================== */
#zt-chat { --ztc-radius: 18px; --ztc-shadow: 0 24px 60px rgba(15,23,42,.22), 0 2px 8px rgba(15,23,42,.08); --ztc-ring: 0 0 0 3px rgba(100,85,247,.16); }
#zt-chat .zt-chat__panel { border: 1px solid rgba(15,23,42,.06); }

/* header */
#zt-chat .zt-chat__head { padding: 12px 14px !important; }
#zt-chat .zt-chat__head-title { font-size: 15px; letter-spacing: -.1px; }
#zt-chat .zt-chat__ibtn { transition: background .12s; }
#zt-chat .zt-chat__ibtn.is-dark { background: var(--ztc-surface) !important; color: var(--ztc-muted) !important; border: 1px solid var(--ztc-border) !important; }
#zt-chat .zt-chat__ibtn.is-dark:hover { background: var(--ztc-primary-soft) !important; color: var(--ztc-primary) !important; }

/* tabs */
#zt-chat .zt-chat__tabs { padding: 0 6px; gap: 2px; background: #fff; }
#zt-chat .zt-chat__tab { padding: 11px 8px !important; font-size: 12.5px !important; font-weight: 600 !important; color: var(--ztc-muted) !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; background: transparent !important; position: relative; }
#zt-chat .zt-chat__tab:hover { color: var(--ztc-text) !important; background: var(--ztc-surface) !important; }
#zt-chat .zt-chat__tab.is-active { color: var(--ztc-primary) !important; border-bottom-color: var(--ztc-primary) !important; }
#zt-chat .zt-chat__pill { font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }

/* search + filters */
#zt-chat .zt-chat__tools { padding: 10px 10px 6px; }
#zt-chat .zt-chat__search { width: 100%; height: 36px !important; padding: 0 12px 0 34px !important; border: 1px solid var(--ztc-border) !important; border-radius: 10px !important; background: var(--ztc-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 15px !important; font-size: 12.5px !important; color: var(--ztc-text) !important; transition: border-color .15s, box-shadow .15s, background-color .15s; }
#zt-chat .zt-chat__search::placeholder { color: var(--ztc-faint); }
#zt-chat .zt-chat__search:focus { border-color: var(--ztc-primary) !important; background-color: #fff !important; box-shadow: var(--ztc-ring) !important; }
#zt-chat .zt-chat__chips { padding: 0 10px 8px; gap: 6px; }
#zt-chat .zt-chat__chip { height: 26px; padding: 0 11px !important; border: 1px solid var(--ztc-border) !important; border-radius: 999px !important; background: #fff !important; color: var(--ztc-muted) !important; font-size: 11.5px !important; font-weight: 600 !important; display: inline-flex; align-items: center; transition: background .12s, color .12s, border-color .12s; }
#zt-chat .zt-chat__chip:hover { border-color: #c7d2fe !important; color: var(--ztc-primary) !important; background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__chip.is-active { background: var(--ztc-primary) !important; border-color: var(--ztc-primary) !important; color: #fff !important; }

/* conversation list */
#zt-chat .zt-chat__item { padding: 11px 12px; gap: 11px; border-bottom: 1px solid #F1F5F9; }
#zt-chat .zt-chat__item:hover { background: #F8FAFC; }
#zt-chat .zt-chat__item.is-active { background: var(--ztc-primary-soft); box-shadow: inset 3px 0 0 var(--ztc-primary); }
#zt-chat .zt-chat__item.is-active.is-waiting::before { display: none; }
#zt-chat .zt-chat__avatar { background: linear-gradient(135deg, #DDD6FE, #C7D2FE); color: #3730A3; }
#zt-chat .zt-chat__item-name { font-size: 13px; }
#zt-chat .zt-chat__item-prev { font-size: 12px; margin-top: 2px; }
#zt-chat .zt-chat__item-meta { margin-top: 5px; }
#zt-chat .zt-chat__tag { font-size: 9.5px; padding: 2px 7px; }
#zt-chat .zt-chat__more { width: calc(100% - 20px); margin: 8px 10px !important; padding: 9px !important; border: 1px dashed var(--ztc-border) !important; border-radius: 10px !important; background: #fff !important; color: var(--ztc-muted) !important; font-size: 12px !important; font-weight: 600 !important; }
#zt-chat .zt-chat__more:hover { border-color: var(--ztc-primary) !important; color: var(--ztc-primary) !important; background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__empty { padding: 44px 16px 36px; font-size: 12.5px; color: var(--ztc-faint); }
#zt-chat .zt-chat__empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 10px; opacity: .45; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.7 4H7.3a2 2 0 0 0-1.8 1.1z'/%3E%3C/svg%3E") center / contain no-repeat; }
#zt-chat .zt-chat__hint { font-size: 12.5px; color: var(--ztc-faint); }
#zt-chat .zt-chat__col-thread .zt-chat__hint::before { content: ""; display: block; width: 52px; height: 52px; margin: 0 auto 12px; opacity: .4; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* order bar */
#zt-chat .zt-chat__orderbar { padding: 8px 14px; }
#zt-chat .zt-chat__select { height: 30px !important; padding: 0 28px 0 10px !important; border: 1px solid var(--ztc-border) !important; border-radius: 8px !important; background: var(--ztc-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px !important; font-size: 12px !important; color: var(--ztc-text) !important; cursor: pointer; }
#zt-chat .zt-chat__select:focus { border-color: var(--ztc-primary) !important; box-shadow: var(--ztc-ring); }
#zt-chat .zt-chat__orderlink { color: var(--ztc-primary) !important; font-size: 11.5px !important; font-weight: 600 !important; }

/* thread header + cards */
#zt-chat .zt-chat__thead { padding: 12px 14px; }
#zt-chat .zt-chat__thead-name a { color: inherit !important; }
#zt-chat .zt-chat__thead-name a:hover { color: var(--ztc-primary) !important; }
#zt-chat .zt-chat__thead-line a, #zt-chat .zt-chat__ci-v a { color: var(--ztc-primary) !important; }

/* messages */
#zt-chat .zt-chat__msgs { padding: 16px 16px 10px; gap: 7px; background: #F8FAFC; }
#zt-chat .zt-chat__row { max-width: 78%; }
#zt-chat .zt-chat__bub { border-radius: 16px; border-top-left-radius: 6px; padding: 9px 13px; font-size: 13.5px; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
#zt-chat .zt-chat__row.is-me .zt-chat__bub { border-top-left-radius: 16px; border-top-right-radius: 6px; background: linear-gradient(135deg, #6455F7, #5A4EE3); }
#zt-chat .zt-chat__row.is-sys .zt-chat__bub { border-radius: 999px; padding: 5px 12px; font-size: 11.5px; box-shadow: none; }
#zt-chat .zt-chat__bub a { color: inherit !important; text-decoration: underline !important; }
#zt-chat .zt-chat__who { font-size: 11px; }
#zt-chat .zt-chat__meta { font-size: 10.5px; }
#zt-chat .zt-chat__day { font-size: 10.5px; padding: 3px 11px; }
#zt-chat .zt-chat__ochip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px !important; border-radius: 8px !important; background: var(--ztc-primary-soft) !important; color: var(--ztc-primary) !important; font-size: 11.5px !important; font-weight: 600 !important; text-decoration: none !important; margin-bottom: 4px; }
#zt-chat .zt-chat__ochip svg { width: 12px; height: 12px; }
#zt-chat .zt-chat__row.is-me .zt-chat__ochip { background: rgba(255,255,255,.22) !important; color: #fff !important; }
#zt-chat .zt-chat__file { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px !important; border-radius: 10px !important; background: rgba(15,23,42,.06) !important; color: inherit !important; font-size: 12px !important; text-decoration: none !important; }
#zt-chat .zt-chat__file svg { width: 14px; height: 14px; }
#zt-chat .zt-chat__row.is-me .zt-chat__file { background: rgba(255,255,255,.2) !important; }
#zt-chat .zt-chat__jump { padding: 6px 12px !important; border-radius: 999px !important; background: var(--ztc-primary) !important; color: #fff !important; font-size: 11.5px !important; font-weight: 600 !important; box-shadow: 0 6px 16px rgba(100,85,247,.35); }

/* composer */
#zt-chat .zt-chat__composer { padding: 10px 12px 12px; }
#zt-chat .zt-chat__ta { padding: 10px 14px !important; border: 1px solid var(--ztc-border) !important; border-radius: 14px !important; background: var(--ztc-surface); font-size: 13.5px !important; line-height: 1.45 !important; min-height: 42px; transition: border-color .15s, box-shadow .15s, background-color .15s; }
#zt-chat .zt-chat__ta::placeholder { color: var(--ztc-faint); }
#zt-chat .zt-chat__ta:focus { border-color: var(--ztc-primary) !important; background: #fff; box-shadow: var(--ztc-ring); }
#zt-chat .zt-chat__send { width: 42px !important; height: 42px !important; border-radius: 14px !important; box-shadow: 0 6px 14px rgba(100,85,247,.35); transition: background .12s, transform .12s; }
#zt-chat .zt-chat__send:hover { background: var(--ztc-primary-dark) !important; }
#zt-chat .zt-chat__send:active { transform: scale(.96); }
#zt-chat .zt-chat__send[disabled] { opacity: .6; }
#zt-chat .zt-chat__send svg { width: 18px; height: 18px; }
#zt-chat .zt-chat__tool { width: 36px; height: 42px; border-radius: 10px !important; color: var(--ztc-faint) !important; background: transparent !important; }
#zt-chat .zt-chat__tool:hover, #zt-chat .zt-chat__tool.is-on { color: var(--ztc-primary) !important; background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__tool svg { width: 18px; height: 18px; }
#zt-chat .zt-chat__ctx { padding: 0 2px 6px; display: flex; flex-wrap: wrap; gap: 6px; }
#zt-chat .zt-chat__ctx-chip, #zt-chat .zt-chat__file-chip { font-size: 11.5px; font-weight: 600; padding: 3px 6px 3px 9px; }
#zt-chat .zt-chat__ctx-chip button, #zt-chat .zt-chat__file-chip button { width: 18px !important; height: 18px !important; border-radius: 50% !important; display: inline-flex !important; align-items: center; justify-content: center; font-size: 13px !important; color: inherit !important; }
#zt-chat .zt-chat__ctx-chip button:hover, #zt-chat .zt-chat__file-chip button:hover { background: rgba(15,23,42,.1) !important; }
#zt-chat .zt-chat__error { color: var(--ztc-danger); font-size: 11.5px; padding: 4px 4px 0; }
#zt-chat .zt-chat__error:empty { display: none; }

/* "tag an order" popover + "new chat" results */
#zt-chat .zt-chat__pop { border-radius: 12px; padding: 6px; }
#zt-chat .zt-chat__pop-title { font-size: 11px; font-weight: 700; color: var(--ztc-faint); padding: 6px 8px; text-transform: uppercase; letter-spacing: .3px; }
#zt-chat .zt-chat__pop-item { width: 100%; display: flex !important; align-items: center; gap: 8px; padding: 8px 10px !important; border-radius: 8px !important; text-align: left; font-size: 12px !important; color: var(--ztc-text) !important; background: transparent !important; }
#zt-chat .zt-chat__pop-item b { font-weight: 600; }
#zt-chat .zt-chat__pop-item small { color: var(--ztc-muted); }
#zt-chat .zt-chat__pop-item:hover, #zt-chat .zt-chat__pop-item.is-active { background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__result { width: 100%; display: flex !important; align-items: center; gap: 10px; padding: 8px 10px !important; border-radius: 10px !important; text-align: left; background: transparent !important; font-size: 12.5px !important; color: var(--ztc-text) !important; }
#zt-chat .zt-chat__result:hover { background: var(--ztc-primary-soft) !important; }
#zt-chat .zt-chat__result-name { font-weight: 600; }
#zt-chat .zt-chat__result-mail { font-size: 11px; color: var(--ztc-muted); }

/* visitor / customer side */
#zt-chat .zt-chat__start { padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
#zt-chat .zt-chat__start h4 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ztc-text); }
#zt-chat .zt-chat__start p { margin: 0 0 4px; color: var(--ztc-muted); font-size: 12.5px; line-height: 1.55; }
#zt-chat .zt-chat__field { font-size: 13px !important; background: var(--ztc-surface); color: var(--ztc-text); transition: border-color .15s, box-shadow .15s, background-color .15s; }
#zt-chat .zt-chat__field::placeholder { color: var(--ztc-faint); }
#zt-chat .zt-chat__field:focus { border-color: var(--ztc-primary) !important; background: #fff; box-shadow: var(--ztc-ring); }
#zt-chat .zt-chat__start .zt-chat__btn.is-primary { font-size: 13.5px !important; font-weight: 700 !important; box-shadow: 0 8px 18px rgba(100,85,247,.3); margin-top: 4px; }
#zt-chat .zt-chat__banner { font-size: 12px; padding: 8px 14px; }

/* thin scrollbars */
#zt-chat .zt-chat__list::-webkit-scrollbar, #zt-chat .zt-chat__msgs::-webkit-scrollbar, #zt-chat .zt-chat__results::-webkit-scrollbar, #zt-chat .zt-chat__pop::-webkit-scrollbar { width: 6px; }
#zt-chat .zt-chat__list::-webkit-scrollbar-thumb, #zt-chat .zt-chat__msgs::-webkit-scrollbar-thumb, #zt-chat .zt-chat__results::-webkit-scrollbar-thumb, #zt-chat .zt-chat__pop::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 999px; }
#zt-chat .zt-chat__list::-webkit-scrollbar-track, #zt-chat .zt-chat__msgs::-webkit-scrollbar-track { background: transparent; }
/* back arrow is a phone-only control (the guard forces display:flex on every .zt-chat__ibtn) */
#zt-chat .zt-chat__back { display: none !important; }
@media (max-width: 640px) { #zt-chat .zt-chat__back { display: flex !important; } }
/* filters fit on one line */
#zt-chat .zt-chat__col-list { width: 316px; }
#zt-chat .zt-chat__chips { gap: 5px; }
#zt-chat .zt-chat__chip { height: 25px; padding: 0 9px !important; font-size: 11px !important; }
@media (max-width: 640px) { #zt-chat .zt-chat__col-list { width: 100%; } }
/* the guard's #zt-chat .zt-chat__ibtn{display:flex!important} is printed after this file → out-rank it */
#zt-chat .zt-chat__ibtn.zt-chat__back { display: none !important; }
@media (max-width: 640px) { #zt-chat .zt-chat__ibtn.zt-chat__back { display: flex !important; } }
#zt-chat .zt-chat__bub a.zt-chat__ochip, #zt-chat .zt-chat__bub a.zt-chat__file, #zt-chat .zt-chat__bub a.zt-chat__att { text-decoration: none !important; }

/* v1.13.1 — selected tab gets a filled background instead of an underline */
#zt-chat .zt-chat__tabs { padding: 6px 6px 0; gap: 4px; border-bottom: 1px solid var(--ztc-border); }
#zt-chat .zt-chat__tab { padding: 9px 8px !important; margin-bottom: 6px !important; border: 0 !important; border-radius: 10px !important; background: transparent !important; color: var(--ztc-muted) !important; transition: background .12s, color .12s; }
#zt-chat .zt-chat__tab:hover { background: var(--ztc-surface) !important; color: var(--ztc-text) !important; }
#zt-chat .zt-chat__tab.is-active { background: var(--ztc-primary-soft) !important; color: var(--ztc-primary) !important; box-shadow: inset 0 0 0 1px #C7D2FE; }
#zt-chat .zt-chat__tab.is-active .zt-chat__pill.is-hot { box-shadow: 0 0 0 2px #fff; }

/* =====================================================================
   v1.14 — message polish + phone / tablet / laptop sizes
   ===================================================================== */
/* messages: incoming (customer/visitor) left with avatar, outgoing (any team member) right */
#zt-chat .zt-chat__msgs { padding: 14px 14px 10px; gap: 4px; }
#zt-chat .zt-chat__row { flex-direction: row; align-items: flex-end; gap: 8px; max-width: 84%; }
#zt-chat .zt-chat__row.is-in { align-self: flex-start; }
#zt-chat .zt-chat__row.is-out { align-self: flex-end; flex-direction: row-reverse; }
#zt-chat .zt-chat__row.is-sys { align-self: center; max-width: 92%; margin: 6px 0; }
#zt-chat .zt-chat__row + .zt-chat__row.is-cont { margin-top: -1px; }
#zt-chat .zt-chat__row .zt-chat__who { font-size: 11px; font-weight: 600; color: var(--ztc-muted); margin: 8px 6px 3px; }
#zt-chat .zt-chat__row { flex-wrap: nowrap; }
#zt-chat .zt-chat__bub-wrap { flex: 0 1 auto; }
/* timestamp only under the last bubble of a group (browsers without :has() simply show all of them) */
#zt-chat .zt-chat__row:has(+ .zt-chat__row.is-cont) .zt-chat__meta { display: none; }
#zt-chat .zt-chat__row:has(+ .zt-chat__row.is-cont) .zt-chat__msg-av { margin-bottom: 0; }
#zt-chat .zt-chat__msg-av { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #3730A3; background: linear-gradient(135deg, #DDD6FE, #C7D2FE); overflow: hidden; margin-bottom: 18px; }
#zt-chat .zt-chat__msg-av img { width: 100%; height: 100%; object-fit: cover; }
#zt-chat .zt-chat__msg-av.is-ghost { visibility: hidden; }
#zt-chat .zt-chat__bub-wrap { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
#zt-chat .zt-chat__row.is-out .zt-chat__bub-wrap { align-items: flex-end; }
#zt-chat .zt-chat__bub { border-radius: 18px; border-top-left-radius: 6px; padding: 9px 13px; font-size: 13.5px; line-height: 1.5; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
#zt-chat .zt-chat__row.is-cont.is-in .zt-chat__bub { border-top-left-radius: 18px; border-bottom-left-radius: 6px; }
#zt-chat .zt-chat__row.is-out .zt-chat__bub { border-radius: 18px; border-top-right-radius: 6px; }
#zt-chat .zt-chat__row.is-cont.is-out .zt-chat__bub { border-top-right-radius: 18px; border-bottom-right-radius: 6px; }
#zt-chat .zt-chat__row.is-me .zt-chat__bub { background: linear-gradient(135deg, #6455F7, #5A4EE3); border-color: transparent; color: #fff; }
#zt-chat .zt-chat__row.is-agent .zt-chat__bub { background: #EEF2FF; border-color: #DDE3FF; color: #1E1B4B; }
#zt-chat .zt-chat__row.is-agent .zt-chat__ochip { background: #fff !important; color: var(--ztc-primary) !important; }
#zt-chat .zt-chat__row.is-sys .zt-chat__bub { border-radius: 999px; padding: 5px 12px; font-size: 11.5px; box-shadow: none; background: #EEF2F7; border-color: transparent; color: #475569; }
#zt-chat .zt-chat__meta { font-size: 10.5px; color: var(--ztc-faint); margin: 3px 6px 0; }
#zt-chat .zt-chat__ticks { font-size: 10px; margin-left: 3px; letter-spacing: -1px; }
#zt-chat .zt-chat__ticks.is-seen { color: var(--ztc-primary); }
#zt-chat .zt-chat__ochip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px !important; border-radius: 10px !important; margin: 0 0 6px; font-size: 11.5px !important; font-weight: 500 !important; }
#zt-chat .zt-chat__ochip b { font-weight: 700; }
#zt-chat .zt-chat__ochip span { opacity: .8; }
#zt-chat .zt-chat__ochip svg { width: 13px; height: 13px; }
#zt-chat .zt-chat__row.is-me .zt-chat__ochip { background: rgba(255,255,255,.2) !important; color: #fff !important; }
#zt-chat .zt-chat__day { margin: 10px 0 6px; }
#zt-chat .zt-chat__hint { margin: auto; }
/* composer */
#zt-chat .zt-chat__composer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
#zt-chat .zt-chat__btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* short screens (most laptops): tighter vertical rhythm so the message area stays usable */
@media (max-height: 820px) {
	#zt-chat .zt-chat--team .zt-chat__panel, #zt-chat.zt-chat--team .zt-chat__panel { height: calc(100vh - 100px); bottom: 84px; }
	#zt-chat .zt-chat__head { padding: 9px 14px !important; }
	#zt-chat .zt-chat__tabs { padding: 4px 6px 0; }
	#zt-chat .zt-chat__tab { padding: 7px 8px !important; margin-bottom: 4px !important; }
	#zt-chat .zt-chat__tools { padding: 8px 10px 4px; }
	#zt-chat .zt-chat__search { height: 32px !important; }
	#zt-chat .zt-chat__item { padding: 8px 12px; }
	#zt-chat .zt-chat__thead { padding: 8px 14px; }
	#zt-chat .zt-chat__card-toggle { padding: 4px 14px !important; }
	#zt-chat .zt-chat__card-grid { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 4px 12px; padding-bottom: 8px; }
	#zt-chat .zt-chat__orderbar { padding: 6px 14px; }
}
/* tablets: panel fills the width, thread + list still side by side */
@media (max-width: 900px) and (min-width: 641px) {
	#zt-chat.zt-chat--team .zt-chat__panel { width: calc(100vw - 32px); right: 16px; }
	#zt-chat .zt-chat__col-list { width: 280px; }
	#zt-chat .zt-chat__card-grid { grid-template-columns: 1fr 1fr; }
}
/* phones: full-screen sheet */
@media (max-width: 640px) {
	#zt-chat .zt-chat__panel { border-radius: 0; }
	#zt-chat .zt-chat__head { padding: 10px 12px calc(10px) !important; padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important; }
	#zt-chat .zt-chat__head [data-act="expand"] { display: none !important; }
	#zt-chat .zt-chat__tabs { padding: 4px 4px 0; }
	#zt-chat .zt-chat__tab { padding: 8px 4px !important; font-size: 12px !important; margin-bottom: 4px !important; }
	#zt-chat .zt-chat__thead { padding: 8px 10px; gap: 8px; }
	#zt-chat .zt-chat__thead .zt-chat__av .zt-chat__avatar { width: 36px; height: 36px; font-size: 13px; }
	#zt-chat .zt-chat__thead-name { font-size: 13px; }
	#zt-chat .zt-chat__thead-sub { display: none; }
	#zt-chat .zt-chat__thead-actions { gap: 4px; }
	#zt-chat .zt-chat__btn-txt { display: none; }
	#zt-chat .zt-chat__thead-actions .zt-chat__btn { width: 34px; height: 34px; padding: 0 !important; justify-content: center; border-radius: 10px !important; }
	#zt-chat .zt-chat__thead-actions .zt-chat__btn svg { width: 16px; height: 16px; }
	#zt-chat .zt-chat__thead-actions .zt-chat__btn.is-icon { display: inline-flex; }
	#zt-chat .zt-chat__thead-line { font-size: 11px; }
	#zt-chat .zt-chat__card-toggle { padding: 5px 12px !important; }
	#zt-chat .zt-chat__card-grid { grid-template-columns: 1fr 1fr; padding: 0 12px 8px; }
	#zt-chat .zt-chat__msgs { padding: 12px 10px 8px; }
	#zt-chat .zt-chat__row { max-width: 90%; }
	#zt-chat .zt-chat__bub { font-size: 14px; }
	#zt-chat .zt-chat__composer { padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px)); }
	#zt-chat .zt-chat__ta { font-size: 16px !important; } /* stops iOS zooming into the field */
	#zt-chat .zt-chat__search, #zt-chat .zt-chat__field { font-size: 16px !important; }
	#zt-chat .zt-chat__chips { padding: 0 8px 6px; }
	#zt-chat .zt-chat__list { -webkit-overflow-scrolling: touch; }
}

/* =====================================================================
   v1.15 — polish: red count badges, coloured initials avatars, unread rows
   ===================================================================== */
/* every count badge is red — unread AND waiting both need attention */
#zt-chat .zt-chat__pill.is-warn, #zt-chat .zt-chat__badge.is-waiting { background: var(--ztc-danger); color: #fff; }
#zt-chat .zt-chat__badge { box-shadow: 0 2px 8px rgba(239,68,68,.45); }
#zt-chat .zt-chat__tab.is-active .zt-chat__pill { box-shadow: 0 0 0 2px #fff; }

/* avatars: the coloured initials are painted by the JS (inline style); a real photo sits on top */
#zt-chat .zt-chat__avatar, #zt-chat .zt-chat__msg-av { position: relative; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
#zt-chat .zt-chat__avatar img, #zt-chat .zt-chat__msg-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#zt-chat .zt-chat__item .zt-chat__avatar { width: 40px; height: 40px; font-size: 15px; }
#zt-chat .zt-chat__thead .zt-chat__av .zt-chat__avatar { width: 42px; height: 42px; font-size: 16px; }
#zt-chat .zt-chat__av .zt-chat__avatar .zt-chat__dot { box-shadow: 0 0 0 2px #fff; z-index: 1; }

/* list rows */
#zt-chat .zt-chat__item { padding: 12px 12px 11px; }
#zt-chat .zt-chat__item.has-unread { background: #FCFCFF; }
#zt-chat .zt-chat__item.has-unread .zt-chat__item-name { font-weight: 700; color: var(--ztc-text); }
#zt-chat .zt-chat__item.has-unread .zt-chat__item-time { color: var(--ztc-primary); font-weight: 700; }
#zt-chat .zt-chat__item.has-unread .zt-chat__item-prev { font-weight: 600; }
#zt-chat .zt-chat__item.is-waiting::before { background: var(--ztc-danger); opacity: .55; }
#zt-chat .zt-chat__item.is-active { background: var(--ztc-primary-soft); }
#zt-chat .zt-chat__item-sub { font-size: 11px; }
#zt-chat .zt-chat__item-meta { gap: 5px; }
#zt-chat .zt-chat__tag.is-waiting { background: #FEF3C7; color: #92400E; }
#zt-chat .zt-chat__tag.is-assigned { background: #EEF2FF; color: #4338CA; }

/* header + tabs */
#zt-chat .zt-chat__head { background: linear-gradient(120deg, #6A5CF8 0%, #5B4EE6 55%, #4F46E5 100%); }
#zt-chat .zt-chat__head-avatar { background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
#zt-chat .zt-chat__tabs { background: #fff; }
#zt-chat .zt-chat__tab { gap: 7px; }

/* thread header */
#zt-chat .zt-chat__thead { box-shadow: 0 1px 0 var(--ztc-border); border-bottom: 0; }
#zt-chat .zt-chat__card { box-shadow: 0 1px 0 var(--ztc-border); border-bottom: 0; }
#zt-chat .zt-chat__btn.is-primary { box-shadow: 0 4px 12px rgba(100,85,247,.28); }
#zt-chat .zt-chat__btn.is-danger { color: #B91C1C !important; }
#zt-chat .zt-chat__btn.is-danger:hover { background: #FEF2F2 !important; border-color: #FECACA !important; }

/* composer */
#zt-chat .zt-chat__composer { box-shadow: 0 -1px 0 var(--ztc-border); border-top: 0; }
#zt-chat .zt-chat__ta { background: #F8FAFC; }

/* launcher bubble */
#zt-chat .zt-chat__bubble { box-shadow: 0 10px 26px rgba(100,85,247,.4); }
#zt-chat .zt-chat__bubble:hover { box-shadow: 0 14px 30px rgba(100,85,247,.48); }
