header#topbar {
	height: 65px;
	background: #f2f1ef;
	border-bottom: 1px solid var(--border);
	position: fixed;
	top: 0px;
	left: 0px;
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 30px 0 calc(var(--left-width, 70px) + 30px);
	z-index: 1000;
}

header#topbar section#top-left {
	display: flex;
	align-items: center;
	min-width: 0;
}

header#topbar nav#top-breadcrumb {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #8c8c8c;
	font-size: 8pt;
	font-weight: 500;
	text-transform: uppercase;
	white-space: nowrap;
}

header#topbar nav#top-breadcrumb a {
	text-decoration: none;
}

header#topbar nav#top-breadcrumb .top-breadcrumb-brand {
	color: var(--brand);
	font-weight: 600;
}

header#topbar nav#top-breadcrumb .top-breadcrumb-divider,
header#topbar nav#top-breadcrumb .top-breadcrumb-separator {
	color: #b3b0b1;
}

header#topbar nav#top-breadcrumb strong {
	color: #777777;
	font-weight: 500;
}

header#topbar section#top-right {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 1rem;
}

header#topbar article#top-connector-health {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	max-width: min(420px, 34vw);
	padding: 8px 11px;
	border: 1px solid color-mix(in srgb, #d98b18 38%, var(--border));
	border-radius: 999px;
	background: #fff9ec;
	color: #8a5709;
	cursor: pointer;
}

header#topbar article#top-connector-health[hidden] { display: none; }
header#topbar article#top-connector-health[data-state="offline"] { border-color: #efc0bd; background: #fff1f0; color: #9f2824; }
header#topbar article#top-connector-health > i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #e39a2d; box-shadow: 0 0 0 4px rgba(227,154,45,.13); }
header#topbar article#top-connector-health[data-state="offline"] > i { background: #e44943; box-shadow: 0 0 0 4px rgba(228,73,67,.13); }
header#topbar article#top-connector-health > strong { overflow: hidden; font-size: 8pt; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

header#topbar .top-dropdown[data-dropdown="connector-health"] { right: 300px; width: min(390px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
header#topbar .top-connector-health-details > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 15px 16px 12px; border-bottom: 1px solid var(--border); }
header#topbar .top-connector-health-details > header strong { margin: 0; }
header#topbar .top-connector-health-details > header span { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; }
header#topbar .top-connector-health-details > p { padding: 16px; }
header#topbar .top-connector-health-list { display: grid; max-height: min(420px, calc(100vh - 190px)); overflow-y: auto; }
header#topbar .top-connector-health-list article { display: grid; gap: 4px; padding: 13px 16px; border-bottom: 1px solid #ece9e3; }
header#topbar .top-connector-health-list article::before { grid-row: 1 / span 2; width: 7px; height: 7px; align-self: center; margin-right: 2px; border-radius: 50%; background: #e39a2d; content: ''; }
header#topbar .top-connector-health-list article[data-state="offline"]::before { background: #e44943; }
header#topbar .top-connector-health-list article strong,
header#topbar .top-connector-health-list article span { grid-column: 2; }
header#topbar .top-connector-health-list article strong { margin: 0; font-size: 9.5pt; }
header#topbar .top-connector-health-list article span { color: var(--muted); font-size: 8pt; }
header#topbar .top-connector-health-details > footer { padding: 8px; background: #f8f7f4; }
header#topbar .top-connector-health-details > footer a { justify-content: center; color: var(--brand); }

.horus-global-toast-region { position: fixed; z-index: 1200; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(390px, calc(100vw - 36px)); pointer-events: none; }
.horus-global-toast { padding: 13px 15px; border: 1px solid #e4b86f; border-radius: 8px; background: #fff9eb; box-shadow: 0 16px 35px rgba(20,24,32,.18); color: #77500f; font-size: 9pt; font-weight: 700; line-height: 1.4; }
.horus-global-toast[data-tone="critical"] { border-color: #efb8b4; background: #fff1f0; color: #942b27; }
.horus-global-toast[data-tone="success"] { border-color: #a8d8ba; background: #f0fbf4; color: #286b43; }

header#topbar article#top-workspace {
	display: flex;
	align-items: center;
	gap: 7px;
	max-width: 230px;
	padding: 8px 12px;
	border: 1px solid var(--border);
	border-radius: 7px;
	background: #fff;
	cursor: pointer;
}

header#topbar article#top-workspace span { color: var(--muted); font-size: 7.5pt; text-transform: uppercase; }
header#topbar article#top-workspace strong { overflow: hidden; color: var(--text); font-size: 8.5pt; text-overflow: ellipsis; white-space: nowrap; }
header#topbar .top-dropdown[data-dropdown="workspace"] { right: 235px; }
header#topbar .top-dropdown button:disabled { color: var(--brand); cursor: default; opacity: 1; }

header#topbar section#top-right article#top-tokens {
	font-size: 8pt;
	font-weight: 500;
	padding: 10px 15px;
	background: #ffffff;
	border-radius: 20px;
	line-height: 150%;
	color: #343a40ac;
	border: 1px solid var(--border);
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 1ch;
}

header#topbar section#top-right article#top-tokens #top-tokens-dot {
	width: 8px;
	height: 8px;
	border-radius: 10px;
	background: #55b779;
}

header#topbar article#top-bell {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	width: 34px;
	height: 34px;
	border-radius: 17px;
	transition: background 200ms;
}

header#topbar article#top-bell:hover,
header#topbar article#top-bell[aria-expanded="true"] {
	background: #ffffff;
}

header#topbar article#top-bell svg {
	width: 18px;
	height: 18px;
	stroke: #343a40ac;
}

header#topbar article#top-profile {
	width: 40px;
	height: 40px;
	border-radius: 25px;

	display: flex;
	justify-content: center;
	align-items: center;
	background: var(--bg-inner);

	font-size: 9pt;
	font-weight: 600;
	color: #343a4090;

	cursor: pointer;
	transition: border 200ms, color 200ms;
}

header#topbar article#top-profile[aria-expanded="true"] {
	border: 1px solid var(--brand);
	color: var(--brand);
}

header#topbar .top-dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 30px;
	width: 260px;
	padding: 16px;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 16px 35px rgba(21, 25, 34, 0.12);
	z-index: 25;
}

header#topbar .top-dropdown[hidden] {
	display: none;
}

header#topbar .top-dropdown[data-dropdown="notifications"] {
	width: min(390px, calc(100vw - 24px));
	padding: 0;
	overflow: hidden;
}

header#topbar .top-notification-badge {
	position: absolute;
	top: -3px;
	right: -5px;
	min-width: 18px;
	height: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
	border: 2px solid #f2f1ef;
	border-radius: 999px;
	background: var(--brand);
	color: #fff;
	font-size: 8px;
	font-weight: 800;
	line-height: 1;
}

header#topbar .top-notification-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 15px 16px 12px;
	border-bottom: 1px solid var(--border);
}

header#topbar .top-dropdown .top-notification-header strong {
	margin: 0;
}

header#topbar .top-dropdown .top-notification-header button {
	width: auto;
	min-height: 28px;
	padding: 0 8px;
	color: var(--brand);
	font-size: 8pt;
}

header#topbar .top-dropdown .top-notification-state {
	margin: 0;
	padding: 18px 16px;
}

header#topbar .top-dropdown .top-notification-state[hidden] {
	display: none;
}

header#topbar .top-notification-list {
	max-height: min(430px, calc(100vh - 190px));
	overflow-y: auto;
	overscroll-behavior: contain;
}

header#topbar .top-dropdown a.top-notification-item {
	position: relative;
	width: 100%;
	min-height: 0;
	display: grid;
	align-items: initial;
	gap: 5px;
	padding: 12px 16px 12px 19px;
	border-bottom: 1px solid #ece9e3;
	border-radius: 0;
	background: #fff;
}

header#topbar .top-dropdown a.top-notification-item::before {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 3px;
	background: #a7a39b;
	content: '';
}

header#topbar .top-dropdown a.top-notification-item[data-severity="warning"]::before {
	background: #d78a13;
}

header#topbar .top-dropdown a.top-notification-item[data-severity="critical"]::before {
	background: var(--brand);
}

header#topbar .top-dropdown a.top-notification-item.is-unread {
	background: #fff9f8;
}

header#topbar .top-dropdown a.top-notification-item:hover {
	background: #f5f3ef;
}

header#topbar .top-notification-item-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	color: #8a857c;
	font-size: 8px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
}

header#topbar .top-dropdown .top-notification-item > strong {
	margin: 0;
	font-size: 9.5pt;
	line-height: 1.3;
}

header#topbar .top-dropdown .top-notification-item > p {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	font-size: 8.5pt;
	line-height: 1.4;
}

header#topbar .top-dropdown .top-notification-item > small {
	color: #6c6860;
	font-size: 8pt;
	font-weight: 700;
}

header#topbar .top-notification-footer {
	padding: 8px;
	background: #f8f7f4;
}

header#topbar .top-dropdown .top-notification-footer a {
	justify-content: center;
	color: var(--brand);
}

header#topbar .top-dropdown strong {
	display: block;
	margin-bottom: 8px;
	font-size: 10pt;
	font-weight: 600;
	color: var(--text);
}

header#topbar .top-dropdown p {
	margin: 0 0 12px;
	font-size: 9pt;
	line-height: 150%;
	color: var(--muted);
}

header#topbar .top-dropdown a,
header#topbar .top-dropdown button {
	width: 100%;
	display: flex;
	align-items: center;
	min-height: 36px;
	padding: 0 10px;
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: #343a40;
	font-size: 9pt;
	font-weight: 500;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

header#topbar .top-dropdown a:hover,
header#topbar .top-dropdown button:hover {
	background: #f2f1ef;
}

header#topbar .top-dropdown form {
	margin: 4px 0 0;
}

header#topbar [role="button"]:focus-visible,
header#topbar .top-dropdown :is(a, button):focus-visible {
	outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent);
	outline-offset: 2px;
}

@media (max-width: 760px) {
	header#topbar {
		padding: 0 12px;
	}

	header#topbar section#top-left,
	header#topbar section#top-right article#top-tokens {
		display: none;
	}

	header#topbar section#top-right {
		width: 100%;
		justify-content: flex-end;
		gap: 8px;
	}

	header#topbar article#top-connector-health {
		max-width: min(40vw, 220px);
		order: -1;
		padding: 7px 9px;
	}

	header#topbar article#top-connector-health > strong { font-size: 7.5pt; }

	header#topbar article#top-workspace {
		max-width: min(180px, calc(100vw - 142px));
		margin-right: auto;
	}

	header#topbar article#top-profile {
		width: 38px;
		height: 38px;
		flex: 0 0 38px;
	}

	header#topbar .top-dropdown,
	header#topbar .top-dropdown[data-dropdown="workspace"],
	header#topbar .top-dropdown[data-dropdown="notifications"] {
		right: 12px;
		width: min(320px, calc(100vw - 24px));
	}

	header#topbar .top-dropdown[data-dropdown="connector-health"] { right: 12px; width: min(360px, calc(100vw - 24px)); }
}
