:root {
	--cyw-primary: #0c9fed;
	--cyw-navy: #032b4c;
	--cyw-primary-hover: #087fbd;
	--cyw-primary-soft: #e7f5fd;
	--cyw-gray: #374151;
	--cyw-text-muted: #6b7280;
	--cyw-page: #f4f7fb;
	--cyw-surface: #ffffff;
	--cyw-surface-subtle: #f8fafc;
	--cyw-border: #dce4ee;
	--cyw-border-strong: #c7d3e0;
	--cyw-positive: #16794b;
	--cyw-positive-soft: #e8f7ef;
	--cyw-negative: #c93745;
	--cyw-negative-soft: #fdf0f1;
	--cyw-warning: #9a6700;
	--cyw-warning-soft: #fff8df;
	--cyw-surface-muted: #eef2f7;
	--cyw-text-faint: #a9b4c2;
	--cyw-radius-sm: 0.5rem;
	--cyw-radius: 0.875rem;
	--cyw-radius-lg: 1.25rem;
	--cyw-shadow-sm: 0 1px 2px rgba(3, 43, 76, 0.06);
	--cyw-shadow: 0 12px 30px rgba(3, 43, 76, 0.08);
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--cyw-gray);
	background: var(--cyw-page);
	line-height: 1.5;
}

.text-primary {
	color: var(--cyw-primary) !important;
}

.text-navy {
	color: var(--cyw-navy) !important;
}

.bg-primary {
	background-color: var(--cyw-primary) !important;
}

.bg-navy {
	background-color: var(--cyw-navy) !important;
}

.btn-primary {
	background-color: var(--cyw-primary);
	border-color: var(--cyw-primary);
	box-shadow: 0 2px 4px rgba(12, 159, 237, 0.2);
	font-weight: 600;
}

	.btn-primary:hover {
		background-color: var(--cyw-primary-hover);
		border-color: var(--cyw-primary-hover);
	}

.btn-outline-primary {
	color: var(--cyw-primary);
	border-color: var(--cyw-primary);
}

	.btn-outline-primary:hover {
		background-color: var(--cyw-primary);
		border-color: var(--cyw-primary);
	}

.btn-outline-secondary {
	border-color: var(--cyw-border-strong);
	color: #4b5563;
	font-weight: 600;
}

	.btn-outline-secondary:hover {
		background: var(--cyw-surface-subtle);
		border-color: #9caebe;
		color: var(--cyw-navy);
	}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
a:focus-visible,
button:focus-visible {
	outline: 3px solid rgba(12, 159, 237, 0.35);
	outline-offset: 2px;
}

.form-control,
.form-select {
	border-color: var(--cyw-border-strong);
	border-radius: var(--cyw-radius-sm);
	min-height: 2.5rem;
}

	.form-control:focus,
	.form-select:focus {
		border-color: var(--cyw-primary);
		box-shadow: 0 0 0 0.2rem rgba(12, 159, 237, 0.14);
	}

input[type="checkbox"] {
	appearance: none;
	width: 1rem;
	height: 1rem;
	margin: 0;
	border: 1px solid var(--cyw-border-strong);
	border-radius: 0.25rem;
	background: var(--cyw-surface);
	vertical-align: -0.12em;
	cursor: pointer;
}

	input[type="checkbox"]:checked {
		border-color: var(--cyw-primary);
		background-color: var(--cyw-primary);
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='m3 8 3 3 7-7'/%3E%3C/svg%3E");
	}

	input[type="checkbox"]:disabled {
		cursor: not-allowed;
		opacity: 0.55;
	}

.card,
.modal-content {
	border-color: var(--cyw-border);
}

.app-surface {
	background: var(--cyw-surface);
	border: 1px solid var(--cyw-border);
	border-radius: var(--cyw-radius-lg);
	box-shadow: var(--cyw-shadow-sm);
}

.text-success {
	color: var(--cyw-positive) !important;
}

.text-danger {
	color: var(--cyw-negative) !important;
}

.alert-error {
	background-color: #ffebee;
	border: 1px solid #ef9a9a;
	color: #c62828;
	padding: 1rem;
	border-radius: 0.5rem;
	margin-bottom: 1rem;
}

/* App Loading Screen - shown while Blazor initializes */
#app-loading {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #032b4c 0%, #054a7a 50%, #0c9fed 100%);
	padding: 1rem;
}

	#app-loading .loading-card {
		background: white;
		border-radius: 1rem;
		box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
		padding: 2.5rem;
		width: 100%;
		max-width: 420px;
		text-align: center;
	}

	#app-loading .loading-logo {
		max-width: 280px;
		height: auto;
		margin-bottom: 1.5rem;
	}

	#app-loading .loading-text {
		color: #6c757d;
		font-size: 1rem;
		margin-bottom: 1rem;
	}

	#app-loading .loading-spinner {
		width: 40px;
		height: 40px;
		border: 3px solid #e9ecef;
		border-top-color: #0c9fed;
		border-radius: 50%;
		animation: spin 1s linear infinite;
		margin: 0 auto;
	}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Fix for EditForm inside scrollable modals - the <form> element breaks
   Bootstrap's flex chain between .modal-content and .modal-body */
.modal-dialog-scrollable .modal-content > form {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	flex: 1;
	min-height: 0;
}

/* Password reveal toggle */
.password-input-wrapper {
	position: relative;
}

	.password-input-wrapper .form-control {
		padding-right: 3rem;
	}

.password-toggle-btn {
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: #9e9e9e;
	cursor: pointer;
	padding: 0.25rem;
	line-height: 1;
}

	.password-toggle-btn:hover {
		color: var(--cyw-navy);
	}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* ════════════════════════════════════════════════════════════════════════════
   Insight vocabulary

   Shared by the dashboard and the asset page. These live here rather than in a
   component's scoped sheet because they style markup a *caller* passes in - a
   chart dropped into an InsightCard body, a chip beside a figure - and scoped
   CSS only reaches the component that rendered the element.
   ════════════════════════════════════════════════════════════════════════════ */

/* Cards arrive in reading order rather than all at once. */
@keyframes cyw-rise {
	from {
		opacity: 0;
		transform: translateY(15px);
	}
}

.reveal {
	animation: cyw-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
	animation-delay: calc(var(--reveal-order, 0) * 60ms);
}

/* The reset above collapses animation *durations*, but not delays - left alone the
   stagger would still hold the last card invisible for close to half a second. */
@media (prefers-reduced-motion: reduce) {
	.reveal {
		animation: none;
	}
}

/* Icons ride in a tinted chip rather than floating loose against the surface. */
.insight-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	flex-shrink: 0;
	border-radius: 0.65rem;
	background: linear-gradient(140deg, rgba(12, 159, 237, 0.18), rgba(3, 43, 76, 0.07));
	color: var(--cyw-primary);
	font-size: 0.85rem;
}

.insight-chart {
	width: 100%;
}

	/* Full-bleed sideways, but not into the bottom border - a series sitting on the axis
	   floor (liabilities at zero) would otherwise be sliced in half by the card edge.
	   Cards in a row are as tall as the tallest, so the chart takes the slack rather than
	   leaving a void above itself. */
	.insight-chart--bleed {
		flex: 1;
		min-height: 8rem;
		margin: auto -1px 0;
		padding-bottom: 3px;
	}

		.insight-chart--bleed > div {
			height: 100%;
		}

.insight-empty {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 1rem;
	color: var(--cyw-text-faint);
	font-size: 0.875rem;
	text-align: center;
}

	.insight-empty i {
		font-size: 2rem;
		opacity: 0.5;
	}

.insight-legend {
	display: flex;
	gap: 1rem;
	padding: 0 1.25rem 0.25rem;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--cyw-text-muted);
}

.insight-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.legend-key {
	width: 0.85rem;
	height: 2px;
	border-radius: 999px;
}

.assets-key {
	background: var(--cyw-positive);
}

.liabilities-key {
	background: var(--cyw-negative);
}

/* A signed change, sized to sit beside a figure rather than compete with it. */
.delta-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	align-self: flex-start;
	margin-top: 0.45rem;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
	white-space: nowrap;
}

	.delta-chip i {
		font-size: 0.7rem;
	}

	.delta-chip.positive {
		background: var(--cyw-positive-soft);
		color: var(--cyw-positive);
	}

	.delta-chip.negative {
		background: var(--cyw-negative-soft);
		color: var(--cyw-negative);
	}

	.delta-chip.neutral {
		background: var(--cyw-surface-muted);
		color: var(--cyw-text-muted);
	}

.delta-percent {
	padding-left: 0.45rem;
	margin-left: 0.1rem;
	border-left: 1px solid currentColor;
	opacity: 0.75;
	font-weight: 600;
}

/* ── Panel furniture (inside insight modals and cards) ────────────────────── */

.modal-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 1rem;
}

.modal-section-title {
	margin: 1.5rem 0 0.75rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--cyw-text-muted);
}

.modal-note {
	margin: 0 0 0.75rem;
	font-size: 0.8rem;
	color: var(--cyw-text-muted);
}

.modal-chart {
	padding: 0.25rem 0;
}

.modal-chart--donut {
	margin-bottom: 0.75rem;
}

	/* ApexCharts renders the centre label at its own scale; bring it back into the
	   type ramp so the ring reads as a figure rather than a headline. */
	.modal-chart--donut .apexcharts-datalabel-label {
		font-size: 0.72rem;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		fill: var(--cyw-text-muted);
	}

	.modal-chart--donut .apexcharts-datalabel-value {
		font-size: 1.15rem;
		font-weight: 700;
		fill: var(--cyw-navy);
	}

/* ── Empty states ─────────────────────────────────────────────────────────── */

.empty-state {
	text-align: center;
	padding: 2rem 1rem;
	color: var(--cyw-text-muted);
}

.empty-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
	opacity: 0.5;
}

.empty-state p {
	margin-bottom: 0.25rem;
	font-weight: 500;
}

.empty-state small {
	color: var(--cyw-text-faint);
}
