/* ============================================================================
   TDG Project Hub — embedded dashboard styles
   All selectors are scoped under .tdg-ph to avoid theme conflicts.
   ============================================================================ */

.tdg-ph {
	--tdg-ph-ink:     #0f1117;
	--tdg-ph-paper:   #f5f2eb;
	--tdg-ph-card:    #faf8f4;
	--tdg-ph-accent:  #c8612a;
	--tdg-ph-accent2: #2a6fc8;
	--tdg-ph-muted:   #8a8680;
	--tdg-ph-border:  #e0dbd2;
	--tdg-ph-green:   #2d7a4f;
	--tdg-ph-amber:   #c8862a;
	--tdg-ph-rule:    1px solid var(--tdg-ph-border);
	--tdg-ph-max-width: none;

	font-family: "DM Sans", system-ui, -apple-system, sans-serif;
	color: var(--tdg-ph-ink);
	background: var(--tdg-ph-paper);
	max-width: var(--tdg-ph-max-width);
	margin: 0 auto;
	width: 100%;
	box-sizing: border-box;
}
.tdg-ph *, .tdg-ph *::before, .tdg-ph *::after { box-sizing: border-box; }

/* ── STAT STRIP (top of dashboard, replaces the standalone masthead) ── */
.tdg-ph-stats {
	display: flex;
	align-items: stretch;
	flex-wrap: wrap;
	border-bottom: 3px solid var(--tdg-ph-ink);
	padding: 18px 32px;
	background: var(--tdg-ph-paper);
	gap: 0;
}
.tdg-ph-stat-cell {
	padding: 4px 32px;
	border-right: var(--tdg-ph-rule);
	text-align: center;
	flex: 1;
	min-width: 130px;
}
.tdg-ph-stat-cell:last-child { border-right: none; }
.tdg-ph-stat-num {
	font-family: "DM Serif Display", Georgia, serif;
	font-size: 1.8rem;
	line-height: 1;
	color: var(--tdg-ph-ink);
}
.tdg-ph-stat-label {
	font-size: .65rem;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	margin-top: 4px;
}

/* ── ERROR BANNER ── */
.tdg-ph-error {
	background: #fff0ed;
	border: 1px solid var(--tdg-ph-accent);
	color: var(--tdg-ph-accent);
	padding: 12px 20px;
	font-size: .85rem;
	margin: 20px 32px;
}

/* ── TOOLBAR / FILTERS ── */
.tdg-ph-toolbar {
	padding: 12px 32px;
	border-bottom: var(--tdg-ph-rule);
	display: flex;
	gap: 8px;
	align-items: center;
	background: var(--tdg-ph-card);
	flex-wrap: wrap;
}
.tdg-ph-filter-btn {
	font-family: inherit;
	font-size: .72rem;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 6px 14px;
	border: var(--tdg-ph-rule);
	background: transparent;
	cursor: pointer;
	color: var(--tdg-ph-muted);
	transition: all .15s;
	border-radius: 0;
	line-height: 1.3;
}
.tdg-ph-filter-btn:hover,
.tdg-ph-filter-btn.is-active {
	background: var(--tdg-ph-ink);
	color: var(--tdg-ph-paper);
	border-color: var(--tdg-ph-ink);
}

/* ── LOADING STATE ── */
.tdg-ph-grid-container { padding: 32px; }
.tdg-ph-loading {
	padding: 60px 0;
	text-align: center;
}
.tdg-ph-loading-title {
	font-family: "DM Serif Display", Georgia, serif;
	font-size: 1.4rem;
	color: var(--tdg-ph-ink);
	margin-bottom: 4px;
}
.tdg-ph-loading-sub {
	font-size: .75rem;
	color: var(--tdg-ph-muted);
	letter-spacing: .08em;
	text-transform: uppercase;
}
.tdg-ph-spinner {
	width: 32px;
	height: 32px;
	border: 2px solid var(--tdg-ph-border);
	border-top-color: var(--tdg-ph-accent);
	border-radius: 50%;
	margin: 0 auto 16px;
	animation: tdg-ph-spin .7s linear infinite;
}
@keyframes tdg-ph-spin { to { transform: rotate(360deg); } }

/* ── PROJECT GRID ── */
.tdg-ph-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 1px;
	background: var(--tdg-ph-border);
	border: var(--tdg-ph-rule);
}
.tdg-ph-card {
	background: var(--tdg-ph-card);
	cursor: pointer;
	transition: background .15s;
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.tdg-ph-card::before {
	content: "";
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 3px;
	background: var(--tdg-ph-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .25s;
	z-index: 1;
}
.tdg-ph-card:hover { background: #fff; }
.tdg-ph-card:hover::before { transform: scaleX(1); }

.tdg-ph-card-hero {
	width: 100%;
	height: 160px;
	overflow: hidden;
	position: relative;
	background: var(--tdg-ph-border);
	flex-shrink: 0;
}
.tdg-ph-card-hero img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}
.tdg-ph-card:hover .tdg-ph-card-hero img { transform: scale(1.04); }
.tdg-ph-card-hero-ph {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e8e4dc, #d8d2c8);
	display: flex;
	align-items: center;
	justify-content: center;
}
.tdg-ph-card-hero-ph span {
	font-size: .65rem;
	font-weight: 600;
	letter-spacing: .15em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
}

.tdg-ph-card-body {
	padding: 20px 24px 24px;
	flex: 1;
	display: flex;
	flex-direction: column;
}
.tdg-ph-card-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 10px;
}
.tdg-ph-card-index {
	font-family: "DM Serif Display", Georgia, serif;
	font-size: .8rem;
	color: var(--tdg-ph-muted);
	font-style: italic;
}
.tdg-ph-status-pill {
	font-size: .62rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	padding: 3px 10px;
	border-radius: 2px;
	white-space: nowrap;
}
.tdg-ph-status-active   { background: #e8f5ee; color: var(--tdg-ph-green);  }
.tdg-ph-status-planning { background: #fff4e0; color: var(--tdg-ph-amber);  }
.tdg-ph-status-complete { background: #e8eef8; color: var(--tdg-ph-accent2); }

.tdg-ph-card-name {
	font-family: "DM Serif Display", Georgia, serif;
	font-size: 1.2rem;
	line-height: 1.2;
	margin-bottom: 8px;
	color: var(--tdg-ph-ink);
}
.tdg-ph-card-desc {
	font-size: .78rem;
	color: var(--tdg-ph-muted);
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-bottom: 16px;
	flex: 1;
}
.tdg-ph-progress-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
}
.tdg-ph-progress-label {
	font-size: .65rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	width: 60px;
	flex-shrink: 0;
}
.tdg-ph-progress-track {
	flex: 1;
	height: 4px;
	background: var(--tdg-ph-border);
}
.tdg-ph-progress-fill { height: 100%; background: var(--tdg-ph-accent); }
.tdg-ph-progress-pct {
	font-size: .7rem;
	font-weight: 600;
	color: var(--tdg-ph-ink);
	width: 32px;
	text-align: right;
}
.tdg-ph-card-meta {
	display: flex;
	margin-top: 14px;
	padding-top: 14px;
	border-top: var(--tdg-ph-rule);
}
.tdg-ph-meta-item {
	flex: 1;
	padding-right: 12px;
	border-right: var(--tdg-ph-rule);
	margin-right: 12px;
}
.tdg-ph-meta-item:last-child {
	border-right: none;
	margin-right: 0;
	padding-right: 0;
}
.tdg-ph-meta-label {
	font-size: .62rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	margin-bottom: 2px;
}
.tdg-ph-meta-value { font-size: .8rem; font-weight: 500; }
.tdg-ph-meta-value.is-budget { font-family: "DM Serif Display", Georgia, serif; font-size: 1rem; }
.tdg-ph-risks-row {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 10px;
}
.tdg-ph-risk-tag {
	font-size: .6rem;
	font-weight: 500;
	letter-spacing: .05em;
	padding: 2px 8px;
	background: #f0ede8;
	color: var(--tdg-ph-muted);
	border: var(--tdg-ph-rule);
}

/* ── MODAL ── */
.tdg-ph-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 17, 23, .65);
	z-index: 100000;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 32px 20px;
	overflow-y: auto;
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}
.tdg-ph-modal-overlay.is-open { display: flex; }
.tdg-ph-modal {
	background: var(--tdg-ph-card);
	width: 100%;
	max-width: 960px;
	border: 2px solid var(--tdg-ph-ink);
	position: relative;
	animation: tdg-ph-slide-up .2s ease;
	margin: auto;
	overflow: hidden;
	color: var(--tdg-ph-ink);
}
@keyframes tdg-ph-slide-up {
	from { transform: translateY(16px); opacity: 0; }
	to   { transform: translateY(0); opacity: 1; }
}
.tdg-ph-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: var(--tdg-ph-rule);
	background: var(--tdg-ph-card);
	cursor: pointer;
	font-size: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--tdg-ph-muted);
	transition: all .15s;
	z-index: 10;
	font-family: inherit;
	line-height: 1;
}
.tdg-ph-modal-close:hover {
	background: var(--tdg-ph-ink);
	color: var(--tdg-ph-paper);
	border-color: var(--tdg-ph-ink);
}

.tdg-ph-modal-hero {
	width: 100%;
	height: 240px;
	overflow: hidden;
	position: relative;
	background: var(--tdg-ph-border);
	flex-shrink: 0;
}
.tdg-ph-modal-hero img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.tdg-ph-modal-hero-ph {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e0dbd2, #ccc7bc);
}
.tdg-ph-modal-hero-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(15, 17, 23, .75) 0%, rgba(15, 17, 23, .1) 55%, transparent 100%);
}
.tdg-ph-modal-hero-title {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	padding: 24px 32px;
}
.tdg-ph-modal-hero-name {
	font-family: "DM Serif Display", Georgia, serif;
	font-size: 1.8rem;
	color: white;
	line-height: 1.1;
	text-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.tdg-ph-modal-hero-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
}

.tdg-ph-modal-body {
	display: grid;
	grid-template-columns: 1fr 270px;
	min-width: 0;
}
.tdg-ph-modal-main {
	padding: 28px 32px;
	border-right: var(--tdg-ph-rule);
	min-width: 0;
	overflow: hidden;
}
.tdg-ph-modal-sidebar {
	padding: 24px 20px;
	min-width: 0;
	overflow: hidden;
	width: 270px;
}
.tdg-ph-section-label {
	font-size: .65rem;
	font-weight: 600;
	letter-spacing: .15em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: var(--tdg-ph-rule);
}
.tdg-ph-status-text {
	font-size: .85rem;
	line-height: 1.75;
	color: #3a3830;
	margin-bottom: 28px;
	overflow-wrap: break-word;
	word-break: break-word;
}
.tdg-ph-status-text p { margin: 0 0 10px; }

/* ── GANTT ── */
.tdg-ph-gantt-wrap { margin-bottom: 28px; }
.tdg-ph-gantt-controls {
	display: flex;
	justify-content: flex-end;
	gap: 6px;
	margin-bottom: 8px;
}
.tdg-ph-gantt-scroll-btn {
	width: 28px;
	height: 28px;
	border: var(--tdg-ph-rule);
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--tdg-ph-muted);
	font-size: .9rem;
	transition: all .15s;
	font-family: inherit;
	line-height: 1;
	padding: 0;
}
.tdg-ph-gantt-scroll-btn:hover {
	background: var(--tdg-ph-ink);
	color: var(--tdg-ph-paper);
	border-color: var(--tdg-ph-ink);
}
.tdg-ph-gantt-scroll-track {
	display: flex;
	align-items: stretch;
	min-width: 0;
}
.tdg-ph-gantt-label-col {
	flex-shrink: 0;
	width: 145px;
	padding-top: 47px;
}
.tdg-ph-gantt-label-row {
	height: 24px;
	margin-bottom: 5px;
	display: flex;
	align-items: center;
	font-size: .68rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding-right: 8px;
	color: var(--tdg-ph-ink);
}
.tdg-ph-gantt-chart-area { flex: 1; min-width: 0; overflow: hidden; }
.tdg-ph-gantt-chart-inner {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}
.tdg-ph-gantt-chart-inner::-webkit-scrollbar { height: 4px; }
.tdg-ph-gantt-chart-inner::-webkit-scrollbar-track { background: var(--tdg-ph-border); }
.tdg-ph-gantt-chart-inner::-webkit-scrollbar-thumb {
	background: var(--tdg-ph-muted);
	border-radius: 2px;
}
.tdg-ph-gantt-month-header {
	display: flex;
	border-bottom: 1px solid var(--tdg-ph-border);
	padding-bottom: 5px;
}
.tdg-ph-gantt-month-cell {
	font-size: .58rem;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	text-align: center;
	flex-shrink: 0;
}
.tdg-ph-gantt-rows-area { position: relative; padding-top: 18px; }
.tdg-ph-gantt-bar-row {
	height: 24px;
	margin-bottom: 5px;
	position: relative;
	background: #f0ede8;
}
.tdg-ph-gantt-bar {
	position: absolute;
	top: 3px;
	height: 18px;
	border-radius: 1px;
	display: flex;
	align-items: center;
	padding: 0 5px;
	overflow: hidden;
}
.tdg-ph-gantt-bar span {
	font-size: .57rem;
	color: white;
	white-space: nowrap;
	overflow: hidden;
}
.tdg-ph-gantt-today-line {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 2px;
	background: var(--tdg-ph-accent2);
	z-index: 2;
	pointer-events: none;
}
.tdg-ph-gantt-today-label {
	position: absolute;
	top: 2px;
	left: 4px;
	font-size: .52rem;
	font-weight: 700;
	letter-spacing: .06em;
	color: var(--tdg-ph-accent2);
	white-space: nowrap;
	background: var(--tdg-ph-card);
	padding: 0 3px;
	line-height: 1.4;
	border-radius: 2px;
}

/* ── BUDGET TABLE ── */
.tdg-ph-budget-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .78rem;
	margin-bottom: 8px;
	color: var(--tdg-ph-ink);
}
.tdg-ph-budget-table th {
	text-align: left;
	font-size: .62rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--tdg-ph-muted);
	padding: 0 6px 6px 0;
	border-bottom: 2px solid var(--tdg-ph-ink);
}
.tdg-ph-budget-table th:not(:first-child) { text-align: right; }
.tdg-ph-budget-table td {
	padding: 6px 6px 6px 0;
	border-bottom: var(--tdg-ph-rule);
	overflow-wrap: break-word;
}
.tdg-ph-budget-table tr:last-child td { border-bottom: none; }
.tdg-ph-budget-table td:not(:first-child) {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.tdg-ph-budget-table .tdg-ph-total-row td {
	font-weight: 600;
	border-top: 2px solid var(--tdg-ph-ink);
	border-bottom: none;
	padding-top: 8px;
}
.tdg-ph-neg { color: #c84040; }                       /* negative variance = overspent = red */
.tdg-ph-pos { color: var(--tdg-ph-green); }           /* positive variance = saved = green */

/* ── CHECKLIST ── */
.tdg-ph-checklist-section { margin-bottom: 20px; }
.tdg-ph-checklist-group { margin-bottom: 12px; }
.tdg-ph-checklist-group-label {
	font-size: .62rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--tdg-ph-ink);
	margin-bottom: 5px;
}
.tdg-ph-checklist-item {
	display: flex;
	align-items: flex-start;
	gap: 7px;
	padding: 2px 0;
	font-size: .73rem;
	color: var(--tdg-ph-muted);
	line-height: 1.4;
	min-width: 0;
}
.tdg-ph-checklist-item.is-done { color: var(--tdg-ph-ink); }
.tdg-ph-check-icon {
	width: 14px;
	height: 14px;
	min-width: 14px;
	border: 1px solid var(--tdg-ph-border);
	border-radius: 2px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: .55rem;
	margin-top: 1px;
}
.tdg-ph-check-icon.is-done {
	background: var(--tdg-ph-green);
	border-color: var(--tdg-ph-green);
	color: white;
}
.tdg-ph-checklist-item span {
	word-break: break-word;
	overflow-wrap: break-word;
	min-width: 0;
	flex: 1;
}

/* ── RISKS ── */
.tdg-ph-risks-section { margin-bottom: 20px; }
.tdg-ph-risk-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 6px 0;
	border-bottom: var(--tdg-ph-rule);
	font-size: .75rem;
	line-height: 1.4;
	min-width: 0;
}
.tdg-ph-risk-item:last-child { border-bottom: none; }
.tdg-ph-risk-dot {
	width: 6px;
	height: 6px;
	min-width: 6px;
	border-radius: 50%;
	background: var(--tdg-ph-accent);
	flex-shrink: 0;
	margin-top: 5px;
}
.tdg-ph-risk-item span {
	word-break: break-word;
	min-width: 0;
	flex: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
	.tdg-ph-stats,
	.tdg-ph-toolbar,
	.tdg-ph-grid-container,
	.tdg-ph-error { padding-left: 16px; padding-right: 16px; }
	.tdg-ph-stats { flex-wrap: wrap; }
	.tdg-ph-stat-cell {
		padding: 8px 16px;
		flex-basis: 50%;
		min-width: 0;
	}
	.tdg-ph-modal-body { grid-template-columns: 1fr; }
	.tdg-ph-modal-sidebar {
		border-top: var(--tdg-ph-rule);
		width: 100%;
	}
	.tdg-ph-modal-main { padding: 20px 16px; }
	.tdg-ph-modal-hero-name { font-size: 1.3rem; }
}
