/* Skip to content link for accessibility */
.skip-link {
	position: absolute;
	top: -100px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--bs-primary);
	color: #fff;
	padding: 0.75rem 1.5rem;
	border-radius: 0 0 0.5rem 0.5rem;
	z-index: 9999;
	text-decoration: none;
	font-weight: 600;
	transition: top 0.2s ease;
}

.skip-link:focus {
	top: 0;
	outline: 2px solid var(--bs-primary);
	outline-offset: 2px;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {

	.skip-link,
	.scroll-bottom-btn,
	.message-bubble,
	.typing-dots span {
		transition: none !important;
		animation: none !important;
	}
}

/* ==== knobs you can tweak ==== */
:root {
	--topbar-h: 64px;
	/* height of your top nav */
	--chat-top-gap: 16px;
	/* top space above card */
	--chat-max-width: 90%;
	/* center column width for bubbles/composer */
	--chat-side-padding: 1rem;
	/* smaller side padding per your request */
	--chat-bottom-gap: 10px;
	/* space from bottom of viewport */
	--footer-h: 32px;
	/* will be overwritten by JS */
	--composer-max-h: 40vh;
	--bubble-radius: 16px;
	--ai-bg: var(--bs-light-bg-subtle, #f5f7fb);
	--me-bg: var(--bs-primary-bg-subtle, #e7efff);
}

/* Flex ancestors must allow children to shrink */
html,
body {
	height: 100%;
	/* overflow: hidden;  <-- REMOVED: This blocks scroll on landing page. */
}

/* Landing page should always be scrollable (offcanvas will still lock via inline styles). */
body.landing-page {
	overflow-x: hidden;
	overflow-y: auto;
}

/* Add a specific class for the chat app to lock scroll if needed,
   or handle it in the chat layout. For now, assume chat functionality
   relies on .pc-container overflow handling. */

.pc-container,
.pc-content,
.chat-wrapper {
	min-height: 0;
	overflow: hidden;
}

/* NEW: the clipper must flex to take the remaining height */
.chat-scroll-clip {
	flex: 1 1 auto;
	/* ← gives it height in the column */
	min-height: 0;
	/* ← critical for scrolling */
	overflow: hidden;
	/* ← clips the scrollbar to the rounded corners */
	display: flex;
	/* so #messages can flex inside */
	position: relative;
	/* ← for positioning the scroll-to-bottom button */
	border-radius: 42px;
	/* your corner radius */
	background: var(--bs-body-bg);
}

/* footer stays visible */
.pc-footer {
	position: sticky;
	bottom: 0;
	z-index: 5;
}

/* Ensure sticky footer doesn't block underlying content clicks on short viewports */
.pc-footer {
	pointer-events: none;
}

.pc-footer .footer-wrapper,
.pc-footer a,
.pc-footer button,
.pc-footer input,
.pc-footer select,
.pc-footer label {
	pointer-events: auto;
}

/* Sidebar dark overlay should not block clicks unless sidebar is shown */
.dark-transparent.sidebartoggler {
	pointer-events: none;
}

#main-wrapper.show-sidebar .dark-transparent.sidebartoggler {
	pointer-events: auto;
}

/* flex ancestors must allow their children to shrink */
.pc-container,
.pc-content {
	height: calc(100dvh - var(--topbar-h));
	overflow: hidden;
	min-height: 0;
}

/* The chat card */
.chat-wrapper {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	/* width + fixed gaps */
	max-width: var(--chat-max-width);
	margin: var(--chat-top-gap) auto var(--chat-bottom-gap);
	/* fill available space, capped so footer remains visible */
	height: calc(100dvh - var(--topbar-h) - var(--footer-h) - var(--chat-top-gap) - var(--chat-bottom-gap));
}

.chat-wrapper #msg-instructions {
	margin: 0 5% !important;
}

/* narrow/center the column for both messages and composer children */
.container-compact {
	max-width: var(--chat-max-width);
	margin: 0 auto;
}

/* The scroller itself */
#messages {
	flex: 1 1 auto;
	/* ← fill the clipper */
	min-height: 0;
	/* ← critical in flex layouts */
	overflow: auto;
	/* ← scroll here */
	overscroll-behavior: contain;

	/* no radius here—parent clips the scrollbar */
	border-radius: 0;
	background: transparent;

	/* your padding etc. */
	padding: 12px var(--chat-side-padding) 16px !important;
}

/* Scroll-to-bottom floating action button */
#scroll-bottom-btn.scroll-bottom-btn {
	position: absolute;
	left: 50%;
	bottom: 12px;
	width: 44px;
	height: 44px;
	padding: 0;
	/* ensure perfect circle (no extra space) */
	box-sizing: border-box;
	/* keep total size 44x44 including borders */
	display: flex;
	/* center the icon */
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
	opacity: 0;
	transform: translate(-50%, 8px);
	transition: opacity .18s ease, transform .18s ease;
	pointer-events: none;
	/* avoid intercepting when hidden */
	z-index: 3;
	/* above messages, below modals */
}

#scroll-bottom-btn.scroll-bottom-btn.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
	pointer-events: auto;
}

/* subtle, thin scrollbar - hidden until hover */
#messages {
	scrollbar-width: thin;
	scrollbar-color: transparent transparent;
	scrollbar-gutter: stable both-edges;
	transition: scrollbar-color 0.2s ease;
}

#messages:hover {
	scrollbar-color: rgba(0, 0, 0, .2) transparent;
}

#messages::-webkit-scrollbar {
	width: 8px;
}

#messages::-webkit-scrollbar-thumb {
	background: transparent;
	border-radius: 21px;
	transition: background 0.2s ease;
}

#messages:hover::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, .12);
}

#messages::-webkit-scrollbar-track {
	background: transparent;
}

/* sticky composer; always visible */
/* Composer sits at bottom of the card */
.chat-composer {
	position: sticky;
	bottom: 0;
	/*background: var(--bs-body-bg);*/
	z-index: 10;
	padding: 12px 0px 16px 0px !important;
	/* your smaller side padding */
	border-top: none !important;
	border-bottom-left-radius: 2em;
	border-bottom-right-radius: 2em;
}

.chat-composer>* {
	margin: 0 auto;
}

#composer-form {
	display: flex;
	gap: 0px !important;
	width: 100%;
	background: var(--bs-body-bg);
	border-radius: 2em;
	padding: .5rem;
	transition: border-radius .12s ease;
}

#composer-form.pill {
	border-radius: 2em;
}

/* single-line look */
#composer-form.multiline {
	border-radius: 2em;
}

/* multi-line (boxy) */
#composer {
	flex: 1 1 auto;
	resize: none;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	min-height: 44px;
	max-height: var(--composer-max-h);
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-left: none !important;
	border-right: none !important;
	padding: .8rem 1rem;
	line-height: 1.35;
	/* Hide scrollbar by default */
	scrollbar-width: none;
	/* Firefox */
	-ms-overflow-style: none;
	/* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Edge */
#composer::-webkit-scrollbar {
	display: none;
}

#btn-send {
	flex: 0 0 auto;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 64px;
	min-height: 44px;
	max-height: var(--composer-max-h);
	padding: 0 .9rem;
	border-radius: 2em;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

#btn-send .ti-send {
	font-size: 1rem;
	line-height: 1;
}


#btn-attach {
	min-height: 44px;
	max-height: var(--composer-max-h);
	border-radius: 2em 0 0 2em;
	border: var(--bs-border-width) solid #aebcc3;
	border-right: none !important;
	background: var(--bs-body-bg);
	color: var(--bs-body-color);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 .9rem;
	transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out, background-color .12s ease, color .12s ease;
}

#btn-attach:hover,
#btn-attach:focus {
	box-shadow: none;
	background: var(--bs-tertiary-bg);
	color: var(--bs-body-color);
}

[data-bs-theme="dark"] #btn-attach {
	background: var(--bs-body-bg);
	border-color: var(--bs-border-color);
	color: var(--bs-body-color);
}

[data-bs-theme="dark"] #btn-attach:hover,
[data-bs-theme="dark"] #btn-attach:focus {
	background: var(--bs-tertiary-bg);
}

[data-bs-theme="light"] #btn-attach:hover,
[data-bs-theme="light"] #btn-attach:focus {
	border-color: #80c2ed;
}

.attachment-list {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}

.attachment-list.d-none {
	display: none !important;
}

.attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	padding: .35rem .6rem;
	border-radius: 999px;
	background: var(--bs-body-bg);
	border: 1px solid var(--bs-body-color, rgba(0, 0, 0, .12));
	font-size: .85rem;
	margin: 0 5% !important;
}

.attachment-chip .attachment-name {
	max-width: 12rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.attachment-chip button {
	border: none;
	background: transparent;
	color: inherit;
	font-size: 1rem;
	line-height: 1;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.attachment-chip button:hover {
	opacity: .7;
}

/* ===== Tool-call indicator + typing chip (LLM "what's happening" chips) =====
   Approach A pill, dark-mode-aware, aligned to assistant bubble's left edge.
   Spec: docs/superpowers/specs/2026-05-27-chat-chip-and-typing-indicator-redesign.md */
.tool-call-indicator,
.typing-indicator-chip {
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	padding: .55rem 1rem;
	border-radius: 999px;
	background: var(--bs-tertiary-bg);
	border: 1px solid var(--bs-border-color);
	font-size: .95rem;
	line-height: 1.2;
	margin: .85rem 3%;
	align-self: flex-start;
	color: var(--bs-body-color);
}

[data-bs-theme="dark"] .tool-call-indicator,
[data-bs-theme="dark"] .typing-indicator-chip {
	background: rgba(255, 255, 255, .04);
	border-color: rgba(255, 255, 255, .18);
}

.tool-call-indicator .tool-icon {
	display: inline-flex;
	align-items: center;
}

.tool-call-eyebrow {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .75rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
	font-weight: 600;
}

.tool-call-sep {
	color: var(--bs-secondary-color);
	opacity: .55;
}

.tool-call-indicator .tool-name,
.typing-indicator-chip .tool-name {
	font-weight: 500;
}

.tool-call-indicator .tool-duration {
	color: var(--bs-secondary-color);
	font-size: .85rem;
	margin-left: .35rem;
	font-variant-numeric: tabular-nums;
}

.tool-call-indicator .tool-summary {
	color: var(--bs-secondary-color);
	font-size: .85rem;
}

.tool-call-indicator.pending .tool-icon {
	animation: tool-call-spin 1.4s linear infinite;
	color: var(--bs-secondary-color);
}

.tool-call-indicator.ok .tool-icon {
	color: var(--bs-success);
}
.tool-call-indicator.ok {
	border-color: color-mix(in srgb, var(--bs-success) 35%, var(--bs-border-color));
}
[data-bs-theme="dark"] .tool-call-indicator.ok {
	border-color: color-mix(in srgb, var(--bs-success) 45%, transparent);
	background: color-mix(in srgb, var(--bs-success) 8%, rgba(255, 255, 255, .04));
}

.tool-call-indicator.error .tool-icon {
	color: var(--bs-danger);
}
.tool-call-indicator.error {
	border-color: color-mix(in srgb, var(--bs-danger) 40%, var(--bs-border-color));
}

.tool-call-indicator.timeout .tool-icon {
	color: var(--bs-warning);
}
.tool-call-indicator.timeout {
	border-color: color-mix(in srgb, var(--bs-warning) 40%, var(--bs-border-color));
}

/* Typing-indicator chip: same pill family. The 3-dot blink animation lives
   on .typing-dots (kept from the prior typing indicator implementation). */
.typing-indicator-chip .typing-dots {
	color: var(--bs-secondary-color);
	margin-left: .15rem;
}

/* "Usually takes a few seconds" subtext rendered below the chip. Indented to
   sit just inside the chip's left edge so it feels attached without nesting. */
.typing-indicator-subtext {
	display: block;
	margin: -.4rem 3% .25rem calc(3% + 1rem);
	font-size: .72rem;
	color: var(--bs-secondary-color);
	opacity: .8;
}

/* Elapsed-time display rendered inline at the end of the subtext line:
   "Usually takes a few seconds · 12s". No warn/cancel escalation — users
   abort via the composer's send-button-turned-stop-button. */
.typing-indicator-subtext .streaming-progress {
	margin-left: .4rem;
	font-variant-numeric: tabular-nums;
}

.typing-indicator-subtext .streaming-progress::before {
	content: "·";
	opacity: .55;
	margin-right: .4rem;
}

/* Send-button stop-mode (while a response is streaming). The submit handler
   intercepts clicks and aborts state.streamAbortController.
   Uses a fixed neutral grey instead of var(--bs-secondary) because the
   Datta Able theme overrides --bs-secondary to brand-accent colors that
   include yellow-green (#ccda4e) on some presets. */
#btn-send.is-stopping {
	background: #6c757d;
	border-color: #6c757d;
}
[data-bs-theme="dark"] #btn-send.is-stopping {
	background: rgba(255, 255, 255, .25);
	border-color: rgba(255, 255, 255, .25);
}

@keyframes tool-call-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* WCAG 2.3.3 — honor reduced-motion users; the spinner is decorative. */
@media (prefers-reduced-motion: reduce) {
	.tool-call-indicator.pending .tool-icon {
		animation: none;
	}
}

/* ===== BUBBLES (direct children of #messages) ===== */
/* vertical gap between consecutive messages */
#messages>.message-bubble+.message-bubble {
	margin-top: 10px;
}

@media (max-width: 600px) {
	.message-bubble {
		max-width: 92%;
	}
}

/* bubble width cap and alignment (unchanged) */
.message-bubble {
	max-width: min(80%, 780px);
	border-radius: 16px;
	padding: .75rem .9rem;
	white-space: normal;
	overflow-wrap: anywhere;
	box-shadow: 0 1px 1px rgba(0, 0, 0, .02);
}

.message-bubble.ai {
	background: var(--ai-bg);
	margin-left: 3%;
	margin-right: auto;
	margin-bottom: 1%;
	border-top-left-radius: 8px;
}

.message-bubble.me {
	background: var(--me-bg);
	margin-left: auto;
	margin-right: 3%;
	margin-bottom: 1%;
	border-top-right-radius: 8px;
	white-space: pre-wrap;
	/* keep user text line breaks */
}

/* nice spacing inside */
.message-bubble p {
	margin: 0 0 .6rem;
}

.message-bubble p:last-child {
	margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
	margin: 0 0 .6rem 1.25rem;
}

/* Ensure bullets and numbers show consistently */
.message-bubble ul {
	list-style: disc !important;
	list-style-position: outside;
	padding-left: 1.25rem !important;
}

.message-bubble ol {
	list-style: decimal !important;
	list-style-position: outside;
	padding-left: 1.25rem !important;
}

.message-bubble li {
	margin: .25rem 0;
}

/* Inline code and fenced code blocks */
.message-bubble code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	background: rgba(0, 0, 0, .06);
	padding: 0 .25rem;
	border-radius: .25rem;
}

.message-bubble pre {
	background: rgba(0, 0, 0, .06);
	padding: .75rem .9rem;
	border-radius: .5rem;
	overflow: auto;
	line-height: 1.4;
	position: relative;
}

.message-bubble pre code {
	background: transparent;
	padding: 0;
	display: block;
	white-space: pre;
}

/* Copy button inside code blocks */
.message-bubble .code-copy-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	font-size: .75rem;
	line-height: 1;
	padding: .25rem .5rem;
	border-radius: .3rem;
	border: 1px solid rgba(0, 0, 0, .15);
	background: rgba(255, 255, 255, .85);
	color: inherit;
	cursor: pointer;
}

[data-bs-theme="dark"] .message-bubble .code-copy-btn {
	background: rgba(0, 0, 0, .35);
	border-color: rgba(255, 255, 255, .2);
}

.message-bubble .code-copy-btn:hover {
	opacity: .9;
}

/* Feedback controls aligned with AI bubble */
.psygpt-feedback-controls {
	margin-top: 0;
	/* top margin should be 0 per spec */
	margin-left: 3%;
	/* align with .message-bubble.ai */
	margin-right: auto;
	display: inline-flex;
	gap: .4rem;
	align-items: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease;
}

.psygpt-feedback-controls.visible {
	opacity: 1;
	visibility: visible;
}

.psygpt-feedback-controls.waiting {
	pointer-events: none;
}

/* Edit control aligned with user bubble */
.psygpt-user-controls {
	margin-top: 0;
	margin-left: auto;
	margin-right: 3%;
	display: inline-flex;
	gap: .4rem;
	align-items: center;
}

.psygpt-user-controls .chat-action-bg {
	width: 28px;
	height: 28px;
	background: transparent !important;
	color: inherit;
	transition: background-color .15s ease, color .15s ease;
}

.psygpt-user-controls button:hover .chat-action-bg,
.psygpt-user-controls button:focus-visible .chat-action-bg {
	background: rgba(0, 0, 0, .08) !important;
}

[data-bs-theme="dark"] .psygpt-user-controls button:hover .chat-action-bg,
[data-bs-theme="dark"] .psygpt-user-controls button:focus-visible .chat-action-bg {
	background: rgba(255, 255, 255, .12) !important;
}

.psygpt-user-controls button:focus-visible .chat-action-bg {
	outline: 2px solid var(--bs-primary);
	outline-offset: 1px;
}

/* Feedback buttons: no background until hover/focus; match sidebar hover circle */
.psygpt-feedback-controls .chat-action-bg {
	width: 28px;
	height: 28px;
	background: transparent !important;
	color: inherit;
	transition: background-color .15s ease, color .15s ease;
}

.psygpt-feedback-controls button:hover .chat-action-bg,
.psygpt-feedback-controls button:focus-visible .chat-action-bg {
	background: rgba(0, 0, 0, .08) !important;
}

[data-bs-theme="dark"] .psygpt-feedback-controls button:hover .chat-action-bg,
[data-bs-theme="dark"] .psygpt-feedback-controls button:focus-visible .chat-action-bg {
	background: rgba(255, 255, 255, .12) !important;
}

.psygpt-feedback-controls button:focus-visible .chat-action-bg {
	outline: 2px solid var(--bs-primary);
	outline-offset: 1px;
}

/* Active state (set via JS) uses Bootstrap utilities already toggled */
.psygpt-feedback-controls .feedback-btn.active .chat-action-bg {
	/* class toggled by JS adds bg-primary-subtle and text-primary */
}

/* Inline "Copied" chip variant shown transiently */
.psygpt-feedback-controls .chat-action-bg.copied {
	width: auto;
	height: 26px;
	padding: 0 .5rem;
	border-radius: 999px;
	font-size: .75rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .08) !important;
}

[data-bs-theme="dark"] .psygpt-feedback-controls .chat-action-bg.copied {
	background: rgba(255, 255, 255, .12) !important;
}

/* Toast (used for feedback results/errors) */
.psygpt-feedback-toast {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	background-color: var(--bs-dark);
	color: #fff;
	padding: .5rem .75rem;
	border-radius: 999px;
	box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2);
	opacity: 0;
	transform: translateY(10px);
	transition: opacity .2s ease, transform .2s ease;
	z-index: 1080;
	font-size: .875rem;
}

.psygpt-feedback-toast.show {
	opacity: .95;
	transform: translateY(0);
}

.psygpt-feedback-toast.error {
	background-color: var(--bs-danger);
}

/* THEME-AWARE PRELOADER IMAGE SWAP */
.preloader img.theme-dark {
	display: none;
}

[data-bs-theme="dark"] .preloader img.theme-light {
	display: none;
}

[data-bs-theme="dark"] .preloader img.theme-dark {
	display: inline-block;
}


/* THEME-AWARE PRELOADER BACKGROUND */
.preloader.loader-bg {
	background-color: var(--bs-body-bg) !important;
	/* uses Bootstrap var for current theme */
}

[data-bs-theme="dark"] .preloader.loader-bg {
	background-color: var(--bs-body-bg) !important;
	/* ensure dark mode maps to dark body bg */
}

/* Typing-dot animation — used by the typing-indicator chip (.typing-indicator-chip).
   The chip itself is styled alongside the tool-call indicator near line 428. */
.typing-dots {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.typing-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background-color: currentColor;
	opacity: .35;
	display: inline-block;
	animation: typing-blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typing-blink {
	0%, 80%, 100% {
		transform: translateY(0);
		opacity: .35;
	}
	40% {
		transform: translateY(-2px);
		opacity: .9;
	}
}

/* Override Bootstrap's hardcoded blue focus border on form controls to use theme primary */
#composer:focus,
#composer:focus-visible {
	border-color: var(--bs-primary) !important;
	/* Glow only on top and bottom (not left/right for seamless connection) */
	box-shadow:
		0 -0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25),
		0 0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25) !important;
}

/* When composer is focused, add glow to attach button (all sides except right) */
#composer-form:has(#composer:focus) #btn-attach,
#composer-form:has(#composer:focus-visible) #btn-attach {
	border-color: var(--bs-primary) !important;
	box-shadow:
		-0.25rem 0 0 0 rgba(var(--bs-primary-rgb), 0.25),
		/* left */
		0 -0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25),
		/* top */
		0 0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25) !important;
	/* bottom */
}

/* When composer is focused, add glow to send button (all sides except left) */
#composer-form:has(#composer:focus) #btn-send,
#composer-form:has(#composer:focus-visible) #btn-send {
	box-shadow:
		0.25rem 0 0 0 rgba(var(--bs-primary-rgb), 0.25),
		/* right */
		0 -0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25),
		/* top */
		0 0.25rem 0 0 rgba(var(--bs-primary-rgb), 0.25) !important;
	/* bottom */
}

/* Settings modal tweaks */
#settings-modal-wrapper .settings-panel {
	outline: none;
}

/* Keep settings modal content a consistent height by overlaying panels */
#settings-modal-wrapper .settings-panels {
	display: grid;
	position: relative;
}

#settings-modal-wrapper .settings-panels .settings-panel {
	grid-area: 1 / 1;
	width: 100%;
}

#settings-modal-wrapper .settings-panels .settings-panel:not(.active) {
	visibility: hidden;
	pointer-events: none;
}

#settingsModal .nav-pills .nav-link {
	border-radius: .75rem;
	display: flex;
	align-items: center;
	gap: .5rem;
}

#settingsModal .nav-pills .nav-link:focus-visible {
	outline: 2px solid var(--bs-primary);
	outline-offset: 2px;
}

/* Ensure settings modal tabs use the themed primary color */
#settingsModal .nav-pills {
	--bs-nav-pills-link-active-bg: var(--bs-primary);
	--bs-nav-link-hover-color: var(--bs-primary);
}

#settingsModal [data-settings-save][aria-busy="true"] {
	position: relative;
	pointer-events: none;
}

#settingsModal [data-settings-save][aria-busy="true"]::after {
	content: "";
	position: absolute;
	right: 1rem;
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	border: 2px solid transparent;
	border-top-color: currentColor;
	border-left-color: currentColor;
	animation: settings-spin 0.7s linear infinite;
}

@keyframes settings-spin {
	from {
		transform: rotate(0);
	}

	to {
		transform: rotate(360deg);
	}
}

#settings-toast-container {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 1080;
	pointer-events: none;
}

#settings-toast-container .toast {
	pointer-events: auto;
}


/* Fix: Remove visible bottom border on dropup caret in sidebar profile menu */
.dropup .dropdown-toggle::after {
	/* Bootstrap uses border-bottom to render the caret for dropup; make it transparent */
	border-bottom-color: transparent !important;
	/* Ensure no fallback color leaks through */
	border-bottom-style: solid;
}


/* Composer: sync attach button border with textarea focus (light + dark) */
/* Base style to ensure the attach button visually matches a form-control border */
#composer-form .btn-attach {
	border-style: solid;
	border-width: var(--bs-border-width, 1px);
	border-color: var(--bs-border-color);
	background-color: var(--bs-body-bg);
	/* keep seamless with input background */
}

/* Theme-scoped enforcement to beat .btn defaults in both light and dark */
[data-bs-theme="light"] #composer-form .btn-attach {
	/* Match .form-control border in light theme exactly */
	border-color: #aebcc3 !important;
}

[data-bs-theme="dark"] #composer-form .btn-attach {
	/* Preserve default variable-driven border in dark theme */
	border-color: var(--bs-border-color) !important;
}

/* Landing page banner image - ensure full width is visible */
.banner-image {
	overflow: visible !important;
	/* Override overflow-hidden to show full image */
	min-width: auto !important;
	/* Remove fixed min-width */
	max-width: 100% !important;
	/* Ensure it doesn't exceed container */
	width: 100% !important;
	/* Make it fit the column */
}

.banner-image img {
	width: 100%;
	height: auto;
	object-fit: contain;
	/* Ensure entire image is visible */
}

/* =========================================
   Marketing Page Animations & Enhancements
   ========================================= */

/* Keyframes */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translate3d(0, 30px, 0);
	}

	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes scaleIn {
	from {
		opacity: 0;
		transform: scale(0.95);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Animation Utility Classes */
.animate-on-scroll {
	opacity: 0;
	/* Hidden by default until .visible is added */
	transition: opacity 0.6s ease-out, transform 0.6s ease-out;
	will-change: opacity, transform;
}

.animate-on-scroll.visible {
	opacity: 1;
	transform: none;
}

/* Animation Variants */
.fade-in-up {
	transform: translate3d(0, 30px, 0);
}

.fade-in {
	/* No transform needed */
}

.scale-in {
	transform: scale(0.95);
}

/* Stagger Delays */
.delay-100 {
	transition-delay: 100ms;
}

.delay-200 {
	transition-delay: 200ms;
}

.delay-300 {
	transition-delay: 300ms;
}

.delay-400 {
	transition-delay: 400ms;
}

.delay-500 {
	transition-delay: 500ms;
}

/* Card base (no hover effects - removed per user request) */
.card {
	/* No transform or shadow transitions on hover */
}

/* Feature Icon Styles */
.feature-icon-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	min-width: 48px;
	/* Prevent shrink */
	border-radius: 12px;
	background: rgba(var(--bs-primary-rgb), 0.1);
	margin-bottom: 0;
	/* Handled by gap-3 on parent */
	transition: transform 0.3s ease;
}

/* Remove hover transform on wrapper to prevent stacking context issue with mix-blend-mode */
/* .card:hover .feature-icon-wrapper {
  transform: scale(1.1) rotate(3deg);
} */

.feature-icon-img {
	width: 32px;
	height: 32px;
	object-fit: contain;
	mix-blend-mode: multiply;
	/* Hack to make white background transparent on light cards */
}

/* =========================================
   Keyboard Hints & Draft Indicator
   ========================================= */

.keyboard-hints {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.25rem;
	font-size: 0.75rem;
}

.keyboard-hints kbd {
	font-size: 0.65rem;
	padding: 0.15rem 0.35rem;
	background: var(--bs-secondary-bg);
	border: 1px solid var(--bs-border-color);
	border-radius: 4px;
	font-family: inherit;
	font-weight: 500;
	color: var(--bs-body-color);
	box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* Dark mode override for keyboard hints */
[data-bs-theme="dark"] .keyboard-hints kbd {
	background: var(--bs-dark);
	border-color: var(--bs-border-color);
	color: var(--bs-body-color);
}

/* Keyboard shortcuts modal - kbd styling */
#keyboardShortcutsModal kbd {
	background: var(--bs-secondary-bg) !important;
	border: 1px solid var(--bs-border-color) !important;
	color: var(--bs-body-color) !important;
	font-weight: 500;
}

[data-bs-theme="dark"] #keyboardShortcutsModal kbd {
	background: var(--bs-dark) !important;
	border-color: var(--bs-border-color) !important;
	color: var(--bs-body-color) !important;
}

.keyboard-hints .hint-separator {
	color: var(--bs-secondary-color);
	margin: 0 0.15rem;
}

.keyboard-hints .hint-item {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	color: var(--bs-secondary-color);
}

/* Draft indicator */
.draft-indicator {
	opacity: 0;
	transition: opacity 0.3s ease;
	font-size: 0.75rem;
}

.draft-indicator.show {
	opacity: 1;
}

/* =========================================
   Clinical Templates & Empty State
   ========================================= */

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 60vh;
	padding: 2rem;
}

.empty-state-content {
	text-align: center;
}

.clinical-templates {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.clinical-template-btn {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 1rem;
	text-align: left;
	background: var(--bs-body-bg);
	border: 1px solid var(--bs-border-color);
	border-radius: 12px;
	transition: all 0.2s ease;
	cursor: pointer;
}

.clinical-template-btn:hover {
	border-color: var(--bs-primary);
	background: rgba(var(--bs-primary-rgb), 0.05);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.clinical-template-btn .template-icon {
	font-size: 1.5rem;
	color: var(--bs-primary);
	margin-bottom: 0.5rem;
}

.clinical-template-btn .template-title {
	font-weight: 600;
	font-size: 0.9rem;
	margin-bottom: 0.25rem;
}

.clinical-template-btn .template-desc {
	font-size: 0.75rem;
	color: var(--bs-secondary-color);
	line-height: 1.3;
}

/* Custom Prompt buttons – edit/delete overlays */
.custom-prompt-btn {
	position: relative;
}

.custom-prompt-actions {
	position: absolute;
	top: 0.4rem;
	right: 0.4rem;
	display: flex;
	gap: 0.25rem;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.custom-prompt-btn:hover .custom-prompt-actions,
.custom-prompt-btn:focus-within .custom-prompt-actions {
	opacity: 1;
}

.custom-prompt-action-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 4px;
	font-size: 0.8rem;
	cursor: pointer;
	color: var(--bs-secondary-color);
	background: var(--bs-body-bg);
	border: 1px solid var(--bs-border-color);
	transition: all 0.15s ease;
	padding: 0;
}

.custom-prompt-action-btn:hover {
	color: var(--bs-primary);
	border-color: var(--bs-primary);
}

.custom-prompt-delete-btn:hover {
	color: var(--bs-danger);
	border-color: var(--bs-danger);
}

/* Custom Prompt Modal */
.custom-prompt-modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 1055;
	align-items: center;
	justify-content: center;
}

.custom-prompt-modal-overlay.show {
	display: flex;
}

.custom-prompt-modal {
	background: var(--bs-body-bg);
	border-radius: 12px;
	width: 100%;
	max-width: 500px;
	margin: 1rem;
	box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.custom-prompt-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--bs-border-color);
}

.custom-prompt-modal-header h5 {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.custom-prompt-modal-body {
	padding: 1.25rem;
}

.custom-prompt-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	border-top: 1px solid var(--bs-border-color);
}

/* Custom prompts section header */
.custom-prompts-section h6,
.templates-section h6 {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* =========================================
   Chat Pinning
   ========================================= */

.pinned-chats-section {
	margin-bottom: 0.5rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--bs-border-color);
}

.pinned-chats-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.25rem 0.5rem;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--bs-secondary-color);
	font-weight: 600;
}

.chat-pin-btn {
	opacity: 0;
	transition: opacity 0.15s ease;
}

.chat-item:hover .chat-pin-btn {
	opacity: 1;
}

.chat-item.is-pinned .chat-pin-btn {
	opacity: 1;
	color: var(--bs-warning);
}

/* =========================================
   Onboarding Checklist
   ========================================= */

.onboarding-checklist {
	position: fixed;
	bottom: 40px;
	right: 20px;
	width: 280px;
	background: var(--bs-body-bg);
	border: 1px solid var(--bs-border-color);
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.15);
	z-index: 1040;
	overflow: hidden;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Collapsed: hide the body entirely so the panel becomes a compact header
   pill anchored in the corner. The previous translateY trick slid most of
   the body off-screen but left the top of the items visible behind the
   viewport edge, which looked broken. */
.onboarding-checklist.collapsed .onboarding-checklist-body {
	display: none;
}

/* Fade + slide down on dismiss; the JS removes the node 300ms later. */
.onboarding-checklist.dismissed {
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
}

.onboarding-checklist-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: rgba(var(--bs-primary-rgb), 0.1);
	cursor: pointer;
	gap: 0.5rem;
}

/* Chevron flips when the panel is collapsed so it visually invites
   expansion ("click to open"). */
.onboarding-checklist-header .ti-chevron-down {
	transition: transform 0.2s ease;
}
.onboarding-checklist.collapsed .onboarding-checklist-header .ti-chevron-down {
	transform: rotate(180deg);
}

.onboarding-checklist-header h6 {
	margin: 0;
	font-size: 0.85rem;
	font-weight: 600;
}

.onboarding-progress {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.75rem;
	color: var(--bs-secondary-color);
}

.onboarding-progress-bar {
	width: 60px;
	height: 4px;
	background: var(--bs-border-color);
	border-radius: 2px;
	overflow: hidden;
}

.onboarding-progress-fill {
	height: 100%;
	background: var(--bs-primary);
	transition: width 0.3s ease;
}

.onboarding-checklist-body {
	padding: 1rem;
}

.onboarding-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.5rem 0;
}

.onboarding-item + .onboarding-item {
	border-top: 1px solid var(--bs-border-color-translucent);
}

.onboarding-check {
	width: 20px;
	height: 20px;
	min-width: 20px;
	border-radius: 50%;
	border: 2px solid var(--bs-border-color);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.7rem;
	color: transparent;
	transition: all 0.2s ease;
}

.onboarding-item.completed .onboarding-check {
	background: var(--bs-success);
	border-color: var(--bs-success);
	color: white;
}

.onboarding-item-content {
	flex: 1;
}

.onboarding-item-title {
	font-size: 0.85rem;
	font-weight: 500;
	margin-bottom: 0.15rem;
}

.onboarding-item.completed .onboarding-item-title {
	text-decoration: line-through;
	color: var(--bs-secondary-color);
}

.onboarding-item-desc {
	font-size: 0.7rem;
	color: var(--bs-secondary-color);
	line-height: 1.3;
}

.onboarding-dismiss {
	text-align: center;
	padding-top: 0.75rem;
	border-top: 1px solid var(--bs-border-color);
}

/* =========================================
   Mobile Swipe Gestures
   ========================================= */

@media (max-width: 768px) {
	.sidebar-swipe-indicator {
		position: fixed;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		width: 20px;
		height: 80px;
		background: linear-gradient(to right, rgba(var(--bs-primary-rgb), 0.1), transparent);
		border-radius: 0 8px 8px 0;
		z-index: 1039;
		pointer-events: none;
		opacity: 0;
		transition: opacity 0.3s ease;
	}

	.sidebar-swipe-indicator.visible {
		opacity: 1;
	}

	/* Touch feedback */
	.touch-active {
		transition: none !important;
	}
}

/* =========================================
   Enhanced Focus Styles (Accessibility)
   ========================================= */

/* Consistent focus ring for all interactive elements */
:focus-visible {
	outline: 2px solid var(--bs-primary);
	outline-offset: 2px;
}

/* Remove default focus outline when not using keyboard */
:focus:not(:focus-visible) {
	outline: none;
}

/* Enhanced focus for buttons */
.btn:focus-visible {
	outline: 2px solid var(--bs-primary);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.25);
}

/* Enhanced focus for form controls */
.form-control:focus-visible,
.form-select:focus-visible {
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

/* Focus for links */
a:focus-visible {
	outline: 2px solid var(--bs-primary);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Focus for sidebar items */
.sidebar-link:focus-visible {
	outline: 2px solid var(--bs-primary);
	outline-offset: -2px;
	background: rgba(var(--bs-primary-rgb), 0.1);
}

/* =========================================
   Button Loading States
   ========================================= */

.btn-loading {
	position: relative;
	pointer-events: none;
	color: transparent !important;
}

.btn-loading::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 1em;
	height: 1em;
	margin-left: -0.5em;
	margin-top: -0.5em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: btn-spinner 0.6s linear infinite;
}

.btn-loading > * {
	visibility: hidden;
}

@keyframes btn-spinner {
	to {
		transform: rotate(360deg);
	}
}

/* =========================================
   Form Validation Enhancements
   ========================================= */

.form-control.is-invalid:focus {
	border-color: var(--bs-danger);
	box-shadow: 0 0 0 3px rgba(var(--bs-danger-rgb), 0.15);
}

.form-control.is-valid:focus {
	border-color: var(--bs-success);
	box-shadow: 0 0 0 3px rgba(var(--bs-success-rgb), 0.15);
}

.invalid-feedback {
	font-size: 0.8rem;
	margin-top: 0.35rem;
}

.valid-feedback {
	font-size: 0.8rem;
	margin-top: 0.35rem;
}

/* Subscription state banner (chat page) — see static/assets/js/psygpt_subscription_banner.js
   Pill-shaped, theme-aware via Bootstrap 5.3+ subtle tokens. Layout mirrors
   the landing-page "Free Trial" banner (badge + message + CTA, inline). */
.psygpt-subscription-banner-mount:empty { display: none; }
.psygpt-banner {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.4rem 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  font-size: 0.875rem;
  margin: 0.5rem 0 0.5rem;
  max-width: 100%;
}
.psygpt-banner--trial {
  background: var(--bs-info-bg-subtle);
  border-color: var(--bs-info-border-subtle);
  color: var(--bs-info-text-emphasis);
}
.psygpt-banner--canceling {
  background: var(--bs-warning-bg-subtle);
  border-color: var(--bs-warning-border-subtle);
  color: var(--bs-warning-text-emphasis);
}
.psygpt-banner--past_due {
  background: var(--bs-danger-bg-subtle);
  border-color: var(--bs-danger-border-subtle);
  color: var(--bs-danger-text-emphasis);
}
.psygpt-banner--ended {
  background: var(--bs-secondary-bg-subtle);
  border-color: var(--bs-secondary-border-subtle);
  color: var(--bs-secondary-text-emphasis);
}
.psygpt-banner-badge {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: currentColor;
  white-space: nowrap;
}
.psygpt-banner-badge > span {
  /* Nested span carries readable text color contrasting with the filled bg. */
  color: var(--bs-body-bg);
  display: inline-block;
}
.psygpt-banner-message {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.psygpt-banner-cta {
  display: inline-block;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.35;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}
.psygpt-banner-cta:hover,
.psygpt-banner-cta:focus-visible {
  background: currentColor;
  color: var(--bs-body-bg);
  text-decoration: none;
  outline: none;
}
.psygpt-banner-cta:hover > span,
.psygpt-banner-cta:focus-visible > span {
  color: var(--bs-body-bg);
}
.psygpt-banner-cta > span {
  color: inherit;
  display: inline-block;
}
.psygpt-banner-cta-form { display: inline; margin: 0; }
.psygpt-banner-dismiss {
  background: transparent;
  border: 0;
  padding: 0 0.35rem;
  color: inherit;
  opacity: 0.55;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  align-self: center;
}
.psygpt-banner-dismiss:hover,
.psygpt-banner-dismiss:focus-visible { opacity: 1; outline: none; }
/* Stack badge/message above CTA on narrow viewports so nothing clips. */
@media (max-width: 480px) {
  .psygpt-banner { flex-wrap: wrap; border-radius: 14px; padding: 0.4rem 0.6rem; }
  .psygpt-banner-message { white-space: normal; }
}

/* ===== What's New modal body =====
   Body HTML is admin-authored and injected via innerHTML. These classes use
   Bootstrap theme variables so the modal reads correctly in both light and
   dark mode instead of relying on hardcoded (dark-only) colors. */
#whatsNewModal .whats-new-body {
  color: var(--bs-body-color);
}
#whatsNewModal .whats-new-body .wn-lead {
  color: var(--bs-secondary-color);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 1.25rem;
}
#whatsNewModal .whats-new-body .wn-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
}
#whatsNewModal .whats-new-body .wn-card + .wn-card {
  margin-top: 0.75rem;
}
#whatsNewModal .whats-new-body .wn-card__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
  font-size: 1.25rem;
}
#whatsNewModal .whats-new-body .wn-card__title {
  font-weight: 600;
  color: var(--bs-body-color);
  margin: 0 0 0.15rem;
}
#whatsNewModal .whats-new-body .wn-card__desc {
  color: var(--bs-secondary-color);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
}
#whatsNewModal .whats-new-body .wn-note {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
  margin: 1.25rem 0 0;
}

/* Team prompt badge + section header */
.psygpt-team-badge {
  display: inline-block;
  background: #5b8def;
  color: #fff;
  font-size: 0.7em;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  margin-left: 0.4em;
  vertical-align: middle;
}
.team-prompt-btn .template-icon { color: #5b8def; }
.team-prompt-fork-btn:hover { color: #5b8def; }

/* ===================================================================== *
 * Settings -> Billing & plan tab (Variation B, dashboard view)
 * Scoped under .psyfi-billing so the bespoke palette never touches the
 * rest of the app (the global theme primary is #04a9f5, not #0085db).
 * ===================================================================== */
.psyfi-billing {
  --pf-blue: #0085db; --pf-blue-600: #0073c0; --pf-blue-700: #006098; --pf-blue-subtle: #e6f4fd;
  --pf-secondary: #8965e5; --pf-secondary-subtle: #e7e2f3;
  --pf-success: #00ceb6; --pf-success-subtle: #bafaf2; --pf-success-deep: #009e8c; --pf-success-deeper: #00786b;
  --pf-warning: #ffb900; --pf-warning-subtle: #fff1cc; --pf-warning-deep: #a87b00;
  --pf-danger: #ff6692; --pf-danger-subtle: #ffd9e4; --pf-danger-deep: #d63a68;
  --pf-ink: #111c2d; --pf-fg2: rgba(17,28,45,.8); --pf-fg3: rgba(17,28,45,.6); --pf-fg4: rgba(17,28,45,.4);
  --pf-surface: #fff; --pf-surface-2: #f8fafd; --pf-surface-3: #eff4fa;
  --pf-border: #e4ebf0; --pf-border-strong: #d6deea;
  --pf-shadow-card: 0 1px 20px 0 rgba(69,90,100,.08);
  --pf-shadow-lg: 0 24px 64px rgba(17,28,45,.24);
  --pf-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-family: 'Open Sans', system-ui, sans-serif;
  color: var(--pf-fg2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.psyfi-billing .pf-card {
  background: var(--pf-surface); border-radius: 14px; box-shadow: var(--pf-shadow-card);
}
.psyfi-billing .pf-display { font-family: var(--pf-display); }

/* --- Plan header strip --- */
.psyfi-billing .pf-header { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.psyfi-billing .pf-icon-well {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.psyfi-billing .pf-header-body { flex: 1; min-width: 0; }
.psyfi-billing .pf-plan-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.psyfi-billing .pf-plan-name { font-family: var(--pf-display); font-weight: 800; font-size: 18px; color: var(--pf-ink); }
.psyfi-billing .pf-badge { font-family: var(--pf-display); font-weight: 700; font-size: 11px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.psyfi-billing .pf-badge-active { background: var(--pf-success-subtle); color: var(--pf-success-deep); }
.psyfi-billing .pf-badge-trial { background: var(--pf-warning-subtle); color: var(--pf-warning-deep); }
.psyfi-billing .pf-badge-discount { background: var(--pf-success-subtle); color: var(--pf-success-deeper); }
.psyfi-billing .pf-subline { font-size: 13px; color: var(--pf-fg3); margin-top: 4px; }
.psyfi-billing .pf-subline strong { font-family: var(--pf-display); font-weight: 700; color: var(--pf-ink); font-size: 14px; }

/* --- Buttons --- */
.psyfi-billing .pf-btn { font-family: var(--pf-display); cursor: pointer; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.psyfi-billing .pf-btn-light { background: var(--pf-blue-subtle); color: var(--pf-blue); font-weight: 600; font-size: 13.5px; padding: 10px 18px; border-radius: 9px; }
.psyfi-billing .pf-btn-light:hover { background: #d8edfb; }
.psyfi-billing .pf-btn-primary { background: var(--pf-blue); color: #fff; font-weight: 700; border-radius: 10px; }
.psyfi-billing .pf-btn-primary:hover { background: var(--pf-blue-600); }
.psyfi-billing .pf-btn-outline { background: #fff; border: 1.5px solid var(--pf-border-strong); color: var(--pf-fg2); font-weight: 600; font-size: 12.5px; padding: 7px 13px; border-radius: 8px; }
.psyfi-billing .pf-btn-select { width: 100%; background: var(--pf-blue-subtle); color: var(--pf-blue); font-weight: 600; font-size: 12.5px; padding: 8px 0; border-radius: 8px; }
.psyfi-billing .pf-btn-danger { background: var(--pf-danger); color: #fff; font-weight: 700; font-size: 14px; padding: 12px; border-radius: 9px; }

/* --- Change-plan grid --- */
.psyfi-billing .pf-eyebrow { font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--pf-fg3); font-weight: 700; }
.psyfi-billing .pf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.psyfi-billing .pf-plan-card { border: 1.5px solid var(--pf-border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.psyfi-billing .pf-plan-card .pf-icon-well { width: 36px; height: 36px; border-radius: 10px; font-size: 19px; margin-bottom: 2px; }
.psyfi-billing .pf-plan-card-name { font-family: var(--pf-display); font-weight: 800; font-size: 14px; color: var(--pf-ink); }
.psyfi-billing .pf-plan-card-price { font-family: var(--pf-display); font-weight: 700; font-size: 16px; color: var(--pf-blue); }
.psyfi-billing .pf-plan-card-cap { font-size: 11px; color: var(--pf-fg3); min-height: 30px; line-height: 1.4; }
.psyfi-billing .pf-current { font-family: var(--pf-display); font-weight: 700; font-size: 12px; color: var(--pf-success); text-align: center; padding: 8px 0 2px; }

/* --- Two-column row --- */
.psyfi-billing .pf-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.psyfi-billing .pf-col { display: flex; flex-direction: column; gap: 12px; }
.psyfi-billing .pf-section-title { font-family: var(--pf-display); font-weight: 700; font-size: 14.5px; color: var(--pf-ink); }
.psyfi-billing .pf-meter { margin-bottom: 16px; }
.psyfi-billing .pf-meter:last-child { margin-bottom: 0; }
.psyfi-billing .pf-meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.psyfi-billing .pf-meter-label { font-size: 12.5px; color: var(--pf-fg2); font-weight: 600; }
.psyfi-billing .pf-meter-value { font-family: var(--pf-display); font-size: 12.5px; color: var(--pf-fg3); font-weight: 600; }
.psyfi-billing .pf-track { height: 7px; background: var(--pf-surface-3); border-radius: 99px; overflow: hidden; }
.psyfi-billing .pf-fill { height: 100%; border-radius: 99px; }
.psyfi-billing .pf-stats { display: flex; gap: 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--pf-border); }
.psyfi-billing .pf-stat-label { font-size: 11px; color: var(--pf-fg3); }
.psyfi-billing .pf-stat-value { font-family: var(--pf-display); font-weight: 700; font-size: 14px; color: var(--pf-ink); margin-top: 2px; }
.psyfi-billing .pf-pm-chip { width: 42px; height: 30px; border-radius: 6px; background: var(--pf-ink); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #fff; font-size: 18px; }
.psyfi-billing .pf-pm-row { display: flex; align-items: center; gap: 12px; }
.psyfi-billing .pf-next-well { width: 38px; height: 38px; border-radius: 10px; background: var(--pf-surface-3); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 20px; color: var(--pf-fg3); }

/* --- Billing history table --- */
.psyfi-billing .pf-history-head { display: flex; align-items: center; gap: 14px; padding: 0 0 8px; font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--pf-fg4); font-weight: 700; border-bottom: 1px solid var(--pf-border); }
.psyfi-billing .pf-history-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--pf-border); }
.psyfi-billing .pf-h-desc { flex: 1; font-family: var(--pf-display); font-weight: 600; font-size: 13px; color: var(--pf-ink); }
.psyfi-billing .pf-h-date { width: 96px; font-size: 12px; color: var(--pf-fg3); }
.psyfi-billing .pf-h-amt { width: 62px; text-align: right; font-family: var(--pf-display); font-weight: 700; font-size: 13px; color: var(--pf-ink); }
.psyfi-billing .pf-h-dl { width: 34px; height: 30px; border-radius: 7px; border: 0; background: none; color: var(--pf-fg3); cursor: pointer; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.psyfi-billing .pf-h-dl:hover { background: var(--pf-surface-3); }

/* --- Cancel danger row --- */
.psyfi-billing .pf-cancel-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: #fff5f8; border: 1px solid var(--pf-danger-subtle); }
.psyfi-billing .pf-cancel-btn { background: #fff; border: 1.5px solid #ffc4d4; color: var(--pf-danger-deep); font-family: var(--pf-display); font-weight: 700; font-size: 13.5px; padding: 10px 18px; border-radius: 9px; cursor: pointer; }

/* --- Cancel overlay --- */
.psyfi-billing .pf-overlay { position: absolute; inset: 0; background: rgba(17,28,45,.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 5; }
.psyfi-billing .pf-overlay[hidden] { display: none; }
/* The [hidden] attribute is overridden by an explicit `display` (flex/grid),
   so any flex/grid element toggled via .hidden needs an explicit override. */
.psyfi-billing [hidden] { display: none !important; }
.psyfi-billing .pf-overlay-card { width: 430px; max-width: 100%; background: var(--pf-surface); border-radius: 18px; box-shadow: var(--pf-shadow-lg); overflow: hidden; }
.psyfi-billing .pf-grad-header { background: linear-gradient(135deg, #0085db 0%, #0a6fd6 55%, #5a4ed1 100%); color: #fff; padding: 24px 24px 22px; position: relative; }
.psyfi-billing .pf-overlay-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.psyfi-billing .pf-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.18); padding: 5px 12px; border-radius: 999px; font-family: var(--pf-display); font-weight: 800; font-size: 11px; letter-spacing: .04em; }
.psyfi-billing .pf-overlay-body { padding: 20px 24px 22px; }
.psyfi-billing .pf-secondary-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--pf-border); background: #fff; cursor: pointer; }
.psyfi-billing .pf-link { font-family: var(--pf-display); font-weight: 600; font-size: 13px; background: none; border: 0; color: var(--pf-fg3); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.psyfi-billing .pf-chip { font-family: var(--pf-display); font-weight: 600; font-size: 12.5px; padding: 7px 13px; border-radius: 999px; background: var(--pf-surface-3); color: var(--pf-fg2); cursor: pointer; border: 1.5px solid transparent; }
.psyfi-billing .pf-chip[aria-pressed="true"] { border-color: var(--pf-blue); color: var(--pf-blue); background: var(--pf-blue-subtle); }
.psyfi-billing .pf-trust-chip { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 10px 14px; border-radius: 11px; background: var(--pf-surface-3); font-size: 12px; color: var(--pf-fg3); }

/* --- Motion --- */
@keyframes pf-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pf-scale-in { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pf-scrim { from { opacity: 0; } to { opacity: 1; } }
.psyfi-billing .pf-anim-grid { animation: pf-fade-up .2s ease; }
.psyfi-billing .pf-overlay { animation: pf-scrim .18s ease; }
.psyfi-billing .pf-overlay-card { animation: pf-scale-in .22s cubic-bezier(.4, 0, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  .psyfi-billing .pf-anim-grid,
  .psyfi-billing .pf-overlay,
  .psyfi-billing .pf-overlay-card { animation: none; }
}

/* --- Settings modal: keep the left tab nav static while the right panel scrolls.
   The modal body (modal-dialog-scrollable) is the scroll container; pinning the
   nav column keeps the tabs in view while billing content scrolls past. --- */
@media (min-width: 992px) {
  #settingsModal .settings-nav-col {
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 2;
  }
}

/* --- Settings billing tab: dark-mode-aware surfaces. The theme sets
   data-bs-theme="dark" on <html> (Bootstrap 5.3 native dark mode), so the
   bespoke surface/ink/border tokens remap to the theme's card values. --- */
[data-bs-theme="dark"] .psyfi-billing {
  /* Match the chat area's dark blue (it uses --bs-body-bg) instead of the
     grayer near-black --bs-card-bg fallback. */
  --pf-surface: var(--bs-body-bg, #111c2d);
  --pf-surface-2: rgba(255, 255, 255, .04);
  --pf-surface-3: rgba(255, 255, 255, .07);
  --pf-ink: var(--bs-body-color, #e9eef5);
  --pf-fg2: rgba(233, 238, 245, .82);
  --pf-fg3: rgba(233, 238, 245, .60);
  --pf-fg4: rgba(233, 238, 245, .42);
  --pf-border: var(--bs-border-color, rgba(255, 255, 255, .12));
  --pf-border-strong: rgba(255, 255, 255, .22);
  --pf-blue-subtle: rgba(0, 133, 219, .16);
}
/* Elements with hardcoded light backgrounds need explicit dark treatment.
   The icon-well tint is set inline per plan, so override it (keep the glyph color). */
[data-bs-theme="dark"] .psyfi-billing .pf-icon-well { background-color: rgba(255, 255, 255, .06) !important; }
[data-bs-theme="dark"] .psyfi-billing .pf-pm-chip { background: rgba(255, 255, 255, .12); }
[data-bs-theme="dark"] .psyfi-billing .pf-btn-outline,
[data-bs-theme="dark"] .psyfi-billing .pf-cancel-btn { background: transparent; }
[data-bs-theme="dark"] .psyfi-billing .pf-secondary-row { background: rgba(255, 255, 255, .04); }
[data-bs-theme="dark"] .psyfi-billing .pf-btn-light,
[data-bs-theme="dark"] .psyfi-billing .pf-btn-select { color: #5cb8f2; }
[data-bs-theme="dark"] .psyfi-billing .pf-cancel-row {
  background: rgba(255, 102, 146, .09);
  border-color: rgba(255, 102, 146, .28);
}
/* In dark mode the card surface can match the modal/body navy, so give cards a
   subtle border for separation. */
[data-bs-theme="dark"] .psyfi-billing .pf-card { border: 1px solid rgba(255, 255, 255, .08); }

/* Free-text "Other" reason field in the cancel overlay (theme-aware via tokens). */
.psyfi-billing .pf-reason-input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--pf-border-strong);
  background: var(--pf-surface);
  color: var(--pf-ink);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 13px;
}
.psyfi-billing .pf-reason-input::placeholder { color: var(--pf-fg4); }
.psyfi-billing .pf-reason-input:focus { outline: none; border-color: var(--pf-blue); }

/* --- Change-plan confirmation modal --- */
.psyfi-billing .pf-cp-card { width: 560px; }
.psyfi-billing .pf-cp-inner { padding: 24px; }
.psyfi-billing .pf-cp-title { font-family: var(--pf-display); font-weight: 800; font-size: 18px; color: var(--pf-ink); }
.psyfi-billing .pf-cp-sub { font-size: 13px; color: var(--pf-fg3); margin-top: 6px; line-height: 1.5; }
.psyfi-billing .pf-cp-proration { margin-top: 12px; font-family: var(--pf-display); font-weight: 700; font-size: 13px; color: var(--pf-blue-700); background: var(--pf-blue-subtle); border-radius: 9px; padding: 9px 13px; }
[data-bs-theme="dark"] .psyfi-billing .pf-cp-proration { color: #7cc4f5; background: rgba(0, 133, 219, .12); }
.psyfi-billing .pf-cp-compare { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin: 18px 0 4px; }
.psyfi-billing .pf-cp-plan { border: 1.5px solid var(--pf-border); border-radius: 14px; padding: 14px; background: var(--pf-surface); align-self: stretch; }
.psyfi-billing .pf-cp-plan-new { border-color: var(--pf-blue); box-shadow: 0 6px 20px rgba(0, 133, 219, .18); }
.psyfi-billing .pf-cp-eyebrow { font-family: ui-monospace, Menlo, monospace; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--pf-fg4); margin-bottom: 8px; }
.psyfi-billing .pf-cp-plan-new .pf-cp-eyebrow { color: var(--pf-blue); }
.psyfi-billing .pf-cp-head { display: flex; align-items: center; gap: 10px; }
.psyfi-billing .pf-cp-head .pf-icon-well { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
.psyfi-billing .pf-cp-name { font-family: var(--pf-display); font-weight: 800; font-size: 14.5px; color: var(--pf-ink); line-height: 1.1; }
.psyfi-billing .pf-cp-price { font-family: var(--pf-display); font-weight: 700; font-size: 13px; color: var(--pf-fg3); margin-top: 2px; }
.psyfi-billing .pf-cp-feats { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.psyfi-billing .pf-cp-feat { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--pf-fg2); line-height: 1.35; }
.psyfi-billing .pf-cp-feat i { color: var(--pf-success); font-size: 15px; flex: 0 0 auto; margin-top: 1px; }
.psyfi-billing .pf-cp-arrow { width: 30px; height: 30px; border-radius: 50%; background: var(--pf-surface-3); color: var(--pf-fg3); display: flex; align-items: center; justify-content: center; font-size: 16px; flex: 0 0 auto; margin: 0 auto; }
.psyfi-billing .pf-cp-actions { display: flex; gap: 10px; margin-top: 20px; }
.psyfi-billing .pf-cp-btn { flex: 1; padding: 12px; border-radius: 10px; font-size: 14px; }

/* --- Brief toast (plan-change confirmation) --- */
.psyfi-billing .pf-toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translate(-50%, 8px);
  background: #0d1726;
  color: #fff;
  font-family: var(--pf-display);
  font-weight: 600;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
  z-index: 10;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  white-space: nowrap;
}
.psyfi-billing .pf-toast.pf-toast-show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .psyfi-billing .pf-toast { transition: none; }
}
/* Dark mode: the "current" compare card reads as muted, the new one keeps the blue accent. */
[data-bs-theme="dark"] .psyfi-billing .pf-cp-plan { background: rgba(255, 255, 255, .03); }
[data-bs-theme="dark"] .psyfi-billing .pf-cp-plan-new { background: rgba(0, 133, 219, .07); }

/* --- Scheduled-to-cancel state of the cancel row (with a Reactivate CTA) --- */
.psyfi-billing .pf-cancel-row--scheduled { background: var(--pf-warning-subtle); border-color: #ffe2ad; }
.psyfi-billing .pf-cancel-btn--reactivate { background: var(--pf-blue); border-color: var(--pf-blue); color: #fff; }
.psyfi-billing .pf-cancel-btn--reactivate:hover { background: var(--pf-blue-600); }
[data-bs-theme="dark"] .psyfi-billing .pf-cancel-row--scheduled { background: rgba(255, 185, 0, .10); border-color: rgba(255, 185, 0, .30); }
[data-bs-theme="dark"] .psyfi-billing .pf-cancel-btn--reactivate { background: var(--pf-blue); color: #fff; }

/* --- Gap #1: payment-state alert banner + corrected status badges --- */
.psyfi-billing .pf-alert { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 14px; border: 1px solid; }
.psyfi-billing .pf-alert-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.psyfi-billing .pf-alert-body { flex: 1; min-width: 0; }
.psyfi-billing .pf-alert-title { font-family: var(--pf-display); font-weight: 800; font-size: 14.5px; }
.psyfi-billing .pf-alert-sub { font-size: 12.5px; margin-top: 2px; line-height: 1.45; color: var(--pf-fg2); }
.psyfi-billing .pf-alert .pf-btn-primary { font-size: 13px; padding: 10px 15px; white-space: nowrap; }
.psyfi-billing .pf-alert--warn { background: var(--pf-warning-subtle); border-color: #ffe2ad; }
.psyfi-billing .pf-alert--warn .pf-alert-ico { background: #ffe7b0; color: var(--pf-warning-deep); }
.psyfi-billing .pf-alert--warn .pf-alert-title { color: #7a5a00; }
.psyfi-billing .pf-alert--danger { background: #fff5f8; border-color: var(--pf-danger-subtle); }
.psyfi-billing .pf-alert--danger .pf-alert-ico { background: var(--pf-danger-subtle); color: var(--pf-danger-deep); }
.psyfi-billing .pf-alert--danger .pf-alert-title { color: var(--pf-danger-deep); }
.psyfi-billing .pf-badge-warning { background: var(--pf-warning-subtle); color: var(--pf-warning-deep); }
.psyfi-billing .pf-badge-danger { background: var(--pf-danger-subtle); color: var(--pf-danger-deep); }
.psyfi-billing .pf-badge-free { background: var(--pf-surface-3); color: var(--pf-fg3); }
/* promo code entry (#8) */
.psyfi-billing .pf-promo { padding: 2px 2px 0; }
.psyfi-billing .pf-promo-form { display: flex; gap: 8px; margin-top: 9px; }
.psyfi-billing .pf-promo-input { flex: 1; padding: 9px 12px; border-radius: 9px; border: 1.5px solid var(--pf-border-strong); background: var(--pf-surface); color: var(--pf-ink); font-family: 'Open Sans', system-ui, sans-serif; font-size: 13px; text-transform: uppercase; }
.psyfi-billing .pf-promo-input::placeholder { color: var(--pf-fg4); text-transform: none; }
.psyfi-billing .pf-promo-input:focus { outline: none; border-color: var(--pf-blue); }
.psyfi-billing .pf-promo-msg { margin-top: 8px; font-size: 12px; font-weight: 600; }
.psyfi-billing .pf-promo-msg--ok { color: var(--pf-success-deep); }
.psyfi-billing .pf-promo-msg--err { color: var(--pf-danger-deep); }
[data-bs-theme="dark"] .psyfi-billing .pf-promo-msg--ok { color: #34d8c4; }
[data-bs-theme="dark"] .psyfi-billing .pf-promo-msg--err { color: #ff8fb0; }
/* info variant — scheduled period-end downgrade notice (#4) */
.psyfi-billing .pf-alert--info { background: var(--pf-blue-subtle); border-color: #bfe2f7; }
.psyfi-billing .pf-alert--info .pf-alert-ico { background: #cfe9fb; color: var(--pf-blue-700); }
.psyfi-billing .pf-alert--info .pf-alert-title { color: var(--pf-blue-700); }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--info { background: rgba(0, 133, 219, .12); border-color: rgba(0, 133, 219, .34); }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--info .pf-alert-title { color: #7cc4f5; }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--info .pf-alert-ico { background: rgba(0, 133, 219, .20); color: #7cc4f5; }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--warn { background: rgba(255, 185, 0, .10); border-color: rgba(255, 185, 0, .30); }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--warn .pf-alert-title { color: #ffcf66; }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--warn .pf-alert-ico { background: rgba(255, 185, 0, .18); color: #ffcf66; }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--danger { background: rgba(255, 102, 146, .10); border-color: rgba(255, 102, 146, .30); }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--danger .pf-alert-title { color: #ff8fb0; }
[data-bs-theme="dark"] .psyfi-billing .pf-alert--danger .pf-alert-ico { background: rgba(255, 102, 146, .18); color: #ff8fb0; }

/* --- Gap #3: in-flight button spinner (lock async billing buttons) --- */
.psyfi-billing .pf-spin { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pf-spin .6s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes pf-spin { to { transform: rotate(360deg); } }
.psyfi-billing [aria-busy="true"] { cursor: progress; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .psyfi-billing .pf-spin { animation-duration: 1.4s; } }

/* --- Gap #2: team seats card --- */
.psyfi-billing .pf-badge-owner { background: var(--pf-secondary-subtle); color: #6b46c1; }
.psyfi-billing .pf-seat-breakdown { font-size: 11.5px; color: var(--pf-fg3); margin-top: 10px; }
.psyfi-billing .pf-seat-breakdown b { color: var(--pf-fg2); font-family: var(--pf-display); font-weight: 700; }
.psyfi-billing .pf-seat-manage { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--pf-border); flex-wrap: wrap; }
.psyfi-billing .pf-stepper { display: inline-flex; align-items: center; gap: 6px; }
.psyfi-billing .pf-step-btn { width: 32px; height: 32px; border-radius: 9px; border: 1.5px solid var(--pf-border-strong); background: var(--pf-surface); font-size: 18px; line-height: 1; color: var(--pf-fg2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.psyfi-billing .pf-step-btn:disabled { opacity: .4; cursor: not-allowed; }
.psyfi-billing .pf-step-val { font-family: var(--pf-display); font-weight: 800; font-size: 16px; min-width: 30px; text-align: center; color: var(--pf-ink); }
.psyfi-billing .pf-seat-cost { font-size: 11.5px; color: var(--pf-fg3); }
.psyfi-billing .pf-seat-cost b { color: var(--pf-ink); font-family: var(--pf-display); }
.psyfi-billing .pf-btn-update { background: var(--pf-blue); color: #fff; font-weight: 700; font-size: 12.5px; padding: 8px 14px; border-radius: 9px; }
.psyfi-billing .pf-btn-update:hover { background: var(--pf-blue-600); }
[data-bs-theme="dark"] .psyfi-billing .pf-badge-owner { background: rgba(137, 101, 229, .20); color: #b9a6f0; }
