/*!
 * Pixel Office AI 3 — frontend styles.
 * Visual language follows Habblaud (MIT): dark translucent panels floating over a procedural pixel-art office.
 * Every selector is scoped under .poai so Bricks, the theme and other plugins are unaffected.
 * Pixelify Sans (SIL OFL 1.1) is bundled locally; no external requests.
 */

@font-face {
	font-family: 'Poai Pixelify';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/pixelify-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Poai Pixelify';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/pixelify-sans-latin-700-normal.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
.poai {
	--ui-bg: rgba(18, 21, 29, 0.86);
	--ui-bg-solid: #141821;
	--ui-bg-soft: rgba(255, 255, 255, 0.04);
	--ui-bg-hover: rgba(255, 255, 255, 0.07);
	--ui-line: rgba(160, 176, 210, 0.14);
	--ui-line-strong: rgba(160, 176, 210, 0.26);
	--ui-text: #e8ecf5;
	--ui-muted: #a3adc2;
	--ui-faint: #8a93a8;
	--ui-accent: #7cc8ff;
	--ui-accent-soft: rgba(124, 200, 255, 0.14);
	--st-working: #4fd18b;
	--st-waiting: #ffb547;
	--st-task: #3cd8d2;
	--st-chat: #7cc8ff;
	--st-idle: #8b98b3;
	--danger: #ff6b6b;
	--font-px: 'Poai Pixelify', system-ui, sans-serif;
	--font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--radius: 10px;
	--radius-sm: 7px;
	--gap: 10px;
	--side-w: 300px;
	--drawer-w: 380px;
	--poai-h: 760px;

	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	height: var(--poai-h);
	min-height: 520px;
	margin: 0;
	padding: 0;
	color: var(--ui-text);
	background: #1f3324;
	font: 13px/1.45 var(--font-ui);
	text-align: left;
	border-radius: 12px;
	overflow: hidden;
	container-type: inline-size;
	container-name: poai;
	-webkit-font-smoothing: antialiased;
	font-variant-ligatures: no-common-ligatures;
}

.poai,
.poai *,
.poai *::before,
.poai *::after {
	box-sizing: border-box;
}

/* ---------- Scoped resets ---------- */
.poai :where(h1, h2, h3, h4, p, ul, ol, li, dl, dd, dt, figure, fieldset, legend) {
	margin: 0;
	padding: 0;
	border: 0;
	letter-spacing: normal;
	text-transform: none;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
}
.poai :where(ul, ol) { list-style: none; }
.poai :where(img, svg, canvas) { display: block; max-width: none; }
.poai button,
.poai input,
.poai textarea,
.poai select {
	font: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
	min-height: 0;
	width: auto;
	line-height: 1.3;
}
.poai button {
	cursor: pointer;
	background: none;
	border: 0;
	padding: 0;
	text-align: inherit;
	-webkit-appearance: none;
	appearance: none;
}
.poai button:disabled { cursor: not-allowed; opacity: 0.5; }
.poai a { color: var(--ui-accent); text-decoration: underline; }
.poai [hidden] { display: none !important; }

.poai :focus { outline: none; }
.poai :focus-visible {
	outline: 2px solid var(--ui-accent) !important;
	outline-offset: 2px;
}

.poai .poai-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

.poai .poai-boot {
	flex: 1;
	display: grid;
	place-items: center;
	min-height: 320px;
	color: var(--ui-muted);
	font-family: var(--font-px);
	font-size: 16px;
}

.poai .poai-px-title {
	font-family: var(--font-px);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--ui-text);
}

/* ---------- Generic controls ---------- */
.poai .poai-panel-box {
	background: var(--ui-bg);
	border: 1px solid var(--ui-line);
	border-radius: var(--radius);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.poai .poai-ibtn {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 34px;
	height: 34px;
	border-radius: var(--radius-sm);
	color: var(--ui-muted);
	font-size: 18px;
	line-height: 1;
}
.poai .poai-ibtn:hover { background: var(--ui-bg-hover); color: var(--ui-text); }
.poai .poai-ibtn--sm { width: 28px; height: 28px; font-size: 15px; }

.poai .poai-tbtn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 34px;
	padding: 6px 12px;
	border: 1px solid var(--ui-line-strong);
	border-radius: var(--radius-sm);
	background: var(--ui-bg-soft);
	color: var(--ui-text);
	font-weight: 600;
	white-space: nowrap;
}
.poai .poai-tbtn:hover:not(:disabled) { background: var(--ui-bg-hover); border-color: var(--ui-accent); }
.poai .poai-tbtn--accent { background: var(--ui-accent); border-color: var(--ui-accent); color: #0c1420; }
.poai .poai-tbtn--accent:hover:not(:disabled) { background: #a6dbff; color: #0c1420; }
.poai .poai-tbtn--sm { min-height: 28px; padding: 4px 9px; font-size: 12px; }
.poai .poai-tbtn[aria-pressed="false"] { color: var(--ui-muted); }

.poai .poai-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 34px;
	padding: 6px 14px;
	border: 1px solid var(--ui-line-strong);
	border-radius: var(--radius-sm);
	background: var(--ui-bg-soft);
	color: var(--ui-text);
	font-weight: 600;
	white-space: nowrap;
	text-decoration: none;
}
.poai .poai-btn:hover:not(:disabled) { background: var(--ui-bg-hover); }
.poai .poai-btn--primary { background: var(--st-working); border-color: var(--st-working); color: #0b1a12; }
.poai .poai-btn--primary:hover:not(:disabled) { background: #74e0a6; }
.poai .poai-btn--danger { background: var(--danger); border-color: var(--danger); color: #1c0a0a; }
.poai .poai-btn--danger:hover:not(:disabled) { background: #ff8f8f; }
.poai .poai-btn--sm { min-height: 28px; padding: 4px 10px; font-size: 12px; }

.poai .poai-badge {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
	background: var(--ui-bg-hover);
	color: var(--ui-muted);
	border: 1px solid var(--ui-line);
}
.poai .poai-badge--live { background: rgba(79, 209, 139, 0.16); color: var(--st-working); border-color: rgba(79, 209, 139, 0.4); }
.poai .poai-badge--demo { background: rgba(255, 181, 71, 0.16); color: var(--st-waiting); border-color: rgba(255, 181, 71, 0.4); }
.poai .poai-badge--queued { color: var(--ui-muted); }
.poai .poai-badge--working,
.poai .poai-badge--in_progress { background: rgba(60, 216, 210, 0.15); color: var(--st-task); border-color: rgba(60, 216, 210, 0.4); }
.poai .poai-badge--done,
.poai .poai-badge--review { background: var(--ui-accent-soft); color: var(--ui-accent); border-color: rgba(124, 200, 255, 0.4); }
.poai .poai-badge--summarized { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.4); }
.poai .poai-badge--approved { background: rgba(79, 209, 139, 0.16); color: var(--st-working); border-color: rgba(79, 209, 139, 0.4); }
.poai .poai-badge--error { background: rgba(255, 107, 107, 0.16); color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }

.poai .poai-input,
.poai .poai-textarea,
.poai .poai-select,
.poai .poai-search {
	display: block;
	width: 100%;
	padding: 8px 10px;
	background: rgba(0, 0, 0, 0.25);
	color: var(--ui-text);
	border: 1px solid var(--ui-line-strong);
	border-radius: var(--radius-sm);
	font-size: 14px;
}
.poai .poai-input::placeholder,
.poai .poai-textarea::placeholder,
.poai .poai-search::placeholder { color: var(--ui-faint); }
.poai .poai-textarea { resize: vertical; min-height: 44px; }
.poai .poai-label { display: block; margin-bottom: 5px; font-weight: 700; font-size: 12px; color: var(--ui-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.poai .poai-help { font-size: 13px; color: var(--ui-muted); margin-top: 4px; }
.poai .poai-form-error { color: var(--danger); font-weight: 600; font-size: 13px; }
.poai .poai-check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.poai .poai-check input,
.poai .poai-pick input { width: 16px; height: 16px; accent-color: var(--st-working); }

/* ---------- Status dots (square, "pixel") ---------- */
.poai .poai-dot {
	flex: none;
	width: 9px;
	height: 9px;
	background: var(--st-idle);
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.poai .poai-st--work { --st: var(--st-working); }
.poai .poai-st--reply,
.poai .poai-st--chat { --st: var(--st-chat); }
.poai .poai-st--task { --st: var(--st-task); }
.poai .poai-st--waiting { --st: var(--st-waiting); }
.poai .poai-st--idle { --st: var(--st-idle); }
.poai .poai-dot.poai-st--work,
.poai .poai-dot.poai-st--reply,
.poai .poai-dot.poai-st--chat,
.poai .poai-dot.poai-st--task,
.poai .poai-dot.poai-st--waiting,
.poai .poai-dot.poai-st--idle { background: var(--st); }
.poai .poai-dot.poai-st--waiting,
.poai .poai-dot.poai-st--reply { animation: poai-blink 1s steps(2) infinite; }

/* ---------- Portraits ---------- */
.poai .poai-av {
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	flex: none;
	overflow: hidden;
	background: linear-gradient(#2a3242, #1b212d);
	border: 1px solid var(--ui-line);
	border-radius: var(--radius-sm);
}
.poai .poai-av img,
.poai .poai-av svg {
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	max-width: none;
}
.poai .poai-av--xs { width: 20px; height: 20px; border-radius: 4px; }
.poai .poai-av--xs img { width: 28px; height: auto; margin-bottom: -10px; }
.poai .poai-av--sm { width: 36px; height: 36px; }
.poai .poai-av--sm img { width: auto; height: 50px; margin-bottom: -14px; }
.poai .poai-av--md { width: 44px; height: 44px; }
.poai .poai-av--md img { width: auto; height: 60px; margin-bottom: -16px; }
.poai .poai-av--lg { width: 64px; height: 64px; border-radius: var(--radius); }
.poai .poai-av--lg img { width: auto; height: 96px; margin-bottom: -26px; }
.poai .poai-av svg { width: 70%; height: auto; }
.poai .poai-av--sys { background: var(--ui-accent-soft); }

/* ---------- Top bar ---------- */
.poai .poai-top {
	position: relative;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	padding: 10px 14px;
	background: var(--ui-bg-solid);
	border-bottom: 1px solid var(--ui-line);
}
.poai .poai-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.poai .poai-brand__logo {
	width: 30px;
	height: 30px;
	flex: none;
	border-radius: 6px;
	background:
		linear-gradient(#f6c453, #f6c453) 8px 6px / 4px 4px no-repeat,
		linear-gradient(#f6c453, #f6c453) 18px 6px / 4px 4px no-repeat,
		linear-gradient(#f6c453, #f6c453) 8px 14px / 4px 4px no-repeat,
		linear-gradient(#f6c453, #f6c453) 18px 14px / 4px 4px no-repeat,
		linear-gradient(#3a2a1c, #3a2a1c) 12px 21px / 6px 9px no-repeat,
		linear-gradient(#e2694b 0 5px, #c9573c 5px);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.poai .poai-brand__text { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.poai .poai-brand__name {
	font-family: var(--font-px);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.1;
	color: #fff;
	overflow-wrap: anywhere;
}

.poai .poai-stats {
	display: flex;
	align-items: stretch;
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid var(--ui-line);
	border-radius: var(--radius);
	background: var(--ui-bg-soft);
	overflow: hidden;
}
.poai .poai-stat {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 4px 12px;
	border-right: 1px solid var(--ui-line);
	min-width: 0;
}
.poai .poai-stat:last-child { border-right: 0; }
.poai .poai-stat__num { font-size: 18px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.poai .poai-stat__label { font-size: 11px; color: var(--ui-faint); white-space: nowrap; }
.poai .poai-stat--working .poai-stat__num { color: var(--st-working); }
.poai .poai-stat--waiting.is-alert { background: rgba(255, 181, 71, 0.12); }
.poai .poai-stat--waiting.is-alert .poai-stat__num { color: var(--st-waiting); }

.poai .poai-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.poai .poai-controls__sep { width: 1px; height: 24px; background: var(--ui-line); margin: 0 4px; }
.poai .poai-only-narrow { display: none; }

.poai .poai-notice {
	position: relative;
	z-index: 4;
	padding: 6px 14px;
	background: rgba(255, 181, 71, 0.14);
	color: #ffd79a;
	border-bottom: 1px solid rgba(255, 181, 71, 0.3);
	font-size: 13px;
}
.poai .poai-notice a { color: #ffe2b0; }

/* ---------- Stage ---------- */
.poai .poai-stage {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	background: #1f3324;
}
.poai .poai-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	cursor: grab;
}
.poai .poai-canvas:active { cursor: grabbing; }
.poai .poai-noworld {
	position: absolute;
	left: 50%;
	top: 40%;
	transform: translate(-50%, -50%);
	max-width: 360px;
	padding: 14px 16px;
	text-align: center;
	color: var(--ui-muted);
	background: var(--ui-bg);
	border: 1px solid var(--ui-line);
	border-radius: var(--radius);
}
.poai .poai-hint {
	position: absolute;
	left: 50%;
	top: 14px;
	z-index: 6;
	transform: translateX(-50%);
	padding: 6px 12px;
	background: var(--ui-bg-solid);
	border: 1px solid var(--ui-line-strong);
	border-radius: 999px;
	font-size: 12px;
	color: var(--ui-text);
	pointer-events: none;
}

/* ---------- Sidebar ---------- */
.poai .poai-side {
	position: absolute;
	z-index: 3;
	top: var(--gap);
	left: var(--gap);
	bottom: var(--gap);
	width: var(--side-w);
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
	overflow: hidden;
}
.poai .poai-side__head { display: flex; align-items: center; justify-content: space-between; }
.poai .poai-search-wrap { position: relative; display: block; }
.poai .poai-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ui-faint); font-size: 15px; }
.poai .poai-search { padding-left: 30px; }
.poai .poai-side__list {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0 -4px;
	padding: 0 4px 4px;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--ui-line-strong) transparent;
}
.poai .poai-side__empty { color: var(--ui-muted); padding: 8px; }

.poai .poai-room {
	border: 1px solid var(--ui-line);
	border-left: 3px solid var(--room, var(--ui-accent));
	border-radius: var(--radius-sm);
	background: var(--ui-bg-soft);
	padding: 4px;
}
.poai .poai-room--creative { --room: #c084fc; }
.poai .poai-room--brand { --room: #fb7185; }
.poai .poai-room--ux { --room: #34d399; }
.poai .poai-room--web { --room: #60a5fa; }
.poai .poai-room--design { --room: #7cc8ff; }
.poai .poai-room__head {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 6px 8px;
	border-radius: 5px;
}
.poai .poai-room__head:hover { background: var(--ui-bg-hover); }
.poai .poai-room__name { font-weight: 700; font-size: 14px; }
.poai .poai-room__count {
	padding: 0 6px;
	border-radius: 999px;
	background: var(--ui-bg-hover);
	color: var(--ui-muted);
	font-size: 11px;
	font-weight: 700;
}
.poai .poai-room__meta { margin-left: auto; font-size: 11px; color: var(--ui-faint); }

.poai .poai-row {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 6px 8px;
	border-radius: 6px;
	border: 1px solid transparent;
}
.poai .poai-row:hover { background: var(--ui-bg-hover); }
.poai .poai-row.is-active { background: var(--ui-accent-soft); border-color: rgba(124, 200, 255, 0.35); }
.poai .poai-row__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.poai .poai-row__top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.poai .poai-row__name { font-weight: 700; font-size: 14px; white-space: nowrap; }
.poai .poai-row__role { color: var(--ui-faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poai .poai-row__act { display: flex; gap: 5px; align-items: center; min-width: 0; color: var(--ui-muted); font-size: 12px; }
.poai .poai-row__icon { flex: none; }
.poai .poai-row__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Activity feed ---------- */
.poai .poai-feed {
	position: absolute;
	z-index: 2;
	left: calc(var(--side-w) + var(--gap) * 2);
	right: var(--gap);
	bottom: var(--gap);
	max-width: 760px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	max-height: 190px;
	overflow: hidden;
}
.poai .poai-stage.has-drawer .poai-feed { right: calc(var(--drawer-w) + var(--gap) * 2); }
.poai .poai-feed__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; }
.poai .poai-feed__list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--ui-line-strong) transparent; }
.poai .poai-feed.is-collapsed .poai-feed__list { display: none; }
.poai .poai-feed__row {
	display: grid;
	grid-template-columns: 64px 20px minmax(70px, 110px) minmax(0, 130px) minmax(0, 1fr);
	align-items: center;
	gap: 8px;
	padding: 3px 6px;
	border-radius: 5px;
	font-size: 12px;
}
.poai .poai-feed__row:hover { background: var(--ui-bg-soft); }
.poai .poai-feed__time { color: var(--ui-faint); font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.poai .poai-feed__who { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poai .poai-feed__room { color: var(--ui-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poai .poai-feed__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Designer drawer ---------- */
.poai .poai-panel {
	position: absolute;
	z-index: 4;
	top: var(--gap);
	right: var(--gap);
	bottom: var(--gap);
	width: var(--drawer-w);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--ui-bg-solid);
}
.poai .poai-panel__head { padding: 10px 14px 12px; border-bottom: 1px solid var(--ui-line); display: grid; gap: 10px; }
.poai .poai-panel__top { display: flex; align-items: center; justify-content: space-between; color: var(--ui-muted); }
.poai .poai-panel__id { display: flex; gap: 12px; align-items: center; }
.poai .poai-panel__who { min-width: 0; display: grid; gap: 2px; }
.poai .poai-panel__name { font-size: 20px; font-weight: 700; line-height: 1.15; color: #fff; overflow-wrap: anywhere; }
.poai .poai-panel__role { color: var(--ui-muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.poai .poai-panel__room { color: var(--ui-accent); font-weight: 600; }
.poai .poai-panel__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.poai .poai-status-line {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	font-weight: 600;
	color: var(--st, var(--ui-muted));
}
.poai .poai-status-line::before {
	content: "";
	width: 9px;
	height: 9px;
	background: var(--st, var(--st-idle));
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.poai .poai-profile {
	padding: 10px 14px;
	border-bottom: 1px solid var(--ui-line);
	background: var(--ui-bg-soft);
	display: grid;
	gap: 4px;
	font-size: 13px;
	max-height: 40%;
	overflow-y: auto;
}
.poai .poai-profile dt { font-size: 11px; font-weight: 700; color: var(--ui-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.poai .poai-profile dd { margin: 0 0 6px; }

.poai .poai-log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--ui-line-strong) transparent;
}
.poai .poai-msg {
	position: relative;
	max-width: 92%;
	padding: 8px 11px;
	border-radius: 10px;
	font-size: 14px;
	line-height: 1.5;
	border: 1px solid var(--ui-line);
}
.poai .poai-msg__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; font-size: 12px; font-weight: 700; color: var(--ui-muted); }
.poai .poai-msg__body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.poai .poai-msg--assistant { align-self: flex-start; background: rgba(255, 255, 255, 0.05); border-top-left-radius: 3px; }
.poai .poai-msg--welcome { background: var(--ui-accent-soft); border-color: rgba(124, 200, 255, 0.25); }
.poai .poai-msg--user { align-self: flex-end; background: #2b3b5c; border-color: #3a4f7a; border-top-right-radius: 3px; }
.poai .poai-msg--user .poai-msg__meta { color: #b9c8ea; }
.poai .poai-msg--user.is-failed { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.35); }
.poai .poai-msg--error { align-self: stretch; max-width: none; background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.35); }
.poai .poai-msg--error .poai-btn { margin-top: 6px; }
.poai .poai-msg__note { margin-top: 6px; font-size: 12px; font-style: italic; color: var(--ui-muted); }

.poai .poai-typing {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 11px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--ui-line);
	font-size: 13px;
	color: var(--ui-muted);
}
.poai .poai-typing__dots { display: inline-flex; gap: 3px; }
.poai .poai-typing__dots span { width: 5px; height: 5px; background: var(--ui-muted); animation: poai-dot 1s steps(2) infinite; }
.poai .poai-typing__dots span:nth-child(2) { animation-delay: 0.2s; }
.poai .poai-typing__dots span:nth-child(3) { animation-delay: 0.4s; }

.poai .poai-starters { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.poai .poai-starters__label { font-size: 11px; font-weight: 700; color: var(--ui-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.poai .poai-chip {
	padding: 6px 10px;
	border-radius: 999px;
	border: 1px solid var(--ui-line-strong);
	background: var(--ui-bg-soft);
	font-size: 13px;
	text-align: left;
	line-height: 1.35;
}
.poai .poai-chip:hover { border-color: var(--ui-accent); background: var(--ui-accent-soft); }

.poai .poai-composer { padding: 10px 14px 12px; border-top: 1px solid var(--ui-line); background: rgba(0, 0, 0, 0.15); }
.poai .poai-composer__row { display: flex; gap: 8px; align-items: flex-end; }
.poai .poai-composer .poai-textarea { min-height: 44px; max-height: 160px; resize: none; }
.poai .poai-composer__meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--ui-faint); }
.poai .poai-composer__meta .is-over { color: var(--danger); font-weight: 700; }

.poai .poai-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 24px; text-align: center; color: var(--ui-muted); }
.poai .poai-empty__title { font-family: var(--font-px); font-size: 18px; color: var(--ui-text); }

/* ---------- Dialogs (tasks, confirmations) ---------- */
.poai dialog {
	color: var(--ui-text);
	font: 13px/1.45 var(--font-ui);
	padding: 0;
	margin: auto;
	border: 1px solid var(--ui-line-strong);
	border-radius: 12px;
	background: var(--ui-bg-solid);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
	max-width: min(560px, calc(100vw - 24px));
	width: 100%;
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	overflow: auto;
}
.poai dialog::backdrop { background: rgba(6, 8, 12, 0.6); }
.poai .poai-dialog__head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 14px;
	background: var(--ui-bg-solid);
	border-bottom: 1px solid var(--ui-line);
}
.poai .poai-dialog__title { font-family: var(--font-px); font-size: 17px; font-weight: 700; }
.poai .poai-dialog__head .poai-btn { min-height: 28px; padding: 2px 9px; }
.poai .poai-dialog__body { padding: 14px; display: grid; gap: 12px; }
.poai .poai-dialog__foot {
	position: sticky;
	bottom: 0;
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	flex-wrap: wrap;
	padding: 12px 14px;
	background: var(--ui-bg-solid);
	border-top: 1px solid var(--ui-line);
}
.poai dialog.poai-drawer {
	margin: 0 0 0 auto;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	max-width: min(460px, 100vw);
	border-radius: 0;
	border-width: 0 0 0 1px;
}

.poai .poai-pick {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 4px;
	max-height: 240px;
	overflow-y: auto;
	padding: 6px;
	border: 1px solid var(--ui-line-strong);
	border-radius: var(--radius-sm);
	background: rgba(0, 0, 0, 0.2);
}
.poai .poai-pick label { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.poai .poai-pick label:hover { background: var(--ui-bg-hover); }

.poai .poai-tasks { display: grid; gap: 12px; }
.poai .poai-task { border: 1px solid var(--ui-line); border-radius: var(--radius); background: var(--ui-bg-soft); overflow: hidden; }
.poai .poai-task__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 9px 12px; border-bottom: 1px solid var(--ui-line); }
.poai .poai-task__title { font-weight: 700; flex: 1 1 160px; overflow-wrap: anywhere; font-size: 14px; }
.poai .poai-task__body { padding: 10px 12px; display: grid; gap: 10px; }
.poai .poai-task__brief { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ui-muted); }
.poai .poai-task__resp { border-left: 3px solid var(--ui-line-strong); padding-left: 9px; }
.poai .poai-task__resp.is-summary { border-left-color: #a78bfa; background: rgba(167, 139, 250, 0.08); padding: 8px 10px; border-radius: 0 6px 6px 0; }
.poai .poai-task__resp-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.poai .poai-task__resp-body { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.poai .poai-task__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.poai .poai-task__approval { font-size: 12px; background: rgba(79, 209, 139, 0.1); border: 1px solid rgba(79, 209, 139, 0.35); border-radius: 6px; padding: 6px 9px; color: #b8f0d0; }

/* ---------- Animation ---------- */
@keyframes poai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes poai-dot { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.poai[data-motion="off"] *,
.poai[data-motion="off"] *::before,
.poai[data-motion="off"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
	.poai:not([data-motion="on"]) *,
	.poai:not([data-motion="on"]) *::before,
	.poai:not([data-motion="on"]) *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive (by container width) ---------- */
@container poai (max-width: 1180px) {
	.poai .poai-stat { padding: 4px 9px; }
	.poai .poai-stat__num { font-size: 16px; }
	.poai .poai-stage { --side-w: 270px; --drawer-w: 350px; }
}

/* Narrow: sidebar and drawer become overlays, feed spans the width */
@container poai (max-width: 899px) {
	.poai .poai-only-narrow { display: inline-grid; }
	.poai .poai-stats { order: 3; flex-basis: 100%; overflow-x: auto; }
	.poai .poai-controls { margin-left: auto; }
	.poai .poai-side {
		z-index: 6;
		width: min(340px, calc(100% - 20px));
		transform: translateX(calc(-100% - 20px));
		visibility: hidden;
		transition: transform 160ms ease, visibility 0s linear 160ms;
		background: var(--ui-bg-solid);
	}
	.poai .poai-side.is-open { transform: none; visibility: visible; transition: transform 160ms ease; }
	.poai .poai-feed,
	.poai .poai-stage.has-drawer .poai-feed { left: var(--gap); right: var(--gap); max-height: 150px; }
	.poai .poai-feed__row { grid-template-columns: 58px 20px minmax(60px, 100px) minmax(0, 1fr); }
	.poai .poai-feed__room { display: none; }
	.poai .poai-panel { z-index: 7; left: var(--gap); width: auto; }
}

@container poai (max-width: 560px) {
	.poai .poai-top { gap: 8px; padding: 8px 10px; }
	.poai .poai-brand__name { font-size: 17px; }
	.poai .poai-controls__sep { display: none; }
	.poai .poai-panel { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; }
	.poai .poai-stat__label { font-size: 10px; }
}

@media (max-width: 720px) {
	.poai { height: min(var(--poai-h), calc(100svh - var(--poai-top, 0px) - 40px)); min-height: 480px; border-radius: 8px; }
}

@media (forced-colors: active) {
	.poai .poai-dot, .poai .poai-status-line::before { forced-color-adjust: none; }
	.poai .poai-tbtn, .poai .poai-btn, .poai .poai-row { border: 1px solid CanvasText; }
}

@container poai (max-width: 560px) {
	.poai .poai-tbtn { min-height: 30px; padding: 4px 9px; font-size: 12px; }
	.poai .poai-ibtn { width: 30px; height: 30px; }
	.poai .poai-stat { padding: 3px 8px; }
	.poai .poai-stat__num { font-size: 15px; }
}

.poai .poai-you {
	display: inline-block;
	margin-left: 6px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--st-waiting);
	color: #1a1204;
	font-size: 10px;
	font-weight: 800;
	line-height: 1.6;
	vertical-align: middle;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

/* ---------- 3D / VR view ---------- */
.poai .poai-stage3d { position: absolute; inset: 0; background: #9fd3f5; }
.poai .poai-3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.poai .poai-3d-canvas:active { cursor: grabbing; }

/* ---------- Meetings ---------- */
.poai .poai-st--meet { --st: #a78bfa; }
.poai .poai-st--speak { --st: #f472b6; }
.poai .poai-dot.poai-st--meet,
.poai .poai-dot.poai-st--speak { background: var(--st); }
.poai .poai-dot.poai-st--speak { animation: poai-blink 0.8s steps(2) infinite; }
.poai .poai-badge--meeting { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.4); }
.poai .poai-meet-sel { display: flex; gap: 6px; margin-bottom: 6px; }
