/**
 * EB Portal — Timeline Planner front-end styles.
 *
 * Mirrors the portal planner token layer: var(--eb-*) with safe fallbacks.
 * Root wrapper: #eb-timeline-app.
 */

#eb-timeline-app {
	--ebtl-week-w: 46px;
	--ebtl-primary: var(--eb-primary, #2f6fb2);
	--ebtl-primary-dark: var(--eb-primary-dark, #235a92);
	--ebtl-ink: var(--eb-ink, #1d2327);
	--ebtl-text: var(--eb-text, #3c434a);
	--ebtl-muted: var(--eb-muted, #6b7680);
	--ebtl-border: var(--eb-border, #d9dee3);
	--ebtl-surface: var(--eb-surface, #fff);
	--ebtl-red: var(--eb-red, #b32d2e);
	--ebtl-green: var(--eb-green, #2e7d46);
	--ebtl-amber: var(--eb-amber, #b8860b);
	--ebtl-bar-planned: #9dc3e6;
	--ebtl-bar-overlap: #2f75b5;
	--ebtl-bar-beyond: #c65911;
	--ebtl-gateway: #ffe699;
	--ebtl-holiday: #fff4e5;
	--ebtl-holiday-partial: #fffaf1;
	--ebtl-meet: #7a5aa8;
	--ebtl-meet-late: #f4cccc;
	--ebtl-row-h: 44px;
	--ebtl-row-h-note: 34px;
	--ebtl-label-w: 320px;
	--ebtl-week-col: 96px;
	--ebtl-pct-col: 84px;
	--ebtl-type-col: 110px;
	--ebtl-gridline: #f1f3f5;
	--ebtl-sep: #eef1f4;
	--ebtl-phase-alt: #f7f8f9;
	max-width: 1200px;
	margin: 0 auto;
	color: var(--ebtl-text);
	font-size: 15px;
}

/* --- shared controls ------------------------------------------------ */

.ebtl-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border-radius: 10px;
	border: 1px solid var(--ebtl-border);
	background: var(--ebtl-surface);
	color: var(--ebtl-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}
.ebtl-btn:hover, .ebtl-btn:focus-visible { border-color: var(--ebtl-primary); color: var(--ebtl-primary); }
.ebtl-btn--primary { background: var(--ebtl-primary); border-color: var(--ebtl-primary); color: #fff; }
.ebtl-btn--primary:hover, .ebtl-btn--primary:focus-visible { background: var(--ebtl-primary-dark); border-color: var(--ebtl-primary-dark); color: #fff; }
.ebtl-btn--danger { color: var(--ebtl-red); }
.ebtl-btn--danger:hover { border-color: var(--ebtl-red); color: var(--ebtl-red); }
.ebtl-btn:disabled { opacity: .45; cursor: not-allowed; }

.ebtl-input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--ebtl-border);
	background: var(--ebtl-surface);
	font: inherit;
	font-size: 15px;
	color: var(--ebtl-ink);
}
.ebtl-input:focus { outline: 2px solid var(--ebtl-primary); outline-offset: 1px; }

.ebtl-label { display: block; margin: 14px 0 4px; font-size: 14px; font-weight: 600; color: var(--ebtl-ink); }
.ebtl-h { font-size: 26px; line-height: 1.25; margin: 0 0 6px; color: var(--ebtl-ink); }
.ebtl-sub { margin: 0 0 18px; color: var(--ebtl-muted); }
.ebtl-muted { color: var(--ebtl-muted); font-size: 13.5px; }
.ebtl-error, .ebtl-notice {
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--ebtl-red);
	color: var(--ebtl-red);
	background: var(--ebtl-surface);
}
.ebtl-notice { border-color: var(--ebtl-amber); color: var(--ebtl-amber); }

/* --- banners --------------------------------------------------------- */

.ebtl-banners { margin-bottom: 14px; }
.ebtl-banner {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 12px;
	padding: 12px 16px;
	border-radius: 10px;
	font-weight: 600;
}
.ebtl-banner--expired { border: 1px solid var(--ebtl-red); color: var(--ebtl-red); background: #fdf1f1; }
.ebtl-banner--conflict { border: 1px solid var(--ebtl-amber); color: var(--ebtl-amber); background: #fffaf0; }

/* --- create / list --------------------------------------------------- */

.ebtl-create { max-width: 560px; }
.ebtl-create .ebtl-btn--primary { margin-top: 20px; }

.ebtl-list-head { margin: 10px 0 16px; }
.ebtl-list-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 14px 16px;
	margin-bottom: 10px;
	border: 1px solid var(--ebtl-border);
	border-radius: 12px;
	background: var(--ebtl-surface);
}
.ebtl-list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ebtl-list-main strong { color: var(--ebtl-ink); overflow-wrap: anywhere; }
.ebtl-list-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ebtl-loading { color: var(--ebtl-muted); }

/* --- editor header ---------------------------------------------------- */

.ebtl-head {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}
/* Top row: back link alone, small, above everything. */
.ebtl-head-top { line-height: 1.4; }
.ebtl-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ebtl-primary);
	text-decoration: none;
}
.ebtl-back:hover { text-decoration: underline; }
.ebtl-back-arrow { font-size: 1.05em; font-weight: 700; }

/* Middle row: title left, start date right. */
.ebtl-head-mid {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}
#eb-timeline-app .ebtl-title {
	flex: 1 1 auto;
	min-width: 200px;
	width: auto;
	padding: 2px 4px;
	border: 0;
	border-radius: 0;
	background: transparent;
	font: inherit;
	font-size: 21px;
	font-weight: 700;
	color: var(--ebtl-ink);
}
#eb-timeline-app .ebtl-title:hover:not([readonly]),
#eb-timeline-app .ebtl-title:focus { box-shadow: inset 0 -2px 0 var(--ebtl-primary); }
#eb-timeline-app .ebtl-title:focus { outline: none; }
#eb-timeline-app .ebtl-start {
	flex: 0 0 auto;
	width: 130px;
	padding: 6px 4px;
	border: 0;
	border-radius: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
	color: var(--ebtl-text);
}
#eb-timeline-app .ebtl-start:hover:not(:disabled),
#eb-timeline-app .ebtl-start:focus { box-shadow: inset 0 -1px 0 var(--ebtl-border); }
#eb-timeline-app .ebtl-start:focus { outline: none; box-shadow: inset 0 -2px 0 var(--ebtl-primary); }

/* Tool row: duration, save chip, panel toggles, downloads. */
.ebtl-head-tools {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.ebtl-dur { font-size: 14px; color: var(--ebtl-muted); white-space: nowrap; }
.ebtl-dur strong { color: var(--ebtl-ink); }

.ebtl-chip {
	display: inline-flex;
	align-items: center;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 600;
	border: 1px solid var(--ebtl-border);
	color: var(--ebtl-muted);
	background: var(--ebtl-surface);
	white-space: nowrap;
}
.ebtl-chip.is-saving { color: var(--ebtl-primary); border-color: var(--ebtl-primary); }
.ebtl-chip.is-saved { color: var(--ebtl-green); border-color: var(--ebtl-green); }
.ebtl-chip.is-error { color: var(--ebtl-red); border-color: var(--ebtl-red); }

/* --- key dates panel -------------------------------------------------- */

.ebtl-panel {
	flex-basis: 100%;
	padding: 14px 18px;
	border: 1px solid var(--ebtl-border);
	border-radius: 12px;
	background: var(--ebtl-surface);
}
.ebtl-panel-h { margin: 0 0 8px; font-size: 16px; color: var(--ebtl-ink); }
.ebtl-kd-list { list-style: none; margin: 0; padding: 0; }
.ebtl-kd-list li {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 6px 0;
	border-bottom: 1px solid var(--ebtl-border);
	font-size: 14px;
}
.ebtl-kd-list li:last-child { border-bottom: 0; }
.ebtl-kd-name { color: var(--ebtl-muted); font-weight: 600; }
.ebtl-kd-val { color: var(--ebtl-ink); font-variant-numeric: tabular-nums; }

/* --- grid -------------------------------------------------------------- */

.ebtl-gridwrap {
	overflow-x: auto;
	border: 1px solid var(--ebtl-border);
	border-radius: 12px;
	background: var(--ebtl-surface);
}
/* One deterministic height per row type — left and right panes share it. */
.ebtl-rowwrap {
	display: flex;
	box-sizing: border-box;
	height: calc(var(--ebtl-row-h) + 1px);
	border-top: 1px solid var(--ebtl-sep);
}
.ebtl-rowwrap--note { height: calc(var(--ebtl-row-h-note) + 1px); }
/* Stronger line at phase boundaries. */
.ebtl-rowwrap--alt { background: var(--ebtl-phase-alt); }
.ebtl-phase-start { border-top: 1px solid var(--ebtl-border); }
.ebtl-row { display: flex; flex-shrink: 0; }
.ebtl-rowwrap > .ebtl-row--left,
.ebtl-rowwrap > .ebtl-row--note {
	position: sticky;
	left: 0;
	z-index: 3;
	height: var(--ebtl-row-h);
	background: var(--ebtl-surface);
	border-right: 1px solid var(--ebtl-border);
	box-shadow: 4px 0 6px -4px rgba(0, 0, 0, .10);
}
.ebtl-rowwrap--note > .ebtl-row--left,
.ebtl-rowwrap--note > .ebtl-row--note { height: var(--ebtl-row-h-note); }
.ebtl-rowwrap--alt > .ebtl-row--left,
.ebtl-rowwrap--alt > .ebtl-row--note { background: var(--ebtl-phase-alt); }
.ebtl-row--head { background: var(--ebtl-surface); z-index: 4; }
.ebtl-cell {
	box-sizing: border-box;
	padding: 0 6px;
	border-right: 1px solid var(--ebtl-sep);
	display: flex;
	align-items: center;
	height: 100%;
}
.ebtl-cell--head {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--ebtl-muted);
	text-transform: uppercase;
	letter-spacing: .03em;
	height: 34px;
}
.ebtl-cell--label { width: var(--ebtl-label-w); position: relative; }
/* Header cells share the body columns' fixed widths so titles sit exactly
   over the inputs beneath them. */
.ebtl-cell--head.ebtl-hcol-week { width: var(--ebtl-week-col); }
.ebtl-cell--head.ebtl-hcol-pct { width: var(--ebtl-pct-col); }
.ebtl-cell--head.ebtl-hcol-type { width: var(--ebtl-type-col); }

/* Grid controls: borderless — subtle bottom line on hover/focus only. */
#eb-timeline-app .ebtl-label-input {
	width: var(--ebtl-label-w);
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 13px;
	color: var(--ebtl-ink);
	padding: 0 8px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#eb-timeline-app .ebtl-label-input:hover, #eb-timeline-app .ebtl-num:hover, #eb-timeline-app .ebtl-pct:hover { box-shadow: inset 0 -1px 0 var(--ebtl-border); }
#eb-timeline-app .ebtl-label-input:focus, #eb-timeline-app .ebtl-num:focus, #eb-timeline-app .ebtl-pct:focus {
	outline: none;
	box-shadow: inset 0 -2px 0 var(--ebtl-primary);
}
.ebtl-gw-label { color: #7a5b00; font-weight: 600; }
/* Gateway rows: amber milestone band across the ENTIRE row (labels + grid). */
.ebtl-rowwrap--gateway > .ebtl-row--left,
.ebtl-rowwrap--gateway > .ebtl-lane { background: #fff6dd; }
.ebtl-rowwrap--gateway.ebtl-rowwrap--alt > .ebtl-row--left,
.ebtl-rowwrap--gateway.ebtl-rowwrap--alt > .ebtl-lane { background: #fdf1cf; }
#eb-timeline-app .ebtl-num {
	width: var(--ebtl-week-col);
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 13px;
	color: var(--ebtl-text);
	text-align: center;
	height: 100%;
}
#eb-timeline-app .ebtl-pct {
	width: var(--ebtl-pct-col);
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 13px;
	height: 100%;
	color: var(--ebtl-text);
}

.ebtl-weekfield {
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: var(--ebtl-week-col);
	height: 100%;
	padding: 0;
	overflow: hidden;
}
#eb-timeline-app .ebtl-weekfield .ebtl-num { height: auto; padding: 2px 0 0; }
/* Hints must never wrap — row height stays constant. */
#eb-timeline-app .ebtl-weekhint {
	display: block;
	font-size: 10.5px;
	color: var(--ebtl-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	line-height: 1.2;
}

.ebtl-typecell { width: var(--ebtl-type-col); gap: 6px; position: relative; }
/* Type badges: muted uppercase text, no box. */
#eb-timeline-app .ebtl-badge {
	display: inline;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .05em;
}
.ebtl-badge--task { color: var(--ebtl-muted); }
.ebtl-badge--gateway { color: #7a5b00; }
.ebtl-badge--note { color: #8a6d1a; }

/* Row menu: ghost button, visible on row hover. */
.ebtl-rowmenu { position: relative; margin-left: auto; }
#eb-timeline-app .ebtl-rowmenu-btn {
	border: 0;
	background: transparent;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	color: var(--ebtl-muted);
	padding: 4px 6px;
	border-radius: 6px;
	opacity: 0;
	transition: opacity .12s ease;
}
#eb-timeline-app .ebtl-rowwrap:hover .ebtl-rowmenu-btn,
#eb-timeline-app .ebtl-rowmenu-btn:focus-visible { opacity: 1; }
.ebtl-rowmenu-btn:hover { color: var(--ebtl-ink); }
.ebtl-rowmenu-list {
	position: absolute;
	right: 0;
	top: 100%;
	z-index: 10;
	min-width: 150px;
	padding: 4px;
	border: 1px solid var(--ebtl-border);
	border-radius: 10px;
	background: var(--ebtl-surface);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}
/* Open menu: lift the whole rowwrap above later rows (sticky rows build
   stacking contexts per row; without this the dropdown paints under the row
   below). */
.ebtl-rowwrap--menu-open {
	position: relative;
	z-index: 40;
}
/* Caption beside Download Excel explaining what it exports. */
.ebtl-dl-note {
	font-size: 12px;
	color: var(--ebtl-muted);
}
#eb-timeline-app .ebtl-rowmenu-item {
	display: block;
	width: 100%;
	text-align: right;
	border: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	font: inherit;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--ebtl-ink);
	padding: 5px 8px;
	border-radius: 4px;
	cursor: pointer;
	appearance: none;
}
#eb-timeline-app .ebtl-rowmenu-item:hover {
	background: #f0f4f8;
	color: var(--ebtl-primary);
}
#eb-timeline-app .ebtl-rowmenu-item--danger { color: #b3261e; }
#eb-timeline-app .ebtl-rowmenu-item--danger:hover { background: #fbeeed; color: #b3261e; }
#eb-timeline-app .ebtl-rowmenu { min-width: 118px; padding: 2px; }
#eb-timeline-app .ebtl-rowmenu-list { min-width: 118px; }
#eb-timeline-app .ebtl-rowmenu-list[hidden] { display: none; }

/* week header + lanes */
.ebtl-weekshead, .ebtl-lane { position: relative; display: flex; flex-shrink: 0; }
.ebtl-weekcol-head {
	width: var(--ebtl-week-w);
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border-right: 1px solid var(--ebtl-gridline);
	height: 34px;
}
.ebtl-wno { font-size: 11.5px; font-weight: 700; color: var(--ebtl-ink); line-height: 1.1; }
.ebtl-wdate { font-size: 9.5px; color: var(--ebtl-muted); line-height: 1.1; white-space: nowrap; }
.ebtl-lane {
	width: max-content;
	height: var(--ebtl-row-h);
	/* Faint vertical week gridlines behind bars. */
	background-image: linear-gradient(to right, var(--ebtl-gridline) 1px, transparent 1px);
	background-size: var(--ebtl-week-w) 100%;
}
.ebtl-rowwrap--alt > .ebtl-lane { background-color: var(--ebtl-phase-alt); }
.ebtl-lane--note { height: var(--ebtl-row-h-note); background-image: none; }

/* holiday bands */
.ebtl-holiday {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--ebtl-holiday);
	z-index: 0;
}
.ebtl-holiday--partial { background: var(--ebtl-holiday-partial); }

/* bars */
.ebtl-bar {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	height: 16px;
	border-radius: 4px;
	z-index: 1;
}
.ebtl-bar--planned { background: var(--ebtl-bar-planned); }
.ebtl-bar--overlap { background: var(--ebtl-bar-overlap); }
.ebtl-bar--beyond { background: var(--ebtl-bar-beyond); }

/* gateway diamond */
.ebtl-gw-mark {
	position: absolute;
	top: 50%;
	width: 14px;
	height: 14px;
	transform: translateY(-50%) rotate(45deg);
	background: var(--ebtl-gateway);
	border: 1px solid #c9a227;
	z-index: 2;
}

/* meeting markers */
.ebtl-meet-mark {
	position: absolute;
	top: 4px;
	bottom: 4px;
	width: 2px;
	background: var(--ebtl-meet);
	z-index: 2;
}
.ebtl-meet-mark--late { background: var(--ebtl-red); }

/* note rows */
.ebtl-rowwrap--note { background: #fffaf0; }
.ebtl-row--note .ebtl-note-label {
	width: var(--ebtl-label-w);
	box-sizing: border-box;
	padding: 10px 12px;
	font-size: 12.5px;
	font-style: italic;
	color: #8a6d1a;
	display: flex;
	align-items: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* activity column drag handle */
.ebtl-colresize {
	position: absolute;
	top: 0;
	right: -4px;
	width: 9px;
	height: 100%;
	cursor: col-resize;
	z-index: 5;
}
.ebtl-colresize:hover,
.ebtl-colresize.is-dragging { background: rgba(47, 111, 178, .22); }
.ebtl-note-callout {
	padding: 8px 14px;
	font-size: 12.5px;
	font-style: italic;
	color: #8a6d1a;
	width: 100%;
}

/* --- drawers ----------------------------------------------------------- */

.ebtl-drawers { margin-top: 16px; display: grid; gap: 12px; }
.ebtl-drawer { border: 1px solid var(--ebtl-border); border-radius: 12px; background: var(--ebtl-surface); }
.ebtl-drawer-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 10px;
}
.ebtl-drawer-head {
	flex: 1;
	text-align: left;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	color: var(--ebtl-ink);
	cursor: pointer;
	padding: 6px;
}
.ebtl-drawer-head::before { content: '▸ '; color: var(--ebtl-muted); }
.ebtl-drawer-body:not([hidden]) .ebtl-drawer-head::before,
.ebtl-drawer-head[aria-expanded='true']::before { content: '▾ '; }
.ebtl-drawer-body { padding: 4px 12px 12px; }
.ebtl-drawer-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding: 6px 0;
}
.ebtl-drawer-input { width: auto; flex: 1 1 140px; min-width: 120px; font-size: 14px; padding: 8px 10px; }
.ebtl-drawer-row--meeting .ebtl-drawer-input[type='date'] { flex: 0 1 155px; }
.ebtl-late { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ebtl-muted); white-space: nowrap; }
.ebtl-warnchip {
	display: inline-flex;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 700;
	background: var(--ebtl-meet-late);
	color: var(--ebtl-red);
	white-space: nowrap;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 900px) {
	.ebtl-title { font-size: 18px; }
	.ebtl-head .ebtl-btn, .ebtl-head .ebtl-start { flex-shrink: 1; }
}

/* --- print: browser default per spec; just keep bars from breaking ------ */

@media print {
	.ebtl-banners, .ebtl-drawers, .ebtl-head .ebtl-btn, .ebtl-rowmenu { display: none; }
	.ebtl-gridwrap { overflow: visible; border-color: #999; }
	.ebtl-row--left, .ebtl-row--note { position: static; box-shadow: none; }
}
