/*
 * TENANT-WORKSPACE-BOOKKEEPING-B4E-2A
 */

body.twb-modal-open {
	overflow: hidden;
}

.twb-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: grid;
	place-items: center;
	padding: 24px;
	background: rgba(2, 16, 38, 0.72);
	backdrop-filter: blur(8px);
}

.twb-dialog {
	width: min(1180px, 100%);
	max-height: calc(100dvh - 48px);
	overflow: hidden;
	border: 1px solid rgba(148, 163, 184, 0.45);
	border-radius: 24px;
	background: #f8fafc;
	box-shadow: 0 30px 80px rgba(2, 16, 38, 0.42);
}

.twb-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 24px;
	color: #ffffff;
	background:
		linear-gradient(135deg, #071f46 0%, #0d3f91 58%, #1d5fce 100%);
}

.twb-header h2 {
	margin: 5px 0;
	font-size: clamp(1.6rem, 3vw, 2.35rem);
	font-weight: 900;
}

.twb-header p {
	margin: 0;
	color: #dbeafe;
}

.twb-eyebrow {
	color: #fdba74 !important;
	font-size: 0.72rem;
	font-weight: 900;
	letter-spacing: 0.17em;
	text-transform: uppercase;
}

.twb-close {
	display: grid;
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 12px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.12);
	font-size: 1.7rem;
	cursor: pointer;
}

.twb-content {
	max-height: calc(100dvh - 178px);
	overflow: auto;
	padding: 22px;
}

.twb-status {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 18px;
}

.twb-status > div {
	padding: 18px;
	border: 1px solid #dbe5f0;
	border-radius: 18px;
	background: #ffffff;
	box-shadow: 0 8px 24px rgba(15, 47, 99, 0.07);
}

.twb-status span {
	display: block;
	color: #64748b;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.twb-status strong {
	display: block;
	margin-top: 8px;
	color: #0f2f63;
	font-size: 1.7rem;
	font-weight: 900;
}

.twb-panel {
	overflow: hidden;
	border: 1px solid #dbe5f0;
	border-radius: 20px;
	background: #ffffff;
	box-shadow: 0 12px 30px rgba(15, 47, 99, 0.08);
}

.twb-panel-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 20px;
	border-bottom: 1px solid #e2e8f0;
}

.twb-panel-heading h3 {
	margin: 0;
	color: #0f2f63;
	font-size: 1.2rem;
	font-weight: 900;
}

.twb-panel-heading p {
	margin: 5px 0 0;
	color: #64748b;
	font-size: 0.9rem;
}

.twb-refresh {
	border: 0;
	border-radius: 12px;
	padding: 11px 16px;
	color: #ffffff;
	background: #f97316;
	font-weight: 900;
	cursor: pointer;
}

.twb-message {
	min-height: 24px;
	padding: 12px 20px 0;
	color: #475569;
	font-size: 0.86rem;
	font-weight: 700;
}

.twb-message[data-tone="success"] {
	color: #047857;
}

.twb-message[data-tone="error"] {
	color: #b91c1c;
}

.twb-table-wrap {
	overflow-x: auto;
	padding: 16px 20px 20px;
}

.twb-table {
	width: 100%;
	border-collapse: collapse;
}

.twb-table th,
.twb-table td {
	padding: 13px 12px;
	border-bottom: 1px solid #e2e8f0;
	text-align: left;
	white-space: nowrap;
}

.twb-table th {
	color: #475569;
	background: #f8fafc;
	font-size: 0.74rem;
	font-weight: 900;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.twb-table td {
	color: #1e293b;
	font-size: 0.9rem;
}

.twb-empty {
	margin: 0 20px 20px;
	padding: 28px;
	border: 1px dashed #94a3b8;
	border-radius: 16px;
	text-align: center;
	background: #f8fafc;
}

.twb-empty strong {
	color: #0f2f63;
}

.twb-empty p {
	max-width: 700px;
	margin: 8px auto 0;
	color: #64748b;
	font-size: 0.9rem;
}

@media (max-width: 820px) {
	.twb-overlay {
		padding: 0;
	}

	.twb-dialog {
		width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	.twb-content {
		max-height: calc(100dvh - 130px);
		padding: 14px;
	}

	.twb-status {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.twb-panel-heading {
		align-items: stretch;
		flex-direction: column;
	}

	.twb-refresh {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.twb-header {
		padding: 18px;
	}

	.twb-status {
		grid-template-columns: 1fr;
	}

	.twb-status > div {
		padding: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.twb-overlay,
	.twb-dialog,
	.twb-refresh,
	.twb-close {
		scroll-behavior: auto;
		transition: none;
	}
}

/*
 * TENANT-WORKSPACE-BOOKKEEPING-B4F-2A
 * Docked, resizable Tenant Workspace panel.
 */

body.twb-panel-open {
	overflow: auto;
}

body.twb-panel-open:not(.twb-panel-expanded):not(.twb-panel-collapsed) {
	--twb-active-panel-width: var(--twb-panel-width, 560px);
}

body.twb-panel-expanded {
	overflow: hidden;
}

.twb-overlay {
	--twb-panel-width: 560px;
	position: fixed;
	inset: 0 0 0 auto;
	z-index: 10000;
	display: block;
	width: min(
		var(--twb-panel-width),
		75vw
	);
	height: 100dvh;
	padding: 0;
	background: transparent;
	backdrop-filter: none;
	pointer-events: none;
}

.twb-dialog {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100dvh;
	max-height: 100dvh;
	overflow: hidden;
	border: 0;
	border-left: 1px solid #cbd5e1;
	border-radius: 0;
	background: #f8fafc;
	box-shadow: -18px 0 48px rgba(2, 16, 38, 0.22);
	pointer-events: auto;
}

.twb-resize-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: -5px;
	z-index: 3;
	width: 10px;
	cursor: col-resize;
	touch-action: none;
	pointer-events: auto;
}

.twb-resize-handle::after {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 4px;
	width: 2px;
	content: "";
	background: transparent;
	transition: background 160ms ease;
}

.twb-resize-handle:hover::after,
.twb-resize-handle:focus-visible::after {
	background: #f97316;
}

.twb-header {
	min-height: 132px;
	padding: 20px;
}

.twb-header h2 {
	font-size: clamp(1.35rem, 2vw, 2rem);
}

.twb-window-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.twb-window-button,
.twb-close {
	display: grid;
	width: 40px;
	height: 40px;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, 0.32);
	border-radius: 11px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.12);
	font-size: 1.25rem;
	font-weight: 900;
	cursor: pointer;
}

.twb-window-button:hover,
.twb-close:hover {
	background: rgba(255, 255, 255, 0.22);
}

.twb-window-button:focus-visible,
.twb-close:focus-visible,
.twb-resize-handle:focus-visible {
	outline: 3px solid #fdba74;
	outline-offset: 2px;
}

.twb-content {
	max-height: calc(100dvh - 132px);
	padding: 16px;
}

.twb-status {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.twb-panel-heading {
	align-items: stretch;
	flex-direction: column;
}

.twb-refresh {
	align-self: flex-start;
}

.twb-is-expanded {
	inset: 0;
	width: 100vw;
	max-width: none;
}

.twb-is-expanded .twb-dialog {
	border-left: 0;
}

.twb-is-expanded .twb-resize-handle {
	display: none;
}

.twb-is-expanded .twb-status {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.twb-is-expanded .twb-panel-heading {
	align-items: center;
	flex-direction: row;
}

.twb-is-collapsed {
	width: 76px;
}

.twb-is-collapsed .twb-dialog {
	background: linear-gradient(
		180deg,
		#071f46 0%,
		#0d3f91 58%,
		#1d5fce 100%
	);
}

.twb-is-collapsed .twb-header {
	height: 100%;
	min-height: 100%;
	align-items: center;
	justify-content: flex-start;
	flex-direction: column;
	padding: 12px;
}

.twb-is-collapsed .twb-header > div:first-child,
.twb-is-collapsed .twb-content,
.twb-is-collapsed .twb-resize-handle,
.twb-is-collapsed [data-twb-expand] {
	display: none;
}

.twb-is-collapsed .twb-window-actions {
	flex-direction: column;
}

.twb-is-collapsed [data-twb-collapse] {
	order: 1;
}

.twb-is-collapsed [data-twb-close] {
	order: 2;
}

@media (max-width: 900px) {
	body.twb-panel-open {
		overflow: hidden;
	}

	.twb-overlay,
	.twb-is-collapsed,
	.twb-is-expanded {
		inset: 0;
		width: 100vw;
		max-width: none;
		height: 100dvh;
	}

	.twb-dialog {
		width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border: 0;
	}

	.twb-resize-handle,
	[data-twb-collapse] {
		display: none;
	}

	.twb-content {
		max-height: calc(100dvh - 130px);
	}

	.twb-status,
	.twb-is-expanded .twb-status {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.twb-panel-heading,
	.twb-is-expanded .twb-panel-heading {
		align-items: stretch;
		flex-direction: column;
	}
}

@media (max-width: 480px) {
	.twb-status,
	.twb-is-expanded .twb-status {
		grid-template-columns: 1fr;
	}
}
