.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;
	}
}
.tctd-color { min-height: 38px; padding: 4px 6px; cursor: pointer; }

/* Same hierarchy as the native form: identity, compact computed strip, editable fields. */
.tctd-dialog > header { border-top: 4px solid var(--tctd-accent, #2563eb); align-items: flex-start; padding: 10px 16px; }
.tctd.is-reservation .tctd-dialog > header { background: #faf8ff; }
.tctd .tcm-heading { flex: 1; min-width: 0; }
.tctd .tcm-heading h4 { font-size: 1.05rem; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tctd-header-summary { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tctd-header-summary .tctd-section,.tctd-header-summary .tctd-metrics { border: 0; margin: 0; padding: 0; }
.tctd-header-summary h5 { display: none; }
.tctd-header-summary .tctd-progress-metrics,.tctd-header-summary .tctd-metrics { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.tctd-header-summary span { background: transparent; padding: 0; font-size: 11px; color: #64748b; }
.tctd-header-summary strong { display: inline; margin-left: 5px; color: #1e293b; font-size: 11px; }
.tctd-body .form-group { margin-bottom: 10px; min-width: 0; }
.tctd-body label { margin-bottom: 4px; font-size: 12px; color: #475569; font-weight: 600; }
.tctd-body .form-control { font-size: 13px; }
.tctd-main-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }
.tctd-wide { grid-column: 1 / -1; }
.tctd-main-fields textarea { min-height: 60px; height: 60px; resize: vertical; }
.tctd-body .tctd-section { margin-top: 10px; padding: 12px; }
.tctd-body .tctd-kind { margin: 10px 0; padding: 8px 12px; }
.tctd-kind small { font-size: 11px; }
.tctd-native-date { margin: 0; }
.tc-date-popup-layer { position: fixed; z-index: 10010; width: max-content; max-width: calc(100vw - 16px); }
.tc-date-popup-layer > .AnyTime-pkr { position: relative !important; top: 0 !important; left: 0 !important; transform: none !important; width: max-content; max-width: calc(100vw - 16px); overflow: auto; scrollbar-gutter: stable; box-shadow: 0 6px 24px rgba(15,23,42,.22); }
/* AnyTime's floated columns can wrap when its vertical scrollbar takes a few pixels. */
.tc-date-popup-layer .AnyTime-body { display: flex; align-items: flex-start; gap: 24px; }
.tc-date-popup-layer .AnyTime-date, .tc-date-popup-layer .AnyTime-time { flex: 0 0 auto; float: none; }
.tc-date-popup-layer .AnyTime-date + .AnyTime-time { margin-left: 0; }
@media (max-width: 575.98px) { .tc-date-popup-layer .AnyTime-body { flex-wrap: wrap; gap: 16px; } .tc-date-popup-layer .AnyTime-date { flex: 1 1 100%; min-width: 0; } .tc-date-popup-layer .AnyTime-date + .AnyTime-time { margin-top: 0; } }
.tcn-header { border-left: 4px solid #2563eb; padding: 3px 12px; }
.tcn-header.is-reservation { border-left-color: #7c3aed; background: #faf8ff; }
.tcn-object-type { color: #334155; font-size: 12px; font-weight: 700; }
.tcn-header .small { font-size: 11px; gap: 3px 0; color: #64748b; }
.tcn-header .small strong { color: #1e293b; }
.tcn-form .card-header { padding: 9px 14px; }
.tcn-form .card-body { padding: 14px; }
.tcn-form .form-group { margin-bottom: 10px; }
.tcn-form label { margin-bottom: 4px; font-size: 12px; font-weight: 600; color: #475569; }
.tcn-form .card-title { font-size: 13px; font-weight: 600; }
.tcn-planning-kind { display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin-bottom: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; }
.tcn-planning-kind .mb-1 { margin: 0 !important; }
.tcn-planning-kind small { margin-left: auto; }
.tcn-form .js-ShowWorkOnly .border-top { margin-top: 10px !important; padding-top: 10px !important; }
.tcti-reversed { color: #94a3b8; }
.tcti-reversed .tcti-counted-time { text-decoration: line-through; background: #f1f5f9; color: #94a3b8; }
.tctd .tcm-body [data-credit-message] { color: #b91c1c; font-size: 12px; }
.tctd.is-busy .tcm-body [data-credit-message] { color: #475569; }
.tctd.is-busy [data-credit-save]::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 7px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tctd-spin .7s linear infinite; }
.tctd .select2-container { min-width: 0; }
@media (max-width: 600px) {
	.tctd-main-fields { grid-template-columns: minmax(0,1fr); }
	.tctd-header-summary .tctd-progress-metrics { gap: 4px 10px; }
}

/* NAV-022: independent queue/calendar scroll, shared cards and preview renderer. */
.tcwo-workspace.tcm-root{padding:0;display:block}
.tcwo-workspace .tcwo-dialog{width:100%;max-width:none;height:100vh;height:100dvh;max-height:none;border-radius:0;display:flex;flex-direction:column}
.tcwo-workspace .tcm-header,.tcwo-workspace .tcm-footer{padding:8px 12px;gap:8px;flex:none}
.tcwo-workspace .tcm-header h4{font-size:16px}
.tcwo-workspace .tcwo-body{flex:1;min-height:0;min-width:0;padding:8px;display:grid;grid-template-columns:minmax(260px,1fr) minmax(0,3fr);gap:8px;overflow:hidden}
.tcwo-queue-pane,.tcwo-preview-pane{min-width:0;min-height:0;overflow:hidden;border:1px solid #dce3ec;border-radius:5px;display:flex;flex-direction:column;background:#fff}
.tcwo-queue-pane>header{padding:8px;border-bottom:1px solid #e2e8f0;display:flex;flex-direction:column;gap:5px;font-size:12px;flex:none}
.tcwo-queue-pane>header small{color:#64748b}
.tcwo-list-scroll{overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:7px;flex:1;min-height:0}
.tcwo-preview-pane>[data-tcwo-preview]{height:100%;min-height:0;display:flex;flex-direction:column}
.tcwo-workspace .tcwo-order-item{display:flex;flex-wrap:nowrap;align-items:stretch;min-width:0;gap:5px;padding:6px;border-radius:4px}
.tcwo-workspace .tcwo-order-main{min-width:0;flex:1}
.tcwo-workspace .tcwo-order-actions{display:flex;flex-direction:column;gap:2px;flex:none;align-items:stretch}
.tcwo-workspace .tcwo-order-actions .btn{font-size:11px;padding:1px 5px;min-width:24px}
.tcwo-workspace .tcwo-handle{flex:none;padding:4px;display:grid;align-items:center;font-size:14px;user-select:none;touch-action:none}
.tcwo-select{display:block;width:100%;text-align:left;border:0;padding:0;background:transparent;color:inherit;cursor:pointer;min-width:0}
.tcwo-workspace .tc-card-name{white-space:normal;line-height:1.3;font-size:12px;overflow-wrap:anywhere}
.tcwo-workspace .tc-card-project{font-size:12px}
.tcwo-workspace .tc-card-values{display:flex;flex-wrap:wrap;font-size:10px;gap:3px 8px;line-height:1.5}
.tcwo-workspace .tcwo-order-meta{font-size:10px;display:flex!important;flex-wrap:wrap;gap:3px 8px;margin-top:3px}
.tcwo-workspace .tcwo-dirty-status{display:flex;align-items:center;gap:6px;margin-right:auto;margin-left:0;font-size:12px;min-width:150px}
.tcwo-workspace .tcwo-error{font-size:12px;min-height:0;max-width:38%;overflow-wrap:anywhere}
.tcwo-mobile-tabs{display:none}
.tcwo-workspace .tcwo-select:focus-visible{outline:2px solid #2196f3;outline-offset:2px}
.tcwo-workspace .tcwo-preview-pane .tc-preview-toolbar{padding:6px 9px}
.tcwo-workspace .tc-week-grid.is-detail .tc-week-day{min-height:110px}
.tcwo-workspace .tc-preview-impact .tc-impact-row{font-size:11px}
@media(max-width:1000px){.tcwo-workspace .tcwo-body{grid-template-columns:minmax(240px,1fr) minmax(0,2fr)}.tcwo-workspace .tc-card-values{font-size:10px}.tcwo-workspace .tc-preview-grid .tc-week-grid{grid-template-columns:repeat(7,minmax(90px,1fr))}.tcwo-workspace .tc-preview-grid{overflow:auto}}
@media(max-width:760px){.tcwo-workspace .tcwo-body{display:flex;flex-direction:column}.tcwo-mobile-tabs{display:flex;gap:4px;flex:none}.tcwo-mobile-tabs .btn{flex:1}.tcwo-queue-pane,.tcwo-preview-pane{flex:1}.tcwo-workspace[data-mobile-panel="queue"] .tcwo-preview-pane,.tcwo-workspace[data-mobile-panel="calendar"] .tcwo-queue-pane{display:none}.tcwo-workspace .tcwo-error{max-width:100%;order:2}.tcwo-workspace .tcwo-dirty-status{width:100%;min-height:18px}.tcwo-workspace .tcwo-order-main{min-width:0}.tcwo-workspace .tcwo-order-actions{flex-direction:row}.tcwo-workspace .tcwo-order-item{align-items:center}.tcwo-workspace .tcwo-order-meta{display:none!important}}
.tcwo-pane-heading{display:flex;align-items:center;justify-content:space-between;gap:6px}

.tcwo-workspace .tc-preview-calendar-tools{position:sticky;top:0;z-index:14;background:#fff;border-bottom:1px solid #e2e8f0;padding:6px 8px}
.tcwo-workspace .tc-week-head{top:var(--tc-preview-tools-height,60px);z-index:13}
.tcwo-workspace .tcwo-order-actions{width:auto;min-width:0;margin:0}

/* Shared persisted-plan history, in native details and the common task dialog. */
.tc-history-card { border:1px solid #dce3ed; border-radius:6px; padding:12px; margin:12px 0; background:#fff; }
.tc-history-entry { padding:10px 12px; margin-bottom:8px; border:1px solid #dde3ec; border-left:3px solid #2196f3; border-radius:4px; background:#fff; }
.tc-history-entry.is-late { border-left-color:#e53935; background:#fff4f4; }
.tc-history-entry.is-pause { border-left-color:#ed9c28; background:#fffbf3; }
.tc-history-entry header { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; }
.tc-history-entry time, .tc-history-entry small, .tc-history-reason { color:#68758b; font-size:12px; }
.tc-history-reason { margin:3px 0 5px; }
.tc-history-slack { display:inline-block; font-size:13px; }
.tc-history-dates { display:flex; flex-direction:column; font-size:12px; margin-top:4px; }
.tc-history-modal .tctd-dialog { width:min(960px,96vw); max-width:960px; }
.tc-history-modal .tctd-body { max-height:75vh; overflow:auto; }
