/* ── Timeline ────────────────────────────────────────────────
   Hourly timeline grid showing project activity across a
   working day. Uses pp-pulse keyframe from design_system.css.
   ─────────────────────────────────────────────────────────── */

.timeline-board {
	margin-top: 24px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 26px 28px;
	box-shadow: var(--shadow-md);
}

.timeline-board__header {
	margin-bottom: 20px;
}

.timeline-empty {
	padding: 56px 24px;
	text-align: center;
	color: #94a3b8;
	font-size: 14px;
}

/* ── Grid ── */

.tl-grid-wrapper {
	overflow-x: auto;
}

.tl-grid {
	display: grid;
	/* 1 label col + 14 hour cols (7am–8pm) */
	grid-template-columns: 160px repeat(14, minmax(88px, 1fr));
	min-width: 1092px;
	border: 1px solid var(--blue-100);
	border-radius: 12px;
}

/* ── Header row ── */

.tl-corner {
	background: #f8fafc;
	border-right: 1px solid var(--blue-100);
	border-bottom: 2px solid var(--blue-200);
	border-radius: 11px 0 0 0;
}

.tl-hour-label {
	position: relative;
	background: #f8fafc;
	border-right: 1px solid var(--blue-100);
	border-bottom: 2px solid var(--blue-200);
	padding: 9px 4px 8px;
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	color: #64748b;
	letter-spacing: 0.03em;
}

.tl-hour-label:last-child {
	border-right: none;
	border-radius: 0 11px 0 0;
}

.tl-hour-label.tl-col--now {
	background: #eef2ff;
	color: var(--blue-700);
	border-bottom-color: var(--blue-500);
}

.tl-now-pip {
	display: block;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--blue-500);
	margin: 3px auto 0;
}

/* ── Row labels ── */

.tl-row-label {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 600;
	color: #334155;
	background: #fafbfc;
	border-right: 1px solid var(--blue-100);
	border-bottom: 1px solid var(--blue-100);
	overflow: hidden;
}

.tl-row-label .your-project-badge {
	flex-basis: 100%;
	justify-content: flex-start;
	margin-top: -2px;
}

.tl-row-label:last-of-type {
	border-radius: 0 0 0 11px;
}

.tl-row-label--unassigned {
	--scheme-accent: #94a3b8;
}

.tl-row-dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--scheme-accent, #94a3b8);
}

.tl-row-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Data cells ── */

.tl-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 5px;
	padding: 10px 4px;
	border-right: 1px solid var(--blue-100);
	border-bottom: 1px solid var(--blue-100);
	min-height: 48px;
}

.tl-cell:last-child {
	border-right: none;
	border-radius: 0 0 11px 0;
}

.tl-cell.tl-col--now {
	background: rgba(238, 242, 255, 0.45);
}

/* ── Cell scroll container ── */

.tl-cell-entries {
	width: 100%;
	max-height: 80px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 3px;
	scrollbar-width: none;
}

.tl-cell-entries::-webkit-scrollbar {
	display: none;
}

.tl-cell-entries:hover {
	scrollbar-width: thin;
}

.tl-cell-entries:hover::-webkit-scrollbar {
	display: block;
	width: 3px;
}

.tl-cell-entries:hover::-webkit-scrollbar-track {
	background: transparent;
}

.tl-cell-entries:hover::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

/* ── Entries (dot + name) ── */

.tl-entry {
	display: flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
	border-radius: 10px;
	padding: 2px 5px 2px 3px;
	max-width: 100%;
	transition: background 0.12s ease;
}

.tl-entry:hover {
	background: rgba(0, 0, 0, 0.06);
}

.tl-entry__name {
	font-size: 11px;
	font-weight: 600;
	color: #334155;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Dots ── */

.tl-dot {
	position: relative;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--dot-color, var(--blue-500));
	border: 2px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--dot-color, var(--blue-500));
	flex-shrink: 0;
}

/* ── Tooltip (fixed — appended to body via Stimulus) ── */

.tl-fixed-tooltip {
	position: fixed;
	background: #1e293b;
	color: #f1f5f9;
	border-radius: 8px;
	padding: 9px 12px;
	min-width: 152px;
	max-width: 224px;
	white-space: nowrap;
	font-size: 12px;
	line-height: 1.6;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
	pointer-events: none;
	z-index: 9999;
}

.tl-fixed-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: var(--arrow-left, 50%);
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #1e293b;
}

.tl-fixed-tooltip--below::after {
	top: auto;
	bottom: 100%;
	border-top-color: transparent;
	border-bottom-color: #1e293b;
}

.tl-tooltip__name {
	font-weight: 600;
	color: #ffffff;
}

.tl-tooltip__status {
	color: #94a3b8;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.tl-tooltip__note {
	margin-top: 4px;
	color: #cbd5e1;
	font-style: italic;
	white-space: normal;
}

.tl-tooltip__time {
	margin-top: 4px;
	color: #64748b;
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

/* ── Pattern deviation bar ── */

.tl-deviation-bar {
	margin: 0 24px 0;
	border-radius: 10px;
	padding: 10px 16px;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13px;
}

.tl-deviation-bar--ok {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
	align-items: center;
}

.tl-deviation-bar--alert {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #78350f;
	flex-direction: column;
	gap: 8px;
}

.tl-deviation-bar__heading {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tl-deviation-bar__count {
	background: #f59e0b;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	border-radius: 9px;
	padding: 1px 7px;
	letter-spacing: 0;
	text-transform: none;
}

.tl-deviation-bar__pip {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.tl-deviation-bar__pip--ok    { background: #22c55e; }
.tl-deviation-bar__pip--alert {
	background: #f59e0b;
	animation: pp-pulse 2.4s ease-in-out infinite;
	box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

.tl-deviation-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tl-deviation-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	flex-wrap: wrap;
}

.tl-deviation-item__name {
	font-weight: 600;
	color: #1e293b;
}

.tl-deviation-item__sep {
	color: #94a3b8;
}

.tl-deviation-item__detail {
	color: #b45309;
}
