.tctd {
	display: grid;
	inset: 0;
	padding: 24px;
	place-items: center;
	position: fixed;
	z-index: 1060;
}

.tctd-backdrop {
	background: rgba(20, 28, 40, .48);
	border: 0;
	inset: 0;
	position: absolute;
}

.tctd-dialog {
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 40px);
	overflow: hidden;
	position: relative;
	width: min(900px, calc(100vw - 32px));
}

.tctd-dialog > header,
.tctd-dialog > footer {
	align-items: center;
	background: #fff;
	display: flex;
	gap: 8px;
	padding: 14px 18px;
}

.tctd-dialog > header {
	border-bottom: 1px solid #e5e8ed;
	justify-content: space-between;
}

.tctd-dialog > header h4 {
	margin: 0;
}

.tctd-dialog > footer {
	border-top: 1px solid #e5e8ed;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.tctd-body {
	overflow: auto;
	padding: 18px;
}

.tctd.is-busy .tctd-body {
	opacity: .68;
	pointer-events: none;
}

.tctd.is-busy .tctd-backdrop {
	pointer-events: none;
}

.tctd-busy-status {
	color: #475569;
	font-size: .875rem;
	margin-right: auto;
}

.tctd-spinner {
	animation: tctd-spin .7s linear infinite;
	border: 2px solid currentColor;
	border-radius: 50%;
	border-right-color: transparent;
	display: inline-block;
	height: 1rem;
	margin-right: .4rem;
	vertical-align: -.15rem;
	width: 1rem;
}

@keyframes tctd-spin {
	to { transform: rotate(360deg); }
}

.tctd-check {
	display: block;
	margin: .5rem 0;
}

.tctd-kind {
	align-items: center;
	background: #f8fafc;
	border: 1px solid #dce3ea;
	border-radius: 8px;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	margin: 1rem 0;
	padding: .85rem 1rem;
}

.tctd-kind span,
.tctd-kind small {
	display: block;
}

.tctd-kind small {
	color: #64748b;
	margin-top: .15rem;
}

.tctd-kind .tctd-check {
	flex: 0 0 auto;
	margin: 0;
}

.tctd-section {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	margin-top: 1rem;
	padding: 1rem;
}

.tctd-section > h5 {
	color: #334155;
	font-size: .95rem;
	font-weight: 700;
	margin: 0 0 .85rem;
}

.tctd-progress-metrics {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.tctd-progress-metrics span {
	background: #f5f7fa;
	border-radius: 6px;
	color: #64748b;
	padding: 8px 10px;
}

.tctd-progress-metrics span.complete {
	background: #e8f5e9;
	color: #207227;
}

.tctd-progress-metrics strong {
	color: #1f2937;
	display: block;
	font-size: 1rem;
	margin-top: .15rem;
}

.tctd-metrics {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	margin-top: 16px;
}

.tctd-metrics span {
	background: #f5f7fa;
	border-radius: 6px;
	padding: 8px 10px;
}

.tctd-metrics strong {
	display: block;
}

.tctd-datetime-parts {
	display: grid;
	gap: .5rem;
	grid-template-columns: minmax(0, 1fr) 7rem;
}

.tcwo {
	display: grid;
	inset: 0;
	padding: 24px;
	place-items: center;
	position: fixed;
	z-index: 1070;
}

.tcwo-backdrop {
	background: rgba(20, 28, 40, .48);
	border: 0;
	inset: 0;
	position: absolute;
}

.tcwo-dialog {
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 40px);
	overflow: hidden;
	position: relative;
	width: min(1050px, calc(100vw - 32px));
}

.tcwo-dialog > header,
.tcwo-dialog > footer {
	align-items: center;
	background: #fff;
	display: flex;
	gap: 8px;
	padding: 14px 18px;
}

.tcwo-dialog > header {
	border-bottom: 1px solid #e5e8ed;
}

.tcwo-dialog > header h4 {
	flex: 1;
	margin: 0;
}

.tcwo-dialog > footer {
	border-top: 1px solid #e5e8ed;
	justify-content: flex-start;
}

.tcwo-dirty-status {
	color: #64748b;
	margin-left: auto;
}

.tcwo-dirty-status.is-busy {
	align-items: center;
	color: #1d4ed8;
	display: inline-flex;
	font-weight: 600;
	gap: .45rem;
}

.tcwo-spinner {
	animation: tctd-spin .7s linear infinite;
	border: 2px solid currentColor;
	border-radius: 50%;
	border-right-color: transparent;
	display: inline-block;
	flex: 0 0 auto;
	height: 1rem;
	width: 1rem;
}

.tcwo-body {
	overflow: auto;
	padding: 18px;
}

.tcwo-loading,
.tcwo-empty {
	color: #64748b;
	padding: 20px;
	text-align: center;
}

.tcwo-order-list,
.tcwo-active-list,
.tcwo-awaiting-list {
	display: grid;
	gap: 7px;
}

.tcwo-order-item {
	align-items: center;
	background: #fff;
	border: 1px solid #dce1e7;
	border-radius: 6px;
	display: flex;
	gap: 9px;
	min-height: 56px;
	padding: 7px;
}

.tcwo-order-item.highlight {
	box-shadow: 0 0 0 2px #60a5fa;
}

.tcwo-order-item.estimate-complete {
	border-left: 4px solid #43a047;
}

.tcwo-order-item.tcwo-reservation {
	background: #f8fafc;
	border-color: #94a3b8;
	border-left: 4px solid #475569;
}

.tcwo-reservation-members {
	background: #f8fafc;
	border: 1px dashed #cbd5e1;
	border-radius: 6px;
	display: grid;
	gap: 6px;
	margin: -3px 0 5px 34px;
	min-height: 48px;
	padding: 7px;
}

.tcwo-reservation-caption,
.tcwo-reservation-empty {
	color: #64748b;
	font-size: .78rem;
	padding: 2px 5px;
}

.tcwo-reservation-empty {
	display: grid;
	min-height: 34px;
	place-items: center;
}

.tcwo-order-item.tcwo-member {
	background: #fff;
	min-height: 50px;
}

.tcwo-order-item.tcwo-dragging {
	display: none;
}

.tcwo-drag-ghost {
	box-shadow: 0 16px 36px rgba(15, 23, 42, .24);
	box-sizing: border-box;
	cursor: grabbing;
	margin: 0 !important;
	opacity: .96;
	overflow: hidden;
	pointer-events: none;
	position: fixed;
	z-index: 20000;
}

.tcwo-drop-placeholder {
	background: transparent;
	border: 2px dashed #2563eb;
	border-radius: 6px;
	box-sizing: border-box;
	min-height: 0;
	pointer-events: none;
}

.tcwo-handle {
	align-self: stretch;
	background: #eef2f7;
	border-radius: 4px;
	cursor: grab;
	display: grid;
	flex: 0 0 28px;
	font-weight: 700;
	place-items: center;
	touch-action: none;
	user-select: none;
}

.tcwo-order-item.locked .tcwo-handle {
	cursor: not-allowed;
	opacity: .35;
}

.tcwo-order-main {
	flex: 1;
	min-width: 0;
}

.tcwo-order-title {
	align-items: center;
	display: flex;
	gap: .5rem;
}

.tcwo-state {
	border-radius: 999px;
	font-size: .72rem;
	font-weight: 600;
	padding: .12rem .45rem;
}

.tcwo-state.complete {
	background: #e8f5e9;
	color: #207227;
}

.tcwo-state.fixed {
	background: #fff3e0;
	color: #a45100;
}

.tcwo-state.awaiting {
	background: #ffebee;
	color: #b91c1c;
}

.tcwo-state.reservation {
	background: #e2e8f0;
	color: #334155;
}

.tcwo-state.member {
	background: #eef2ff;
	color: #4338ca;
}

.tcwo-order-meta {
	display: flex !important;
	flex-wrap: wrap;
	gap: .15rem .8rem;
	margin-top: .2rem;
}

.tcwo-order-meta b {
	color: #475569;
	font-weight: 600;
}

.tcwo-order-main strong,
.tcwo-order-main small {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tcwo-order-main small {
	color: #64748b;
}

.tcwo-order-actions {
	align-items: center;
	display: flex;
	gap: 4px;
}

.tcwo-order-actions select {
	width: 170px;
}

.tcwo-lock {
	padding: 4px;
}

.tcwo-awaiting-heading {
	border-top: 1px solid #fecaca;
	color: #b91c1c;
	margin: 14px 0 2px;
	padding-top: 12px;
}

.tcwo-error {
	min-height: 18px;
	margin-top: 8px;
}

.tcwo.busy .tcwo-body {
	opacity: .65;
	pointer-events: none;
}

.tcwo.busy .tcwo-dialog > footer {
	opacity: .75;
	pointer-events: none;
}

@media (max-width: 900px) {
	.tcwo-order-item {
		align-items: flex-start;
		flex-wrap: wrap;
	}

	.tcwo-order-main {
		min-width: calc(100% - 45px);
	}

	.tcwo-order-actions {
		flex-wrap: wrap;
		padding-left: 37px;
		width: 100%;
	}

	.tcwo-order-actions select {
		width: 160px;
	}
}
