/* Phoenix — Nucleus chat surface
 *
 * Loaded via /static/custom.css, which app.html links after the app bundle.
 * Base stylesheet generated on Mason (local Qwen3-Coder), then corrected and
 * extended by hand. Overrides land on Tailwind utilities, hence !important.
 *
 * Ported into source from the live overlay (custom.css sha256 fb901c31...).
 * External same-origin stylesheet: allowed by the shell CSP (style-src 'self').
 * The health-dot (.px-dot), capabilities (.px-caps*, .px-cap-*) and switch
 * (.px-switch) rules style features that loader.js holds for later; they are
 * inert until those features are added back to loader.js.
 */

/* ---------------------------------------------------------------- palette */
:root {
	--px-fg: #1f2937;
	--px-fg-muted: #6b7280;
	--px-line: #d1d5db;
	--px-surface: #f9fafb;
	--px-surface-hi: #e5e7eb;
	--px-accent: #3b82f6;
	--px-ok: #22c55e;
	--px-warn: #f59e0b;
	--px-down: #ef4444;
}

/* Open WebUI always stamps a theme class on <html> (dark, light, oled-dark,
   her), so "anything that is not explicitly light" is the dark branch. */
html.dark,
html:not(.light) {
	--px-fg: #e5e7eb;
	--px-fg-muted: #9ca3af;
	--px-line: #2b3140;
	--px-surface: #14161b;
	--px-surface-hi: #1f2430;
}

/* ------------------------------------------------------ model picker rows */
button[role='option'][data-value] {
	height: auto !important;
	min-height: 2.75rem !important;
	padding: 0.375rem 0.5rem !important;
	align-items: center !important;
}
button[role='option'][data-value] > div.flex-1 {
	display: flex;
	flex-direction: column;
	gap: 1px !important;
}
button[role='option'][data-value] .px-desc {
	display: block !important;
	font-size: 11.5px !important;
	line-height: 1.35 !important;
	color: var(--px-fg-muted) !important;
	margin-top: 1px !important;
	/* Indent past the avatar (size-4) plus the gap-2 that follows it, so the
     description hangs under the model name the way Claude's picker reads. */
	padding-inline-start: 1.5rem !important;
	white-space: nowrap !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	max-width: 100% !important;
}
body.px-compact button[role='option'][data-value] .px-desc {
	display: none !important;
}

/* ------------------------------------------------------------- health dot */
.px-dot {
	display: inline-block !important;
	width: 6px !important;
	height: 6px !important;
	border-radius: 999px !important;
	flex-shrink: 0 !important;
	margin-inline-end: 2px !important;
	position: relative !important;
	top: -1px !important;
}
.px-dot.is-ok {
	background: var(--px-ok) !important;
}
.px-dot.is-down {
	background: var(--px-down) !important;
	box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18) !important;
}
.px-dot.is-unknown {
	background: var(--px-fg-muted) !important;
	opacity: 0.5 !important;
}
.px-dot.is-checking {
	background: var(--px-warn) !important;
	animation: px-pulse 1.2s infinite alternate !important;
}
@keyframes px-pulse {
	0% {
		opacity: 0.35;
	}
	100% {
		opacity: 1;
	}
}
.px-trigger-dot {
	margin-inline-end: 5px !important;
}

/* ------------------------------------------------ capabilities directory */
.px-caps-overlay {
	position: fixed !important;
	inset: 0 !important;
	z-index: 9999 !important;
	display: grid !important;
	place-items: center !important;
	padding: 24px !important;
	background: rgba(8, 9, 12, 0.55) !important;
	backdrop-filter: blur(2px);
}
.px-caps {
	width: min(760px, 100%);
	max-height: 80vh;
	overflow-y: auto;
	background: var(--px-surface) !important;
	border: 1px solid var(--px-line) !important;
	border-radius: 16px !important;
	padding: 18px !important;
}
.px-caps-head {
	display: flex !important;
	flex-direction: row !important;
	justify-content: space-between !important;
	align-items: center !important;
	padding: 0 0 10px 0 !important;
	border-bottom: 1px solid var(--px-line) !important;
	margin-bottom: 12px !important;
}
.px-caps-title {
	font-size: 14px !important;
	font-weight: 600 !important;
	color: var(--px-fg) !important;
	letter-spacing: -0.01em !important;
}
.px-caps-sub {
	font-size: 12px !important;
	color: var(--px-fg-muted) !important;
	margin-top: 2px !important;
}
.px-caps-close {
	background: none !important;
	border: 0 !important;
	color: var(--px-fg-muted) !important;
	font-size: 20px !important;
	line-height: 1 !important;
	padding: 2px 7px !important;
	border-radius: 8px !important;
	cursor: pointer !important;
}
.px-caps-close:hover {
	color: var(--px-fg) !important;
	background: var(--px-surface-hi) !important;
}
.px-caps-grid {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
	gap: 10px !important;
}
.px-caps-empty {
	grid-column: 1 / -1;
	font-size: 12px !important;
	color: var(--px-fg-muted) !important;
	text-align: center !important;
	padding: 20px !important;
	border: 1px dashed var(--px-line) !important;
	border-radius: 12px !important;
}
.px-cap-card {
	border: 1px solid var(--px-line) !important;
	border-radius: 12px !important;
	padding: 12px !important;
	background: var(--px-surface) !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 8px !important;
	transition: border-color 120ms ease !important;
}
.px-cap-card:hover {
	border-color: var(--px-fg-muted) !important;
}
.px-cap-top {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	gap: 8px !important;
}
.px-cap-icon {
	width: 26px !important;
	height: 26px !important;
	border-radius: 8px !important;
	flex: none !important;
	display: grid !important;
	place-items: center !important;
	background: var(--px-surface-hi) !important;
	color: var(--px-fg) !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	text-transform: uppercase !important;
}
.px-cap-name {
	font-size: 13px !important;
	font-weight: 600 !important;
	color: var(--px-fg) !important;
	flex: 1 !important;
	min-width: 0 !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	white-space: nowrap !important;
}
.px-cap-desc {
	font-size: 12px !important;
	line-height: 1.45 !important;
	color: var(--px-fg-muted) !important;
	margin: 0 !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 3 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
}
.px-cap-foot {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: space-between !important;
	margin-top: auto !important;
	padding-top: 4px !important;
}
.px-cap-meta {
	font-size: 11px !important;
	color: var(--px-fg-muted) !important;
}
.px-cap-card.is-on {
	border-color: color-mix(in srgb, var(--px-accent) 45%, var(--px-line)) !important;
}

/* Composer launcher for the directory. */
.px-caps-launcher {
	width: 1.875rem !important;
	height: 1.875rem !important;
	border-radius: 999px !important;
	border: 0 !important;
	background: transparent !important;
	color: inherit !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex: none !important;
	cursor: pointer !important;
	padding: 0 !important;
}
.px-caps-launcher:hover {
	background: var(--px-surface-hi) !important;
}
.px-caps-launcher svg {
	width: 17px !important;
	height: 17px !important;
}

/* ---------------------------------------------------------- toggle switch */
.px-switch {
	width: 32px !important;
	height: 18px !important;
	border-radius: 999px !important;
	border: 1px solid var(--px-line) !important;
	background: var(--px-surface-hi) !important;
	position: relative !important;
	cursor: pointer !important;
	padding: 0 !important;
	flex: none !important;
	transition: background 120ms ease !important;
}
.px-switch::after {
	content: '' !important;
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	left: 2px !important;
	width: 12px !important;
	height: 12px !important;
	border-radius: 999px !important;
	background: var(--px-fg-muted) !important;
	transition:
		left 120ms ease,
		background 120ms ease !important;
}
.px-switch[aria-checked='true'] {
	background: var(--px-accent) !important;
	border-color: transparent !important;
}
.px-switch[aria-checked='true']::after {
	left: 16px !important;
	background: #fff !important;
}
.px-switch:disabled {
	opacity: 0.5 !important;
	cursor: not-allowed !important;
}
.px-switch:focus-visible {
	outline: 2px solid var(--px-accent) !important;
	outline-offset: 2px !important;
}

/* ------------------------------------------------------- sign in providers */
.px-auth-providers {
	display: flex !important;
	flex-direction: column !important;
	gap: 8px !important;
	width: 100% !important;
	margin-top: 4px !important;
}
.px-auth-divider {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	gap: 12px !important;
	color: var(--px-fg-muted) !important;
	font-size: 12px !important;
	margin: 16px 0 6px !important;
}
.px-auth-divider::before,
.px-auth-divider::after {
	content: '' !important;
	flex: 1 !important;
	height: 1px !important;
	background: var(--px-line) !important;
}
.px-auth-btn {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 10px !important;
	width: 100% !important;
	border-radius: 999px !important;
	border: 1px solid var(--px-line) !important;
	background: var(--px-surface) !important;
	color: var(--px-fg) !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	padding: 10px 16px !important;
	cursor: pointer !important;
	transition:
		background 120ms ease,
		border-color 120ms ease !important;
}
.px-auth-btn:hover:not([disabled]) {
	background: var(--px-surface-hi) !important;
}
.px-auth-btn svg {
	width: 18px !important;
	height: 18px !important;
	flex: none !important;
}
.px-auth-btn[disabled] {
	cursor: not-allowed !important;
	opacity: 0.55 !important;
}
.px-auth-note {
	font-size: 11px !important;
	color: var(--px-fg-muted) !important;
	text-align: center !important;
	margin-top: 8px !important;
	line-height: 1.4 !important;
}
.px-auth-btn .px-auth-pending {
	font-size: 10px !important;
	text-transform: uppercase !important;
	letter-spacing: 0.06em !important;
	border: 1px solid var(--px-line) !important;
	border-radius: 999px !important;
	padding: 1px 6px !important;
	color: var(--px-fg-muted) !important;
	margin-inline-start: 4px !important;
}

/* ------------------------------------------------------- flat chat surface */
#message-input-container,
#chat-input-container {
	box-shadow: none !important;
}
#message-input-container {
	border: 1px solid var(--px-line) !important;
	border-radius: 20px !important;
}
#message-input-container .shadow-lg,
#message-input-container .shadow-xl,
#message-input-container .drop-shadow-lg {
	box-shadow: none !important;
}
[role='listbox'] {
	box-shadow: none !important;
}
/* The visible dropdown card is the ancestor that owns the listbox. */
div.z-40:has([role='listbox']) {
	box-shadow: none !important;
	border: 1px solid var(--px-line) !important;
	border-radius: 14px !important;
}
.px-caps-grid::-webkit-scrollbar,
.px-caps::-webkit-scrollbar,
[role='listbox']::-webkit-scrollbar {
	width: 8px !important;
}
.px-caps-grid::-webkit-scrollbar-thumb,
.px-caps::-webkit-scrollbar-thumb,
[role='listbox']::-webkit-scrollbar-thumb {
	background: var(--px-line) !important;
	border-radius: 999px !important;
}
.px-caps-grid::-webkit-scrollbar-track,
.px-caps::-webkit-scrollbar-track,
[role='listbox']::-webkit-scrollbar-track {
	background: transparent !important;
}

/* ---------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
	.px-dot.is-checking {
		animation: none !important;
	}
	.px-cap-card,
	.px-switch,
	.px-switch::after,
	.px-auth-btn {
		transition-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------ hero: just Phoenix
   The new-chat hero shows the selected model name + OI fallback icon. Hide
   the model name (dropdown keeps real names) and stamp Phoenix instead.   */
.justify-center.w-fit.px-5.max-w-xl .text-2xl {
	display: none !important;
}
.justify-center.w-fit.px-5.max-w-xl::after {
	content: 'Phoenix';
	font-size: 1.5rem;
	line-height: 2rem;
	font-weight: 500;
	color: var(--px-fg, inherit);
	display: flex;
	align-items: center;
}

/* ------------------------------------------------------ hero: no subtitle
   Rob 2026-08-15: remove the selected-model description line under the
   Phoenix hero title entirely. Descriptions still show in the picker. */
.justify-center.w-fit.px-5.max-w-xl + .flex.mt-1.mb-2 {
	display: none !important;
}
