/**
 * xBot · Workspace shell CSS
 *
 * Topbar + sidebar (desktop ≥720px). Bottom tab bar (mobile <720px).
 * Two-tier sidebar: global on top, bot-scoped below with a visual depth cue.
 */

.ws {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--surface);
}

/* ---------- topbar ---------- */
.ws-topbar {
	height: 56px;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding-inline: var(--space-5);
	position: sticky;
	top: 0;
	z-index: var(--z-sticky);
}
.ws-logo {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--text);
	font-weight: 600;
	font-size: var(--text-md);
	text-decoration: none;
	letter-spacing: -0.005em;
}
.ws-logo:hover { text-decoration: none; color: var(--text); }
.ws-logo-mark {
	width: 26px; height: 26px;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-fg);
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: var(--text-sm);
}

.ws-search {
	flex: 1;
	max-width: 480px;
	height: 32px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding-inline: var(--space-3);
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--text-muted);
	font-size: var(--text-sm);
	cursor: text;
	transition: border-color var(--dur-fast);
}
.ws-search:hover { border-color: var(--border-strong); }
.ws-search__placeholder { font-weight: 400; }
.ws-search__kbd {
	margin-inline-start: auto;
	padding: 1px 5px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 3px;
	font-family: var(--font-mono);
	font-size: 10px;
	color: var(--text-muted);
}

.ws-actions { display: inline-flex; align-items: center; gap: var(--space-2); margin-inline-start: auto; }
.ws-icon-btn {
	width: 32px; height: 32px;
	border-radius: var(--radius-sm);
	background: transparent;
	border: 0;
	color: var(--text-secondary);
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	position: relative;
}
.ws-icon-btn:hover { background: var(--surface); color: var(--text); }
.ws-icon-btn__dot {
	position: absolute;
	top: 7px;
	inset-inline-end: 8px;
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--accent);
	border: 2px solid var(--bg);
}
.ws-avatar {
	width: 30px; height: 30px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #000));
	color: white;
	font-weight: 600;
	font-size: var(--text-sm);
	border: 0;
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.ws-account { position: relative; }
.ws-account__menu {
	position: absolute;
	top: calc(100% + var(--space-2));
	inset-inline-end: 0;
	min-width: 260px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	padding: var(--space-2);
	z-index: var(--z-popover, 100);
}
.ws-account__menu[hidden] { display: none; }
.ws-account__head {
	padding: var(--space-2) var(--space-3) var(--space-3);
	border-bottom: 1px solid var(--border);
	margin-bottom: var(--space-2);
}
.ws-account__name  { font-weight: 600; font-size: var(--text-sm); }
.ws-account__email { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.ws-account__item {
	display: flex; align-items: center; gap: var(--space-3);
	padding: 8px var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-size: var(--text-sm);
	text-decoration: none;
}
.ws-account__item:hover { background: var(--surface); }
.ws-account__item svg   { color: var(--text-muted); flex-shrink: 0; }
.ws-account__item--danger        { color: var(--danger); }
.ws-account__item--danger svg    { color: var(--danger); }
.ws-account__item--danger:hover  { background: var(--danger-soft); }
.ws-account__divider { height: 1px; background: var(--border); margin: var(--space-1) 0; }

/* ---------- body wrap ---------- */
.ws-body {
	flex: 1;
	display: flex;
	min-height: 0;
}

/* ---------- sidebar ---------- */
.ws-side {
	width: 240px;
	background: var(--bg);
	border-inline-end: 1px solid var(--border);
	padding: var(--space-4) var(--space-3);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	flex-shrink: 0;
}
.ws-side__group { display: flex; flex-direction: column; gap: 1px; }
.ws-side__heading {
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: var(--space-2) var(--space-3) var(--space-1);
}
.ws-side__subheading {
	font-size: 10px;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	padding: var(--space-3) var(--space-3) 4px;
	opacity: 0.7;
}
.ws-side__group-gap { height: var(--space-2); }

.ws-side__item {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: 8px var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	font-size: var(--text-sm);
	font-weight: 500;
	text-decoration: none;
	transition: background var(--dur-fast), color var(--dur-fast);
}
.ws-side__item:hover {
	background: var(--surface);
	color: var(--text);
	text-decoration: none;
}
.ws-side__item.is-active {
	background: var(--accent-soft);
	color: var(--accent-hover);
	font-weight: 600;
}
.ws-side__item svg {
	width: 16px; height: 16px;
	flex-shrink: 0;
	opacity: 0.85;
}
.ws-side__item.is-active svg { opacity: 1; }

/* ---------- depth divider between global and bot-scoped ---------- */
.ws-side__divider {
	margin: var(--space-3) calc(var(--space-3) * -1);
	height: 0;
	border-top: 1px solid var(--border);
	background: linear-gradient(to bottom, transparent, var(--surface) 50%, transparent);
	position: relative;
}

.ws-side__group--scoped {
	background: var(--surface);
	margin: 0 calc(var(--space-3) * -1);
	padding: var(--space-3);
	border-block: 1px solid var(--border);
	gap: 1px;
}

.ws-side__heading--bot {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--text);
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: -0.005em;
	text-transform: none;
	padding: 0 var(--space-3) var(--space-2);
}
.ws-side__bot-mark {
	width: 22px; height: 22px;
	border-radius: var(--radius-sm);
	background: var(--accent);
	color: var(--accent-fg);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
}

.ws-side__group--scoped .ws-side__item {
	background: transparent;
	color: var(--text-secondary);
}
.ws-side__group--scoped .ws-side__item:hover {
	background: var(--bg);
}
.ws-side__group--scoped .ws-side__item.is-active {
	background: var(--bg);
	color: var(--accent-hover);
	box-shadow: inset 2px 0 0 var(--accent);
}

[dir="rtl"] .ws-side__group--scoped .ws-side__item.is-active {
	box-shadow: inset -2px 0 0 var(--accent);
}

.ws-side__foot {
	margin-top: auto;
	padding-top: var(--space-3);
	border-top: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 1px;
}

/* ---------- main content ---------- */
.ws-main {
	flex: 1;
	min-width: 0;
	overflow-y: auto;
	padding: var(--space-8) var(--space-8) var(--space-12);
	background: var(--surface);
}
.ws-main > .x-section + .x-section { margin-top: var(--space-8); }

/* ---------- mobile bottom tab bar ---------- */
.ws-mtabs {
	display: none;
}

@media (max-width: 720px) {
	.ws-side { display: none; }
	.ws-main { padding: var(--space-6) var(--space-4) calc(72px + var(--space-6)); }

	.ws-mtabs {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		position: fixed;
		left: 0; right: 0; bottom: 0;
		background: var(--bg);
		border-top: 1px solid var(--border);
		padding: var(--space-2) var(--space-1) calc(var(--space-2) + env(safe-area-inset-bottom, 0));
		z-index: var(--z-sticky);
	}
	.ws-mtab {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		padding: var(--space-2) var(--space-1);
		color: var(--text-muted);
		text-decoration: none;
		font-size: 10.5px;
		font-weight: 500;
		border-radius: var(--radius-sm);
	}
	.ws-mtab:hover { color: var(--text); text-decoration: none; }
	.ws-mtab[aria-current="page"],
	.ws-mtab.is-active {
		color: var(--accent);
	}
	.ws-mtab svg { stroke-width: 2; }
	.ws-mtab__label { font-size: 10.5px; }

	.ws-topbar { padding-inline: var(--space-3); gap: var(--space-2); }
	.ws-search { display: none; }
	.ws-logo-text { display: none; }
}
