/* Plan Magic client portal prototype — WCAG 2.2 AA + First2Care CLF */

:root {
	--primary: #5000aa;
	--primary-dark: #3a007d;
	--accent: #4b916d;
	--text: #2d2e2d;
	--title: #151414;
	--bg: #f5f3f8;
	--box-bg: #ffffff;
	--link: #3a007d;
	--button-bg: #5000aa;
	--button-text: #ffffff;
	--border: #c7c7c7;
	--muted: #525150;
	--surface: #f0edf5;
	--focus: #151414;
	--font: Arial, Calibri, Verdana, sans-serif;
	--space: 1rem;
	--max-width: 42rem;
	--header-height: auto;
}

html {
	font-size: 100%;
}

html.large-print {
	font-size: 112.5%;
}

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

html,
body {
	height: 100%;
}

body.portal-shell {
	margin: 0;
	font-family: var(--font);
	font-size: 1rem;
	line-height: 1.5;
	color: var(--text);
	background: var(--bg);
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	padding: 0.75rem 1rem;
	background: var(--button-bg);
	color: var(--button-text);
	text-decoration: none;
}

.skip-link:focus {
	left: 0;
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	padding: 0.75rem var(--space);
	background: var(--box-bg);
	border-bottom: 1px solid var(--border);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (min-width: 48rem) {
	.site-header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
	}

	.site-header .toolbar {
		margin-top: 0;
		margin-left: auto;
	}
}

.brand-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.brand-logo {
	display: block;
	height: 2.75rem;
	width: auto;
	max-width: min(100%, 12rem);
}

.brand-copy {
	min-width: 12rem;
}

.site-header h1 {
	margin: 0 0 0.25rem;
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--title);
}

.signed-in {
	margin: 0;
	color: var(--muted);
}

.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: 0.75rem;
}

.layout {
	display: flex;
	flex-direction: column;
	gap: var(--space);
	flex: 1;
	min-height: 0;
	max-width: 56rem;
	width: 100%;
	margin: 0 auto;
	padding: var(--space);
	overflow: hidden;
}

@media (min-width: 48rem) {
	.layout.has-pins-expanded {
		flex-direction: row;
		align-items: stretch;
	}

	.layout.has-pins-expanded .pins-panel {
		flex: 0 0 14rem;
	}

	.layout.has-pins-expanded .chat-panel {
		flex: 1;
		min-width: 0;
	}
}

.pins-panel {
	background: var(--box-bg);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: var(--space);
}

.pins-panel.collapsed {
	background: transparent;
	border: none;
	padding: 0;
}

.pins-panel h2 {
	margin: 0 0 0.75rem;
	font-size: 1.0625rem;
	color: var(--title);
}

.pin-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pin-list[aria-hidden="true"] {
	display: none;
}

.pin-item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--border);
}

.pin-item:last-child {
	border-bottom: none;
}

.pin-item.dragging {
	opacity: 0.6;
}

.pin-item.drag-over {
	outline: 2px dashed var(--primary);
	outline-offset: 2px;
}

.pin-grip {
	cursor: grab;
	padding: 0.5rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
	border: 1px solid var(--border);
	background: var(--box-bg);
	border-radius: 4px;
	font-size: 0.875rem;
}

.pin-grip:active {
	cursor: grabbing;
}

.pin-link {
	flex: 1;
	min-width: 8rem;
	color: var(--link);
	text-decoration: underline;
	padding: 0.5rem 0;
	background: none;
	border: none;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.pin-kind {
	font-size: 0.875rem;
	color: var(--muted);
	width: 100%;
}

.pin-move {
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--border);
	background: var(--box-bg);
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.8125rem;
}

.chat-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
}

.conversation {
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.chat-panel.in-conversation .conversation {
	flex: 1;
}

.conversation-intro {
	margin-bottom: 0.75rem;
}

.conversation-intro h2 {
	margin: 0 0 0.35rem;
	font-size: 1.0625rem;
	color: var(--title);
}

.conversation-note {
	margin: 0;
	font-size: 0.875rem;
	color: var(--muted);
}

.chat-shell {
	display: flex;
	flex-direction: column;
	flex: 0 0 auto;
	background: var(--box-bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	box-shadow: 0 1px 4px rgba(80, 0, 170, 0.08);
	overflow: hidden;
}

.chat-shell:not(.is-empty) {
	flex: 1;
	min-height: 0;
}

.chat-scroll {
	flex: 1 1 0;
	overflow-y: auto;
	min-height: 0;
	padding: var(--space);
}

.chat-shell.is-empty .chat-scroll {
	flex: 0 0 auto;
	min-height: 0;
	padding: 0.5rem var(--space) 0;
}

.chat-shell.is-empty .chat-scroll:not(:has(.status-region:not(:empty))) {
	display: none;
}

.chat-empty-hint {
	margin: 0 0 0.75rem;
	color: var(--muted);
	font-size: 0.9375rem;
}

.chat-panel.in-conversation .chat-empty-hint {
	display: none;
}

.chat-log {
	list-style: none;
	margin: 0;
	padding: 0;
}

.chat-log li {
	margin-bottom: 1rem;
	padding: 0.75rem 1rem;
	border-radius: 4px;
	max-width: 100%;
}

.chat-log .user {
	background: var(--surface);
	border: 1px solid var(--border);
}

.chat-log .assistant {
	background: var(--box-bg);
	border: 1px solid var(--border);
}

.chat-log .meta {
	font-size: 0.875rem;
	color: var(--muted);
	margin-bottom: 0.35rem;
}

.confirm-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.chat-dock {
	flex: 0 0 auto;
	border-top: 1px solid var(--border);
	padding: var(--space);
	background: var(--surface);
}

.chat-shell.is-empty .chat-dock {
	border-top: none;
}

.suggested-wrap {
	margin-top: var(--space);
}

.suggested-wrap:first-child {
	margin-top: 0;
}

.suggested-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.suggested-header h3 {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--title);
}

.suggested-toggle {
	min-height: 2.25rem;
	padding: 0.35rem 0.75rem;
	font-size: 0.875rem;
}

.suggested-wrap.collapsed .suggested-prompts {
	display: none;
}

.suggested-prompts {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	max-height: 11rem;
	overflow-y: auto;
}

.suggested-prompts li {
	margin: 0;
}

.prompt-chip {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0.75rem 1rem;
	min-height: 2.75rem;
	border: 1px solid var(--border);
	background: var(--box-bg);
	border-radius: 4px;
	cursor: pointer;
	font-family: inherit;
	font-size: inherit;
	color: var(--text);
}

.prompt-chip:hover {
	border-color: var(--primary);
}

.prompt-chip:focus-visible {
	border-color: var(--primary);
}

.composer {
	display: grid;
	gap: 0.5rem;
}

@media (min-width: 36rem) {
	.composer {
		grid-template-columns: 1fr auto;
		grid-template-rows: auto auto;
		align-items: end;
	}

	.composer label {
		grid-column: 1 / -1;
	}

	.composer textarea {
		grid-column: 1;
	}

	.composer button[type="submit"] {
		grid-column: 2;
		grid-row: 2;
	}
}

.composer label {
	font-weight: 600;
	color: var(--title);
}

.composer textarea {
	width: 100%;
	min-height: 3rem;
	padding: 0.75rem;
	font-family: inherit;
	font-size: inherit;
	border: 2px solid var(--border);
	border-radius: 4px;
	resize: vertical;
	background: var(--box-bg);
}

.composer textarea:focus-visible {
	border-color: var(--primary);
}

button,
.button {
	font-family: inherit;
	font-size: inherit;
	cursor: pointer;
	min-height: 2.75rem;
	padding: 0.5rem 1rem;
	border-radius: 4px;
	border: 2px solid transparent;
}

button.primary,
.button.primary {
	background: var(--button-bg);
	color: var(--button-text);
	border-color: var(--button-bg);
}

button.secondary,
.button.secondary {
	background: var(--box-bg);
	color: var(--text);
	border-color: var(--border);
}

a {
	color: var(--link);
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
.pin-grip:focus-visible,
.pin-link:focus-visible,
.prompt-chip:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

.status-region {
	margin: 0 0 0.5rem;
	min-height: 1.5rem;
	font-size: 0.9375rem;
	color: var(--muted);
}

.site-footer {
	flex-shrink: 0;
	padding: var(--space);
	border-top: 1px solid var(--border);
	background: var(--box-bg);
	font-size: 0.9375rem;
}

.help-page {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: var(--space);
}

.help-page h1 {
	font-size: 1.25rem;
	color: var(--title);
}

.help-page ul {
	padding-left: 1.25rem;
}

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

@media (prefers-reduced-motion: reduce) {
	* {
		animation: none !important;
		transition: none !important;
	}
}
