:root {
	color-scheme: light;
	--bg-top: #f6f4f7;
	--bg-bottom: #ebe8ef;
	--panel: rgba(255, 255, 255, 0.86);
	--panel-strong: rgba(255, 255, 255, 0.94);
	--line: rgba(32, 37, 68, 0.1);
	--text: #1f2434;
	--muted: #6b7184;
	--primary: #6d57f5;
	--primary-strong: #4a38b8;
	--danger: #dd6c48;
	--header-bg: #2d2a3f;
	--header-line: rgba(255, 255, 255, 0.08);
	--shadow: 0 24px 70px rgba(49, 41, 89, 0.12);
	--header-height: 52px;
	font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

.eyebrow {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.card.dashboard-header,
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 8px;
	background: linear-gradient(180deg, rgba(45, 42, 63, 0.98), rgba(40, 37, 57, 0.96));
	border: 1px solid var(--header-line);
	box-shadow: none;
	position: relative;
	z-index: 20;
	overflow: visible;
}

.dashboard-header-main,
.topbar-title {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.dashboard-header .eyebrow,
.topbar .eyebrow {
	color: rgba(224, 223, 235, 0.72);
}

.dashboard-header h1,
.topbar .dataset-name {
	font-size: clamp(18px, 2vw, 24px);
	font-weight: 700;
	line-height: 1.1;
	color: #f8f7ff;
}

.dashboard-header .dashboard-copy {
	color: rgba(224, 223, 235, 0.72);
	font-size: 13px;
	line-height: 1.45;
	max-width: 72ch;
}

.topbar .dataset-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dashboard-header-actions,
.topbar .actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	position: relative;
	z-index: 61;
	overflow: visible;
}

.user-menu {
	position: relative;
	z-index: 62;
}

.user-menu-trigger {
	width: 42px;
	height: 42px;
	padding: 0;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.418);
	background: rgba(255, 255, 255, 0.08);
	box-shadow: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.user-menu-trigger:hover {
	background: rgba(255, 255, 255, 0.534);
	transform: translateY(-1px);
}

.user-menu-icon {
	width: 22px;
	height: 22px;
	display: block;
}

.user-menu-popover {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: min(260px, calc(100vw - 32px));
	padding: 14px 16px;
	border: 1px solid rgba(33, 37, 68, 0.12);
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 16px 36px rgba(31, 36, 52, 0.16);
	color: var(--text);
	z-index: 30;
}

.user-menu-popover[hidden] {
	display: none;
}

.user-menu-popover::before {
	content: "";
	position: absolute;
	top: -7px;
	right: 13px;
	width: 14px;
	height: 14px;
	transform: rotate(45deg);
	background: rgba(255, 255, 255, 0.98);
	border-top: 1px solid rgba(33, 37, 68, 0.12);
	border-left: 1px solid rgba(33, 37, 68, 0.12);
}

.user-menu-row {
	display: grid;
	gap: 4px;
	position: relative;
	z-index: 1;
}

.user-menu-row + .user-menu-row {
	margin-top: 10px;
}

.user-menu-label {
	font-size: 11px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

.user-menu-value {
	font-size: 14px;
	font-weight: 700;
	word-break: break-word;
}

.user-menu-actions {
	display: grid;
	gap: 8px;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid rgba(33, 37, 68, 0.08);
	position: relative;
	z-index: 1;
}

.user-menu-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--primary-strong);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	justify-content: flex-start;
}

.user-menu-link:hover {
	text-decoration: underline;
	transform: none;
}

.user-menu-link.is-disabled {
	color: var(--muted);
	cursor: default;
	pointer-events: none;
}

.user-menu-link.user-menu-logout {
	color: var(--danger);
}

.portal-modal-shell {
	position: fixed;
	inset: 0;
	z-index: 120;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(23, 42, 58, 0.38);
	backdrop-filter: blur(6px);
}

.portal-modal-shell.is-open {
	display: flex;
}

.portal-modal-card {
	width: min(760px, 100%);
	max-height: min(90vh, 920px);
	overflow: auto;
	padding: 24px;
	border: 1px solid rgba(23, 42, 58, 0.08);
	background: var(--panel-strong);
	box-shadow: 0 24px 60px rgba(16, 32, 48, 0.2);
	color: var(--text);
}

.portal-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 18px;
}

.portal-modal-header h2 {
	margin: 6px 0 0;
	font-size: clamp(24px, 3vw, 32px);
	line-height: 1.05;
}

.portal-modal-close {
	appearance: none;
	border: 1px solid rgba(23, 42, 58, 0.12);
	background: rgba(23, 24, 58, 0.08);
	color: var(--text);
	font: inherit;
	padding: 10px 14px;
	cursor: pointer;
}

.portal-modal-form {
	display: grid;
	gap: 16px;
}

.portal-modal-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.portal-modal-span-2 {
	grid-column: span 2;
}

.portal-modal-form label {
	display: grid;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
}

.portal-modal-form input,
.portal-modal-form select {
	width: 100%;
	padding: 14px 16px;
	border: 1px solid rgba(23, 42, 58, 0.14);
	background: rgba(255, 255, 255, 0.9);
	font: inherit;
	color: var(--text);
}

.portal-modal-form select[multiple] {
	min-height: 144px;
}

.portal-modal-note {
	font-size: 13px;
	line-height: 1.5;
	color: var(--muted);
}

.portal-modal-status {
	min-height: 20px;
	font-size: 13px;
	font-weight: 600;
	color: var(--muted);
}

.portal-modal-status.error {
	color: var(--danger);
}

.portal-modal-status.success {
	color: var(--primary-strong);
}

.portal-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	flex-wrap: wrap;
}

.topbar .button-link {
	padding: 8px 12px;
	font-size: 13px;
	line-height: 1.2;
}

@media (max-width: 980px) {
	.dashboard-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.dashboard-header-actions {
		justify-content: flex-start;
	}

	.user-menu-popover {
		left: 0;
		right: auto;
	}

	.portal-modal-shell {
		padding: 14px;
	}

	.portal-modal-form-grid {
		grid-template-columns: 1fr;
	}

	.portal-modal-span-2 {
		grid-column: span 1;
	}

	.user-menu-popover::before {
		left: 13px;
		right: auto;
	}
}

@media (max-width: 840px) {
	.topbar {
		flex-direction: column;
		align-items: stretch;
	}

	.topbar .actions {
		justify-content: stretch;
	}

	.topbar .actions > .button-link {
		width: 100%;
		text-align: center;
	}

	.topbar .dataset-name {
		white-space: normal;
	}

	.user-menu-popover {
		left: 0;
		right: auto;
	}

	.user-menu-popover::before {
		left: 13px;
		right: auto;
	}
}
