/* ═══════════════════════════════════════════════════════════════════════════
   EVENTS — Calendar-based event scheduling
   Prefix: .evt-*
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.evt-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0;
}

.evt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
}

.evt-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

.evt-new-btn {
  font-size: 0.82rem;
  padding: 7px 16px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.evt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 0;
  text-align: center;
}

.evt-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent2);
}

.evt-empty-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.evt-empty-copy {
  font-size: 0.85rem;
  color: var(--text2);
  max-width: 360px;
  line-height: 1.5;
}

/* ── Body (calendar + cards split) ───────────────────────────────────────── */

.evt-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 24px;
}

.evt-calendar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  color: var(--text2);
  font-size: 0.85rem;
  min-height: 200px;
}

.evt-calendar-placeholder-icon {
  color: var(--accent);
  opacity: 0.4;
}

/* ── Cards section ───────────────────────────────────────────────────────── */

.evt-cards-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.evt-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.evt-cards-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.evt-cards-search {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  width: 200px;
  outline: none;
}
.evt-cards-search:focus { border-color: var(--accent); }

.evt-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.evt-cards-no-match {
  padding: 20px;
  text-align: center;
  color: var(--text3);
  font-size: 0.85rem;
}

/* ── Event card (accordion) ──────────────────────────────────────────────── */

/* ── Event template card (T1 Playbook) ──────────────────────────────────── */
.evt-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.evt-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border2);
}

.evt-card-main {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 14px 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: inherit;
  font: inherit;
  font-family: inherit;
  outline: none;
}
.evt-card-main:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--radius-lg);
}

.evt-card-name-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.evt-card-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
}

.evt-card-name {
  font-family: var(--font-display, var(--font-ui));
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.evt-card-subtitle {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.3;
  padding-left: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-card-track {
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  padding-left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.evt-card-track-active {
  color: var(--green);
  font-weight: 500;
}
.evt-card-track-scheduled {
  color: var(--accent);
}
.evt-card-track-completed {
  color: var(--text3);
}
.evt-card-track-never {
  color: var(--text3);
  font-style: italic;
}
.evt-card-track-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: evtCardTrackPulse 2s ease-in-out infinite;
}
@keyframes evtCardTrackPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* ── Card fields ─────────────────────────────────────────────────────────── */

.evt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evt-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
}

.evt-field-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}
.evt-field-input:focus { border-color: var(--accent); }

.evt-field-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}
.evt-field-select:focus { border-color: var(--accent); }

/* ── Colour swatches ─────────────────────────────────────────────────────── */

.evt-color-swatches {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.evt-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.15s;
}
.evt-color-swatch:hover { transform: scale(1.1); }
.evt-color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
}

.evt-color-custom {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: transparent;
}

/* ── Create Modal ────────────────────────────────────────────────────────── */

.evt-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.evt-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evt-modal-field > label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
}

.evt-modal-field > input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}
.evt-modal-field > input[type="text"]:focus { border-color: var(--accent); }

.evt-modal-hint {
  font-size: 0.75rem;
  color: var(--text3);
  line-height: 1.4;
  margin-top: 2px;
}

.evt-modal-portfolio-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.evt-modal-portfolio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.evt-modal-portfolio-row:last-child { border-bottom: none; }
.evt-modal-portfolio-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.evt-modal-portfolio-row.selected { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.evt-modal-portfolio-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.evt-modal-portfolio-meta {
  font-size: 0.78rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}

/* ── Portfolio picker (in card body) ─────────────────────────────────────── */

.evt-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.evt-picker-search-row {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.evt-picker-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  box-sizing: border-box;
}
.evt-picker-search:focus { border-color: var(--accent); }

.evt-picker-header {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface2) 50%, transparent);
}

.evt-picker-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text2);
  cursor: pointer;
}

.evt-picker-header-text {
  font-weight: 500;
}

.evt-picker-list {
  max-height: 200px;
  overflow-y: auto;
}

.evt-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.evt-picker-row:last-child { border-bottom: none; }
.evt-picker-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.evt-picker-row.selected { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.evt-picker-row.conflict { opacity: 0.5; cursor: not-allowed; }

.evt-picker-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.evt-picker-row-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evt-picker-row-meta {
  font-size: 0.75rem;
  color: var(--text3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.evt-picker-row-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 15%, transparent);
  color: var(--amber);
  white-space: nowrap;
  flex-shrink: 0;
}

.evt-picker-row-conflict {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--red) 15%, transparent);
  color: var(--red);
  font-weight: 600;
  flex-shrink: 0;
}

.evt-picker-empty {
  padding: 16px;
  text-align: center;
  color: var(--text3);
  font-size: 0.8rem;
}

/* ── Override editor ─────────────────────────────────────────────────────── */

.evt-overrides {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evt-overrides-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.evt-override-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.evt-override-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.evt-override-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.evt-override-label {
  font-size: 0.8rem;
  color: var(--text2);
  flex: 1;
  min-width: 0;
}

.evt-override-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  outline: none;
  text-align: right;
}
.evt-override-input:focus { border-color: var(--accent); }

.evt-override-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.evt-override-remove:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

.evt-override-add-wrap {
  position: relative;
}

.evt-override-add-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.evt-override-add-btn:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.evt-override-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 10;
  max-height: 260px;
  overflow-y: auto;
}

.evt-override-dropdown-group {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px 4px;
}

.evt-override-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}
.evt-override-dropdown-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.evt-overrides-empty {
  font-size: 0.8rem;
  color: var(--text3);
  font-style: italic;
  padding: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR — Month grid + event bars
   Matches the date range picker aesthetic: spacious, no cell borders,
   centred day numbers, Exo 2 month label, accent dot for today.
   ═══════════════════════════════════════════════════════════════════════════ */

.evt-cal {
  position: relative;
  max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px 12px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.evt-cal:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border2);
}

/* ── Navigation ─────────────────────────────────────────────────────────── */

.evt-cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.evt-cal-nav-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 5px;
  line-height: 1;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.evt-cal-nav-btn:hover { background: var(--surface2); color: var(--text); }

.evt-cal-month {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-display);
}

.evt-cal-today-btn {
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: none;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.evt-cal-today-btn:hover { background: var(--surface2); color: var(--text); }

/* ── Day-of-week header ─────────────────────────────────────────────────── */

.evt-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 3px;
}

.evt-cal-dow-cell {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  text-align: center;
  padding: 4px 0 8px;
}

/* ── Grid ───────────────────────────────────────────────────────────────── */

.evt-cal-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Week row: 7-col grid. Row 1 = day numbers, then event bar lanes below */
.evt-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(var(--evt-lanes, 0), 24px);
  column-gap: 3px;
  position: relative;
}

/* ── Day cells ──────────────────────────────────────────────────────────── */

.evt-cal-day {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.evt-cal-day-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.evt-cal-day:not(.evt-cal-other):hover .evt-cal-day-num {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

.evt-cal-other {
  color: var(--text3);
  opacity: 0.35;
  cursor: pointer;
}

/* Today: filled accent circle */
.evt-cal-today .evt-cal-day-num {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.evt-cal-today:hover .evt-cal-day-num {
  background: var(--accent2, var(--accent));
  color: #fff;
}

/* ── Event bars ─────────────────────────────────────────────────────────── */

.evt-cal-bar {
  grid-column: var(--bar-col) / span var(--bar-span);
  grid-row: calc(2 + var(--bar-lane));
  background: linear-gradient(90deg, color-mix(in srgb, var(--bar-color) 28%, transparent), color-mix(in srgb, var(--bar-color) 12%, transparent));
  border-left: 3px solid var(--bar-color);
  margin: 1px 2px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: background 0.15s, box-shadow 0.15s;
  z-index: 1;
}
.evt-cal-bar:hover {
  background: linear-gradient(90deg, color-mix(in srgb, var(--bar-color) 38%, transparent), color-mix(in srgb, var(--bar-color) 20%, transparent));
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 2;
}

.evt-cal-bar-selected {
  background: linear-gradient(90deg, color-mix(in srgb, var(--bar-color) 40%, transparent), color-mix(in srgb, var(--bar-color) 22%, transparent));
  box-shadow: 0 0 0 1.5px var(--bar-color), 0 2px 8px rgba(0,0,0,0.12);
  z-index: 3;
}

/* Continuation segments: flatten edges that flow into adjacent weeks */
.evt-cal-bar-start {
  margin-left: 4px;
}
.evt-cal-bar-end {
  margin-right: 4px;
}
/* When not a start, square off left side */
.evt-cal-bar:not(.evt-cal-bar-start) {
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
  padding-left: 6px;
}
/* When not an end, square off right side */
.evt-cal-bar:not(.evt-cal-bar-end) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: 0;
}

.evt-cal-bar-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

/* ── Tooltip ────────────────────────────────────────────────────────────── */

.evt-cal-tooltip {
  position: absolute;
  z-index: 20;
  transform: translate(-50%, calc(-100% - 10px));
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 140px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation:evtTooltipIn calc(var(--motion-fast)*0.8) ease-out;
}

@keyframes evtTooltipIn {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 6px)); }
  to   { opacity: 1; transform: translate(-50%, calc(-100% - 10px)); }
}

.evt-cal-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.evt-cal-tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.evt-cal-tooltip-row strong {
  font-size: 0.82rem;
  color: var(--text);
}

.evt-cal-tooltip-dates {
  font-size: 0.78rem;
  color: var(--text2);
}

.evt-cal-tooltip-meta {
  font-size: 0.72rem;
  color: var(--text3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DRAG & DROP — Card→Calendar + Bar resize
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Body top row (calendar + detail panel) ───────────────────────────── */

.evt-body-top {
  position: relative;
}

/* ── Drop zone highlight ──────────────────────────────────────────────── */

.evt-cal-day-drop {
  background: color-mix(in srgb, var(--drop-color, var(--accent)) 15%, transparent);
  border-radius: 8px;
}

/* ── Bar resize handles ───────────────────────────────────────────────── */

.evt-cal-bar {
  position: relative;
}

.evt-cal-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.15s;
}
.evt-cal-bar:hover .evt-cal-bar-handle { opacity: 1; }

.evt-cal-bar-handle.start { left: -2px; }
.evt-cal-bar-handle.end { right: -2px; }

.evt-cal-bar-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 12px;
  border-radius: 1.5px;
  background: var(--bar-color);
  opacity: 0.6;
}

/* ── Resizing state (body class prevents pointer events on bars during resize) ── */

body.evt-resizing .evt-cal-bar { pointer-events: none; }
body.evt-resizing .evt-cal-day { pointer-events: auto; }

/* ── Card dragging state ──────────────────────────────────────────────── */

.evt-card-dragging {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Ghost pill (appended to document.body) ───────────────────────────── */

.evt-drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transform: scale(1);
  transition: transform 0.12s cubic-bezier(0.34,1.18,0.64,1);
}
.evt-drag-ghost.dropping {
  transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DETAIL PANEL — Instance detail sidebar (inline flex, content-driven clip)
   ═══════════════════════════════════════════════════════════════════════════ */

.evt-detail {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid transparent;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  z-index: 10;
  transition: width 0.45s cubic-bezier(0.34,1.18,0.64,1),
              border-color 0.2s ease,
              box-shadow 0.2s ease;
}
.evt-detail.open {
  width: 300px;
  border-left-color: var(--border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.06);
  overflow-y: auto;
}

.evt-detail-inner {
  min-width: 300px;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 20px;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.evt-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.evt-detail-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.evt-detail-title-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.evt-detail-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.evt-detail-close:hover { color: var(--text); }

/* ── Sections ─────────────────────────────────────────────────────────── */

.evt-detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.evt-detail-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Date pills ──────────────────────────────────────────────────────── */

.evt-detail-date-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text);
}
.evt-detail-date-pill {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.evt-detail-date-pills.clickable {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}
.evt-detail-date-pills.clickable:hover {
  border-color: var(--border2);
  background: var(--surface2);
}
.evt-detail-date-pills.clickable.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.evt-detail-date-arrow {
  color: var(--text3);
  font-size: 0.75rem;
}

/* ── Mini calendar popover (reuses .dr-* from DateRangePicker) ────────── */

.evt-mini-cal-popover {
  position: fixed;
  z-index: 300;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  animation:evtCalFadeIn var(--motion-fast) ease;
}
@keyframes evtCalFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.evt-mini-cal-popover .dr-cal-header {
  margin-bottom: 6px;
}
.evt-mini-cal-popover .dr-cal-grid {
  gap: 0;
}
.evt-mini-cal-popover .dr-day {
  font-size: 11px;
  padding: 5px 0;
}
.evt-mini-cal-popover .dr-cal-dow {
  font-size: 10px;
}

.evt-mini-cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.evt-mini-cal-label {
  font-size: 0.72rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.evt-mini-cal-apply {
  font-size: 0.72rem;
  padding: 4px 12px;
  flex-shrink: 0;
}

/* .evt-detail-save-btn removed — dates now saved via MiniCalendar Apply */

/* ── Status ───────────────────────────────────────────────────────────── */

.evt-detail-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.evt-detail-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 8px;
  text-transform: capitalize;
}
.evt-detail-status.scheduled {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.evt-detail-status.active {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
}
.evt-detail-status.completed {
  background: color-mix(in srgb, var(--text3) 12%, transparent);
  color: var(--text3);
}
.evt-detail-status.cancelled {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}

.evt-detail-cancel-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  color: var(--red);
}
.evt-detail-cancel-btn:hover {
  background: color-mix(in srgb, var(--red) 8%, transparent);
}

/* ── Template / overrides ─────────────────────────────────────────────── */

.evt-detail-preset {
  margin-bottom: 4px;
}

.evt-detail-overrides {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.evt-detail-override-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text2);
}
.evt-detail-override-val {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
}

.evt-detail-muted {
  font-size: 0.8rem;
  color: var(--text3);
  font-style: italic;
}

/* ── Portfolio list ───────────────────────────────────────────────────── */

.evt-detail-portfolio-list {
  display: flex;
  flex-direction: column;
}
.evt-detail-portfolio {
  font-size: 0.82rem;
  color: var(--text);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.evt-detail-portfolio:last-child { border-bottom: none; }

/* ── Footer ───────────────────────────────────────────────────────────── */

.evt-detail-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.evt-detail-delete-btn {
  font-size: 0.78rem;
  color: var(--red);
  padding: 5px 12px;
}
.evt-detail-delete-btn:hover {
  background: color-mix(in srgb, var(--red) 8%, transparent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EVENTS REWORK — rail + calendar + compact detail
   Appended late so it can override the earlier stacked layout rules.
   ═══════════════════════════════════════════════════════════════════════════ */

.evt-body {
  display: flex;
  flex-direction: row;
  gap: 24px;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.panel#panel-events.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Full-height self-managed panel. KEEP the `.panel` 28px TOP breathing so the
     "Events" header lines up with every other page's title — without it the header
     sat flush against the window's (now rounded) top edge and read as cut off. Cancel
     only the BOTTOM breathing; the height still subtracts the same 28 so the calendar
     keeps its existing bottom edge (the body just gains the 28px of top breathing). */
  padding-top: 28px;
  padding-bottom: 0;
  /* 86 = --shell-content-top(46) + --shell-gap(12) + 28 (the top breathing above). */
  height: calc(100dvh - 86px);
}

.panel#panel-events.active .evt-layout {
  min-height: 0;
}

.evt-rail,
.evt-main {
  min-height: 0;
}

.evt-rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding: 16px 16px 12px;
  overflow: hidden;
  /* See `.evt-main` below — `.evt-rail` and `.evt-main` share the row with
     fixed flex-basis values (340px / 760px). Calendar view: rail grows to
     fill remaining width (flex-grow:1). Timeline view: rail stays at its
     340px basis (flex-grow:0 via the override). JS spring in EventsTab
     animates flex-grow inline from 1→0 (or 0→1) during view switches; when
     settled, the spring clears the inline style and CSS defaults take over. */
  flex: 1 1 340px;
  min-width: 0;
}
.evt-body-timeline .evt-rail {
  flex-grow: 0;
}

.evt-rail-header {
  align-items: flex-start;
}

.evt-rail-copy {
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text3);
  line-height: 1.45;
}

.evt-rail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
}

.evt-main {
  /* Calendar view: stays at its 760px basis (flex-grow:0 from `flex:0 1 760px`)
     so the calendar looks square-ish. Rail fills the rest.
     Timeline view: grows to fill remaining width (flex-grow:1 via override).
     Rail stays at its 340px basis. */
  flex: 0 1 760px;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  height: 100%;
}
.evt-body-timeline .evt-main {
  flex-grow: 1;
}

.evt-main-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Inner holds the active view content (calendar or timeline).
   It remounts on view swap (via key={displayView} in EventsTab), which
   replays the evtInnerFadeIn keyframe on the fresh element.
   `.is-fading-out` overrides the mount animation with evtInnerFadeOut
   for the outgoing content before the swap. */
.evt-main-stage-inner {
  position: relative;
  width: 100%;
  height: 100%;
  animation: evtInnerFadeIn 220ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
.evt-main-stage-inner.is-fading-out {
  animation: evtInnerFadeOut 140ms cubic-bezier(0.4, 0, 0.2, 1) both;
}
/* Motion S5 (§34.3 tabs): the incoming view slides the direction of travel
   through the calendar⇄timeline strip. --evt-slide-dx is set inline by
   EventsTab from the view order (±26px; 0 default keeps a pure fade, and the
   reduced-motion block below zeroes it). */
@keyframes evtInnerFadeIn {
  from { opacity: 0; transform: translateX(var(--evt-slide-dx, 0px)); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .evt-main-stage-inner { --evt-slide-dx: 0px; animation-duration: 0.01ms; }
}
@keyframes evtInnerFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.evt-main .evt-cal {
  width: 100%;
  /* Cap the calendar at a square-ish footprint matching the pre-transition
     design. Timeline view is unaffected — EventTimeline has no width cap
     and fills the full stage. */
  max-width: 760px;
  height: 100%;
  min-height: 0;
}

.evt-card-preset-badge.mode {
  background: color-mix(in srgb, var(--text2) 10%, transparent);
  color: var(--text2);
}

/* Drag-grip on the right edge of the compact card */
.evt-card-drag-handle {
  border: none;
  padding: 0;
  background: transparent;
  cursor: grab;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-left: 1px solid var(--border);
  outline: none;
  transition: background 0.15s;
}
.evt-card-drag-handle:hover {
  background: color-mix(in srgb, var(--evt-color, var(--text3)) 10%, transparent);
}
.evt-card-drag-handle:active {
  cursor: grabbing;
}
.evt-card-drag-handle:focus-visible {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.evt-card-grip-texture {
  display: block;
  width: 100%;
  /* Stack of 3 vertical "dots" anchored to the centre — evokes a physical grip
     without the standard 3-dot SVG. Textured lines = tactile affordance. */
  background-image:
    radial-gradient(circle at 50% 50%,
      color-mix(in srgb, var(--evt-color, var(--text3)) 55%, transparent) 0.9px,
      transparent 1.4px);
  background-size: 4px 6px;
  background-position: center;
  background-repeat: repeat-y;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.evt-card-drag-handle:hover .evt-card-grip-texture,
.evt-card:hover .evt-card-grip-texture {
  opacity: 0.9;
}

.evt-field-span-2 {
  grid-column: 1 / -1;
}

.evt-inline-mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.evt-inline-mode-btn {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.evt-inline-mode-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent2);
}

.evt-field-hint {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text3);
  line-height: 1.45;
}

.evt-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.evt-mode-card {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 5px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.evt-mode-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.evt-mode-card-label {
  font-size: 0.84rem;
  font-weight: 700;
}

.evt-mode-card-copy {
  font-size: 0.77rem;
  color: var(--text3);
  line-height: 1.45;
}

.evt-cal {
  max-width: none;
  padding: 16px 20px 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.evt-cal-grid {
  gap: 4px;
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  min-height: 0;
  height: 100%;
  align-content: stretch;
}

.evt-cal-week {
  min-height: 0;
  height: 100%;
  grid-template-rows: minmax(62px, 1fr) repeat(var(--evt-lanes, 0), 18px);
  position: relative;
  isolation: isolate;
}

.evt-cal-day {
  aspect-ratio: auto;
  min-height: 0;
  height: auto;
  padding: 10px 0 8px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.evt-cal-day-drop {
  background: color-mix(in srgb, var(--drop-color, var(--accent)) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--drop-color, var(--accent)) 28%, transparent);
}

.evt-cal-day.evt-cal-other.evt-cal-day-drop {
  opacity: 1;
}

.evt-cal-day-highlight {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  top: 4px;
  bottom: calc((var(--evt-lanes) * 18px) + 10px);
  left: calc((100% / 7) * var(--fill-col) + 4px);
  width: calc((100% / 7) - 8px);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bar-color) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bar-color) 14%, transparent);
}

.evt-cal-day-highlight-selected {
  background: color-mix(in srgb, var(--bar-color) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bar-color) 22%, transparent);
}

.evt-cal-day-highlight:not(.evt-cal-day-highlight-start) {
  left: calc((100% / 7) * var(--fill-col) - 1px);
  width: calc(100% / 7 + 1px);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: none;
}

.evt-cal-day-highlight:not(.evt-cal-day-highlight-end) {
  width: calc(100% / 7 - 4px);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}
/* Middle cells (not start, not end): full column width + 1px overlap */
.evt-cal-day-highlight:not(.evt-cal-day-highlight-start):not(.evt-cal-day-highlight-end) {
  width: calc(100% / 7 + 1px);
}

/* Start+end (single-day) keeps its full box-shadow */
.evt-cal-day-highlight.evt-cal-day-highlight-start.evt-cal-day-highlight-end {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bar-color) 14%, transparent);
}

.evt-cal-bar {
  min-height: 20px;
  margin-top: -2px;
  margin-bottom: 0;
  z-index: 3;
}

/* ── Detail modal (Event Command Centre) ─────────────────────────────── */

.evt-detail-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.evt-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(3px);
  border-radius: var(--radius-lg);
}

.evt-detail {
  position: relative;
  width: min(720px, calc(100% - 8px));
  max-height: calc(100% - 8px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--evt-color, var(--accent)) 10%, var(--surface)) 0%, var(--surface) 35%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
}
.evt-detail::-webkit-scrollbar {
  display: none;
}
/* Show scrollbar only when content overflows and mouse is inside */
.evt-detail:hover {
  scrollbar-width: thin;
}
.evt-detail:hover::-webkit-scrollbar {
  display: block;
  width: 6px;
}
.evt-detail:hover::-webkit-scrollbar-thumb {
  background: var(--text3);
  border-radius: 3px;
}

.evt-detail-inner {
  min-width: 0;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Hero: title row + narrative + progress bar ──────────────────────── */

.evt-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.evt-detail-hero-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.evt-detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.evt-detail-title-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent);
}
.evt-detail-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.evt-detail-title {
  font-family: var(--font-display, var(--font-ui));
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evt-detail-subtitle {
  font-size: 0.8rem;
  color: var(--text2);
  line-height: 1.3;
}

.evt-detail-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.evt-detail-close:hover {
  color: var(--text);
  background: var(--surface2);
}

/* Status narrative — the hero sentence */
.evt-detail-narrative {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
  line-height: 1.3;
}
.evt-detail-narrative-headline {
  font-weight: 600;
}
.evt-detail-narrative-sep {
  color: var(--text3);
  opacity: 0.55;
}
.evt-detail-narrative-qualifier {
  font-weight: 500;
}
.evt-detail-narrative-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: evtActivePulse 2s ease-in-out infinite;
  margin-right: 2px;
}
@keyframes evtActivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.evt-detail-narrative-active .evt-detail-narrative-headline { color: var(--green); }
.evt-detail-narrative-scheduled .evt-detail-narrative-headline { color: var(--accent); }
.evt-detail-narrative-completed .evt-detail-narrative-headline { color: var(--text2); }
.evt-detail-narrative-cancelled .evt-detail-narrative-headline {
  color: var(--text3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text3) 50%, transparent);
}

.evt-detail-narrative-qualifier-positive { color: var(--green); }
.evt-detail-narrative-qualifier-negative { color: var(--red); }
.evt-detail-narrative-qualifier-neutral  { color: var(--text3); }

/* Progress bar (clickable → MiniCalendar) */
.evt-detail-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface2) 55%, transparent);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.evt-detail-progress.clickable {
  cursor: pointer;
}
.evt-detail-progress.clickable:hover {
  border-color: var(--border2);
  background: var(--surface2);
}
.evt-detail-progress.clickable.active,
.evt-detail-progress.clickable:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  outline: none;
}
.evt-detail-progress-labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  gap: 12px;
}
.evt-detail-progress-dur {
  color: var(--text3);
  font-size: 0.72rem;
}
.evt-detail-progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text3) 18%, transparent);
  overflow: visible;
}
.evt-detail-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--evt-color, var(--accent));
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.evt-detail-progress-completed .evt-detail-progress-fill {
  background: color-mix(in srgb, var(--evt-color, var(--accent)) 65%, var(--text3));
}
.evt-detail-progress-cancelled .evt-detail-progress-fill {
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--text3) 40%, transparent),
    color-mix(in srgb, var(--text3) 40%, transparent) 3px,
    transparent 3px,
    transparent 6px
  );
  width: 100% !important;
}
.evt-detail-progress-today {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--evt-color, var(--accent));
  box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

/* ── KPI strip — flat, hairline-divided ──────────────────────────────── */

.evt-detail-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px 0 8px;
}
.evt-detail-kpi {
  padding: 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.evt-detail-kpi:first-child { padding-left: 0; }
.evt-detail-kpi:last-child  { padding-right: 0; }
.evt-detail-kpi-divided {
  border-left: 1px solid var(--border);
}
.evt-detail-kpi-value {
  font-family: var(--font-display, var(--font-ui));
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.evt-detail-kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
}
.evt-detail-kpi-delta {
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text3);
}
.evt-detail-kpi-delta.positive { color: var(--green); }
.evt-detail-kpi-delta.negative { color: var(--red); }

/* Empty data state */
.evt-detail-empty-data {
  font-size: 0.82rem;
  color: var(--text3);
  padding: 12px 2px;
  font-style: italic;
}

/* ── Pacing chart — chromeless ───────────────────────────────────────── */

.evt-detail-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.evt-detail-pace-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 8px;
}
.evt-detail-pace-badge.on {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
}
.evt-detail-pace-badge.ahead,
.evt-detail-pace-badge.slightly-ahead {
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  color: var(--amber);
}
.evt-detail-pace-badge.behind,
.evt-detail-pace-badge.slightly-behind {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}
.evt-detail-pace-delta {
  font-variant-numeric: tabular-nums;
}

/* ── SVG chart component ─────────────────────────────────────────────── */
.evt-pc-wrap {
  min-height: 140px;
}
.evt-pc-budget-callout {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 10px; margin-bottom: 6px;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 8px;
}
.evt-pc-budget-label {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text3);
}
.evt-pc-budget-value {
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.evt-pc-budget-sub {
  font-size: 11px; color: var(--text3);
}

/* Pacing chart tooltip (portaled to body) */
.evt-pc-tip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px 10px;
  min-width: 140px;
  font-size: 0.75rem;
  line-height: 1.5;
}
.evt-pc-tip-date {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.evt-pc-tip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.evt-pc-tip-label {
  color: var(--text3);
}
.evt-pc-tip-value {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.evt-pc-tip-delta {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--border);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.evt-pc-tip-delta.positive { color: var(--green); }
.evt-pc-tip-delta.negative { color: var(--red); }
.evt-pc-tip-delta.amber { color: var(--amber); }

/* ── Section anatomy: eyebrow + content ──────────────────────────────── */

.evt-detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.evt-detail-section-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.evt-detail-section-eyebrow {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.11em;
}
.evt-detail-section-count {
  color: var(--text3);
  opacity: 0.7;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.evt-detail-section-aside {
  font-size: 0.7rem;
  color: var(--text3);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* Lock pill (replaces the old emoji icon + banner) */
.evt-detail-lock-pill {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  color: var(--amber);
}

/* Read-only demand value */
.evt-detail-readonly-row {
  font-size: 0.85rem;
  color: var(--text);
  padding: 2px 0;
}
.evt-detail-readonly-value {
  font-weight: 500;
}

/* Read-only overrides list */
.evt-detail-overrides-ro {}
.evt-detail-overrides {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.evt-detail-override-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 7px 12px;
  font-size: 0.8rem;
  color: var(--text2);
  align-items: center;
}
.evt-detail-override-row + .evt-detail-override-row {
  border-top: 1px solid var(--border);
}
.evt-detail-override-val {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
}

.evt-detail-muted {
  font-size: 0.82rem;
  color: var(--text3);
  font-style: italic;
}

/* Portfolio rows (read-only) — name + inline metric, scrollable */
.evt-detail-portfolio-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-y: auto;
  max-height: 260px;
  background: var(--surface);
}
.evt-detail-portfolio-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  font-size: 0.84rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.evt-detail-portfolio-row:last-child { border-bottom: none; }
.evt-detail-portfolio-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evt-detail-portfolio-metric {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  flex-shrink: 0;
}
.evt-detail-portfolio-metric.muted {
  color: var(--text3);
}

/* Unified footer */
.evt-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.evt-detail-footer-left {
  display: flex;
  gap: 4px;
  align-items: center;
}
.evt-detail-footer-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.evt-detail-destructive {
  font-size: 0.82rem;
  padding: 6px 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.evt-detail-destructive-warning {
  color: var(--amber);
}
.evt-detail-destructive-warning:hover {
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  color: var(--amber);
}
.evt-detail-destructive-danger {
  color: var(--red);
}
.evt-detail-destructive-danger:hover {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
}

/* ── Event destructive-action confirmation modal ─────────────────────────
   Standard .modal-overlay + .modal pattern (per CLAUDE.md), portaled to body
   so it sits above the event detail modal cleanly. Local rules for the
   header/close/body are required because the global CSS only defines
   .modal-overlay, .modal, .modal-title, .modal-sub. */

.evt-confirm-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.evt-confirm-modal .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text3);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.evt-confirm-modal .modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.evt-confirm-modal .modal-close:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.evt-confirm-modal .modal-body {
  padding: 18px 24px 22px;
}

.evt-confirm-modal .modal-title {
  font-family: var(--font-display, var(--font-ui));
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
  line-height: 1.25;
}

/* Tonal top-edge shine overrides the default accent on .modal::before */
.evt-confirm-modal-warning::before {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--amber) 55%, transparent), transparent) !important;
}
.evt-confirm-modal-danger::before {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--red) 55%, transparent), transparent) !important;
}

.evt-confirm-body {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.55;
  margin: 0 0 20px;
}
.evt-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Tone-only modifiers — shape inherits from .btn */
.evt-confirm-primary-warning {
  background: var(--amber);
  color: #1a1209;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.evt-confirm-primary-warning:hover {
  background: color-mix(in srgb, var(--amber) 88%, black);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.evt-confirm-primary-danger {
  background: var(--red);
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.evt-confirm-primary-danger:hover {
  background: color-mix(in srgb, var(--red) 88%, black);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.evt-confirm-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 1320px) {
  .evt-rail {
    flex-basis: 340px;
  }
  .evt-body-timeline .evt-rail {
    flex-basis: 300px;
  }

  .evt-detail-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .panel#panel-events.active {
    height: auto;
  }

  .evt-body {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }
  .evt-rail {
    flex: 0 0 auto;
  }

  .evt-main-stage {
    width: 100%;
    height: auto;
  }

  .evt-rail-list {
    max-height: 340px;
  }

  .evt-card-body-inner,
  .evt-mode-grid {
    grid-template-columns: 1fr;
  }

  .evt-detail-kpi-strip {
    grid-template-columns: 1fr;
    padding: 4px 0;
  }
  .evt-detail-kpi {
    padding: 8px 0;
  }
  .evt-detail-kpi:first-child { padding-top: 0; }
  .evt-detail-kpi:last-child  { padding-bottom: 0; }
  .evt-detail-kpi-divided {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .evt-detail {
    width: min(100%, 700px);
  }
}

@media (max-width: 860px) {
  .evt-main .evt-cal {
    padding: 14px 14px 12px;
    height: auto;
    max-height: none;
  }

  .evt-cal-day {
    min-height: 0;
    height: auto;
  }

  .evt-detail-modal {
    padding: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Event Budget section (Session 3 of event-budget-carve-out plan)
   Rendered inside EventInstancePanel; toggle + total + per-portfolio shares
   + day weights + preview. Prefix `.evt-budget-*`.
   ═══════════════════════════════════════════════════════════════════════════ */

.evt-budget-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative; /* anchors the §34 .motion-sweep-bar save acknowledgement */
}

.evt-budget-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evt-budget-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.evt-budget-hint {
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.5;
}

/* Cross-month warning (Session 5) — single-line note, amber-tinted, non-blocking.
   Appears above the Total budget row when the event spans a month boundary. */
.evt-budget-cross-month-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}
.evt-budget-cross-month-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--amber) 22%, transparent);
  color: var(--amber);
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 18px;
  text-align: center;
  margin-top: 1px;
}

/* Toggle — segmented checkbox with coloured track */
.evt-budget-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}
.evt-budget-toggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}
.evt-budget-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.evt-budget-toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.evt-budget-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text3);
  /* §34 toggle station — knob family spring: the lab-approved 0.38s hard
     overshoot (calc(base*1.5) = 0.375s ≈ the signed-off 0.38s) */
  transition: transform calc(var(--motion-base)*1.5) var(--ease-spring-hard), background 0.18s ease;
}
.evt-budget-toggle input:checked + .evt-budget-toggle-track {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.evt-budget-toggle input:checked + .evt-budget-toggle-track .evt-budget-toggle-thumb {
  transform: translateX(14px);
  background: var(--accent);
}
.evt-budget-toggle-label {
  color: var(--text2);
  font-size: 0.78rem;
  font-weight: 500;
}

.evt-budget-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.evt-budget-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Total budget row */
.evt-budget-total-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.evt-budget-total-input-wrap,
.evt-budget-share-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 180px;
}
.evt-budget-currency-sign {
  position: absolute;
  left: 10px;
  font-size: 0.85rem;
  color: var(--text3);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.evt-budget-total-input,
.evt-budget-share-input {
  width: 100%;
  padding: 8px 10px 8px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s ease;
}
.evt-budget-total-input:focus,
.evt-budget-share-input:focus {
  border-color: var(--accent);
}
.evt-budget-total-input:disabled,
.evt-budget-share-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* Hide number-input spinners for cleaner look */
.evt-budget-total-input::-webkit-inner-spin-button,
.evt-budget-share-input::-webkit-inner-spin-button,
.evt-budget-day-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Shares section */
.evt-budget-shares-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.evt-budget-shares-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.evt-budget-reset-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.evt-budget-reset-link:hover { color: var(--accent2, var(--accent)); }
.evt-budget-reset-link:disabled {
  color: var(--text3);
  cursor: not-allowed;
  text-decoration: none;
}
.evt-budget-shares-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.evt-budget-empty {
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text3);
  text-align: center;
}
.evt-budget-share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 130px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.evt-budget-share-row:last-child { border-bottom: none; }
.evt-budget-share-row--warn {
  background: color-mix(in srgb, var(--amber) 4%, transparent);
}
.evt-budget-share-row--danger {
  background: color-mix(in srgb, var(--red) 6%, transparent);
}
.evt-budget-share-portfolio {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.evt-budget-share-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evt-budget-share-meta {
  font-size: 0.72rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}
.evt-budget-share-pct {
  font-size: 0.78rem;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.evt-budget-share-pct--warn { color: var(--amber); font-weight: 500; }
.evt-budget-share-pct--danger { color: var(--red); font-weight: 600; }

/* Error chips */
.evt-budget-error-chip {
  font-size: 0.78rem;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 20%, transparent);
  border-radius: 8px;
  padding: 6px 10px;
}
.evt-budget-error-chip--danger {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border-color: color-mix(in srgb, var(--red) 22%, transparent);
}

/* Day weights section */
.evt-budget-days-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.evt-budget-days-toggle {
  background: none;
  border: none;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.12s ease;
}
.evt-budget-days-toggle:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.evt-budget-days-caret {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--text3);
  transition: transform 0.22s cubic-bezier(0.34, 1.18, 0.64, 1);
}
.evt-budget-days-caret.open { transform: rotate(90deg); }
.evt-budget-days-hint {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 400;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.evt-budget-days-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* Preset chips */
.evt-budget-preset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.evt-budget-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text2);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.evt-budget-chip:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  color: var(--text);
}
.evt-budget-chip.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.evt-budget-chip--custom {
  pointer-events: none;
  border-style: dashed;
  color: var(--text3);
}

/* Peak picker popover (inline, relative to its chip wrapper) */
.evt-budget-peak-chip-wrap {
  position: relative;
}
.evt-budget-peak-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  background: var(--modal-bg, var(--surface));
  border: 1px solid var(--border2, var(--border));
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.evt-budget-peak-picker-label {
  font-size: 0.7rem;
  color: var(--text3);
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evt-budget-peak-picker-btn {
  background: none;
  border: none;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s ease;
}
.evt-budget-peak-picker-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Day list */
.evt-budget-day-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.evt-budget-day-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 110px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}
.evt-budget-day-label {
  font-size: 0.82rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.evt-budget-day-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  outline: none;
  text-align: right;
}
.evt-budget-day-input:focus { border-color: var(--accent); }
.evt-budget-day-input:disabled { opacity: 0.55; }
.evt-budget-day-amount {
  font-size: 0.78rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.evt-budget-day-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.evt-budget-day-sum {
  font-size: 0.75rem;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}
.evt-budget-day-sum.invalid {
  color: var(--red);
  font-weight: 500;
}

/* Preview */
.evt-budget-preview {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.evt-budget-preview-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evt-budget-spill-banner {
  font-size: 0.78rem;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 18%, transparent);
  border-radius: 6px;
  padding: 6px 10px;
}
.evt-budget-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.evt-budget-preview-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.evt-budget-preview-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.evt-budget-preview-row--orphan {
  color: var(--red);
  font-size: 0.78rem;
}
.evt-budget-preview-portfolio {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.evt-budget-preview-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.evt-budget-preview-ccy {
  font-size: 0.7rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evt-budget-preview-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.evt-budget-preview-pill {
  font-size: 0.75rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-variant-numeric: tabular-nums;
}
.evt-budget-preview-pill--muted {
  color: var(--text3);
  background: transparent;
}
.evt-budget-preview-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.75rem;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
}
.evt-budget-preview-day strong {
  color: var(--text);
  font-weight: 600;
}
.evt-budget-preview-loading {
  font-size: 0.78rem;
  color: var(--text3);
  padding: 8px 4px;
}

/* Save actions */
.evt-budget-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* Mobile */
@media (max-width: 720px) {
  .evt-budget-share-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .evt-budget-share-pct { text-align: left; }
  .evt-budget-day-row { grid-template-columns: minmax(0, 1fr) 80px 90px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EVENTS — View toggle, status strip, and portfolio-row timeline (2026-04-22)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header controls + View toggle ──────────────────────────────────────── */
.evt-header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.evt-view-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The Events view switch (Timeline | Calendar) is the shared underline-tab
   primitive (.utabs in components.css, DESIGN.md §30). `.evt-view-toggle` is a
   layout hook only — keep it level with the segmented zoom/density controls and
   the + New Event button in the same toolbar cluster. */
.evt-view-toggle.utabs { align-self: center; }

.evt-zoom-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 2px;
}
.evt-zoom-btn {
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text3);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: -0.01em;
}
.evt-zoom-btn:hover { color: var(--text2); }
.evt-zoom-btn-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── Status strip — KPI cards with tinted icon badges ──────────────────── */
.evt-status-strip {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin: 4px 0 22px;
  flex-wrap: wrap;
}

.evt-status-card {
  --status-tint: var(--text3);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.evt-status-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-lg);
}
.evt-status-card-green  { --status-tint: var(--green); }
.evt-status-card-amber  { --status-tint: var(--amber); }
.evt-status-card-accent { --status-tint: var(--accent); }
.evt-status-card-info   { --status-tint: var(--accent2, var(--accent)); }

.evt-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--status-tint) 14%, transparent);
  color: var(--status-tint);
  flex-shrink: 0;
}

.evt-status-body {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.evt-status-value {
  font-family: var(--font-display, var(--font-ui));
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.evt-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.evt-status-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: -0.005em;
  white-space: nowrap;
  line-height: 1.2;
}
.evt-status-sublabel {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.005em;
  white-space: nowrap;
  line-height: 1.2;
}

.evt-status-card-zero .evt-status-value {
  color: var(--text3);
  font-weight: 500;
}
.evt-status-card-zero .evt-status-icon {
  background: color-mix(in srgb, var(--text3) 8%, transparent);
  color: var(--text3);
}

/* ── Rail section labels (Active / Dormant) ─────────────────────────────── */
.evt-rail-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 4px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  border-bottom: 1px solid var(--border2);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.evt-rail-section-label:first-child { padding-top: 2px; }
.evt-rail-section-label-dormant { opacity: 0.75; margin-top: 12px; }
.evt-rail-section-count {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Timeline ───────────────────────────────────────────────────────────── */
.evt-tl-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.evt-tl-wrap:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border2);
}

.evt-tl-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

.evt-tl-scroller {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  scroll-behavior: smooth;
}

.evt-tl-content {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── Timeline header (time axis) ────────────────────────────────────────── */
.evt-tl-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* Above today (z:7), stripe (z:1), and body (z:10) so the today badge and
     any row content scrolling vertically get covered by the sticky header. */
  z-index: 11;
  flex: 0 0 48px;
  height: 48px;
}

.evt-tl-header-sticky {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  z-index: 9;
}

/* ── Portfolio column resize handle ─────────────────────────────────────── */
.evt-tl-col-resize {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 12;
  touch-action: none;
}
.evt-tl-col-resize::after {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
.evt-tl-col-resize:hover::after,
.evt-tl-col-resize.dragging::after {
  opacity: 0.7;
}
.evt-tl-col-resize.dragging {
  cursor: col-resize;
}
body:has(.evt-tl-col-resize.dragging) {
  cursor: col-resize;
  user-select: none;
}
.evt-tl-header-sticky::after,
.evt-tl-density-sticky::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -8px;
  width: 8px;
  background: linear-gradient(to right, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  pointer-events: none;
}
.evt-tl-sticky-label { display: inline-flex; align-items: center; }

.evt-tl-axis {
  position: relative;
  height: 100%;
}
/* Two-row axis: top groups (months / weeks / quarters) + bottom ticks */
.evt-tl-axis-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  border-bottom: 1px solid var(--border2);
}
.evt-tl-axis-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border2);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
/* First segment (left edge of timeline) doesn't need its own divider */
.evt-tl-axis-segment:first-child {
  border-left: none;
}
/* Sticky-left so the month/quarter label stays visible when scrolled into
   the middle of its range. Clipped by segment overflow so it can't spill
   into adjacent segments. */
.evt-tl-axis-segment-text {
  position: sticky;
  /* Skip past the sticky portfolio column so the label isn't hidden behind
     it when scrolled into the middle of a segment. */
  left: calc(var(--evt-tl-col, 220px) + 8px);
  display: inline-block;
  padding: 4px 10px 0;
  line-height: 20px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.evt-tl-axis-bottom {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  bottom: 0;
}
.evt-tl-axis-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text3);
  white-space: nowrap;
  line-height: 1;
}
.evt-tl-axis-tick-text {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.evt-tl-axis-tick-sub {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text2);
  text-transform: none;
}
.evt-tl-axis-tick-major .evt-tl-axis-tick-text,
.evt-tl-axis-tick-major .evt-tl-axis-tick-sub {
  color: var(--text);
}
.evt-tl-axis-tick-dim .evt-tl-axis-tick-text,
.evt-tl-axis-tick-dim .evt-tl-axis-tick-sub {
  color: color-mix(in srgb, var(--text3) 70%, transparent);
}
/* Day zoom: stack letter over number with extra room */
.evt-tl-axis-bottom-day .evt-tl-axis-tick-sub {
  font-size: 11px;
  margin-top: 1px;
}
/* Quarter zoom: month text is single-line */
.evt-tl-axis-bottom-quarter .evt-tl-axis-tick-text {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}
.evt-tl-month-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border2);
}
/* Don't double-divider in the top row — top segment borders already handle it */
.evt-tl-axis > .evt-tl-month-divider {
  top: 24px;
}

/* ── Timeline body rows ─────────────────────────────────────────────────── */
/* Rows are fixed-height. The scroller (`.evt-tl-scroller`) handles overflow
   when total natural height exceeds the viewport. Density mode ('compact'
   vs 'comfortable') drives the inline `height` set per row in TSX. */
.evt-tl-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 0;
  /* Establishes a stacking context so the sticky row-name (z:8 inside) paints
     ABOVE the today line + link stripe that live at content-level. The body's
     lane has transparent backgrounds, so today/stripe are still visible
     through the lane — only the opaque portfolio column occludes them. */
  z-index: 10;
}

.evt-tl-row-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.evt-tl-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border2);
  transition: background 0.12s;
  flex: 0 0 auto;
}
.evt-tl-row:hover { background: color-mix(in srgb, var(--accent) 2%, transparent); }
.evt-tl-row-drop { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.evt-tl-row-drop .evt-tl-row-name {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.evt-tl-row-name {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  z-index: 8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.evt-tl-row-name::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -8px;
  width: 8px;
  background: linear-gradient(to right, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  pointer-events: none;
}
.evt-tl-row:hover .evt-tl-row-name {
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}

.evt-tl-row-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.evt-tl-row-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--text3);
  opacity: 0.5;
}
.evt-tl-row-dot-scheduled {
  background: var(--text3);
  border-color: var(--text3);
  opacity: 0.6;
}
.evt-tl-row-dot-active {
  background: var(--green);
  border-color: var(--green);
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}

.evt-tl-lane {
  position: relative;
}

.evt-tl-lane-month-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.8;
}

.evt-tl-lane-weekend {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--text3) 6%, transparent);
  pointer-events: none;
}

/* Drop-target indicator — visible when dragging a template card onto a
   timeline row + day cell. `--drop-color` is the template's color. */
.evt-tl-lane-drop {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--drop-color, var(--accent)) 18%, transparent);
  border: 1.5px dashed color-mix(in srgb, var(--drop-color, var(--accent)) 60%, transparent);
  pointer-events: none;
  z-index: 2;
  animation:evtTlDropIn calc(var(--motion-fast)*0.8) ease-out;
}
@keyframes evtTlDropIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Timeline bars ──────────────────────────────────────────────────────── */
/* Bars use a CSS custom property `--bar-color` (set inline from
   template.color) so the solid stripe + tinted body + border can all
   derive from a single source. */
.evt-tl-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 14px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: color-mix(in srgb, var(--bar-color) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--bar-color) 32%, transparent);
  box-shadow: var(--shadow);
  transition: filter 0.15s, box-shadow 0.15s, transform 0.15s, opacity 0.15s, background 0.15s;
  z-index: 3;
}
/* Solid colored stripe on the left edge */
.evt-tl-bar::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--bar-color);
  border-radius: 6px 0 0 6px;
  z-index: 1;
}
.evt-tl-bar:hover {
  background: color-mix(in srgb, var(--bar-color) 26%, var(--surface));
  box-shadow: var(--shadow-lg);
  z-index: 4;
}
.evt-tl-bar-selected {
  outline: 2px solid var(--bar-color);
  outline-offset: 2px;
}
.evt-tl-bar-active {
  background: color-mix(in srgb, var(--bar-color) 26%, var(--surface));
  border-color: color-mix(in srgb, var(--bar-color) 50%, transparent);
}
.evt-tl-bar-active::before {
  width: 5px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bar-color) 22%, transparent);
}
.evt-tl-bar-completed {
  opacity: 0.55;
  box-shadow: none;
}
.evt-tl-bar-linked {
  background: color-mix(in srgb, var(--bar-color) 26%, var(--surface));
  z-index: 4;
}

.evt-tl-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.evt-tl-bar-reach {
  padding: 1px 5px;
  background: color-mix(in srgb, var(--bar-color) 22%, transparent);
  color: color-mix(in srgb, var(--bar-color) 80%, var(--text));
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

/* Tall bars (comfortable density) — title + date stacked */
.evt-tl-bar-tall {
  padding: 6px 10px 6px 14px;
  align-items: stretch;
}
.evt-tl-bar-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  position: relative;
}
.evt-tl-bar-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
}
.evt-tl-bar-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
}
.evt-tl-bar-reach-stack {
  position: absolute;
  top: 0;
  right: 0;
}

.evt-tl-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 1;
}
.evt-tl-bar-handle-start { left: 0; }
.evt-tl-bar-handle-end { right: 0; }

/* ── Today marker + hover-link stripe ──────────────────────────────────── */
/* Split into two elements that live inside DIFFERENT containers so each is
   naturally clipped by its own sticky portfolio column:
     · Line is a child of .evt-tl-body — the sticky .evt-tl-row-name (z:8
       inside body's z:10 stacking context) covers it when scroll moves
       today behind the column.
     · Pill is a child of .evt-tl-axis (inside the header) — the sticky
       .evt-tl-header-sticky (z:9 inside header's z:11 context) covers it
       in the same way. */
.evt-tl-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: var(--accent);
  opacity: 0.7;
  pointer-events: none;
  /* Above bars (z:3) but below row-name (z:8). */
  z-index: 5;
}
.evt-tl-today-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  /* Above the axis-top range labels (no z) but below header-sticky (z:9). */
  z-index: 5;
}
.evt-tl-today-pill-text {
  position: absolute;
  top: 2px;
  left: 0;
  transform: translateX(-50%);
  padding: 2px 8px 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 45%, transparent);
}
.evt-tl-today-pill-text::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.evt-tl-link-stripe {
  position: absolute;
  top: 48px;
  bottom: 40px;
  pointer-events: none;
  z-index: 1;
  animation:evtLinkStripeIn var(--motion-fast) ease-out;
}
@keyframes evtLinkStripeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Group headers ──────────────────────────────────────────────────────── */
.evt-tl-group-header {
  display: flex;
  background: color-mix(in srgb, var(--accent) 3%, var(--surface2));
  border-bottom: 1px solid var(--border2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  height: 28px;
  align-items: center;
}
.evt-tl-group-name {
  position: sticky;
  left: 0;
  padding: 0 16px;
  background: inherit;
  z-index: 8;
}
.evt-tl-group-fill { flex: 1; }

/* ── Density strip ──────────────────────────────────────────────────────── */
.evt-tl-density-wrap {
  display: flex;
  position: sticky;
  bottom: 0;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  /* Above today (z:7), stripe (z:1), and body (z:10) — mirrors header so the
     bottom sticky strip covers row content when vertically scrolled. */
  z-index: 11;
  flex: 0 0 auto;
}

.evt-tl-density-sticky {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  z-index: 9;
}

.evt-tl-density {
  position: relative;
  background: color-mix(in srgb, var(--accent) 3%, var(--surface2));
}

.evt-tl-density-bar {
  position: absolute;
  bottom: 6px;
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--accent) 55%, var(--surface));
  transition: background 0.15s;
}
.evt-tl-density-bar:hover {
  background: var(--accent);
}

.evt-tl-density-month-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.5;
}

.evt-tl-density-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent);
  opacity: 0.55;
  pointer-events: none;
}

/* ── Timeline tooltip ──────────────────────────────────────────────────── */
.evt-tl-tooltip {
  position: fixed;
  min-width: 180px;
  max-width: 240px;
  padding: 10px 12px;
  /* Solid surface — translucent modal-bg let underlying content bleed
     through even with backdrop-filter, making the tooltip unreadable. */
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  pointer-events: none;
  animation:evtTlTooltipIn calc(var(--motion-fast)*0.8) ease-out;
}
@keyframes evtTlTooltipIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.evt-tl-tooltip-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.evt-tl-tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.evt-tl-tooltip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.evt-tl-tooltip-row {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
  letter-spacing: -0.005em;
}
.evt-tl-tooltip-status {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.evt-tl-tooltip-status-scheduled {
  background: color-mix(in srgb, var(--text3) 18%, transparent);
  color: var(--text2);
}
.evt-tl-tooltip-status-active {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}
.evt-tl-tooltip-status-completed {
  background: color-mix(in srgb, var(--text3) 15%, transparent);
  color: var(--text3);
}
.evt-tl-tooltip-status-cancelled {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  color: var(--red);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .evt-header-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ── Event template edit drawer ─────────────────────────────────────────────
   Right-edge FLOATING drawer — mirrors the New Portfolio drawer format
   (DESIGN.md §10.8): a solid opaque panel inset 14px from the window edges,
   rounded + full border + shadow-xl, with the page lightly dimmed behind via
   the global body:has(.modal-overlay)::before (the overlay carries
   .modal-overlay). Slide-in reuses the .is-entered class so both open AND close
   animate. Replaced the old flush-to-edge translucent glass slab. */
.evt-drawer-overlay {
  background: transparent;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.evt-drawer-overlay.is-entered {
  opacity: 1;
}

.evt-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 460px;
  max-width: calc(100vw - 28px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  /* Floating panel: closed transform clears the 14px gap + shadow so nothing
     peeks at rest. */
  transform: translateX(calc(100% + 28px));
  opacity: 0.4;
  transition: transform 0.32s cubic-bezier(0.34, 1.18, 0.64, 1), opacity 0.28s ease;
  will-change: transform;
}
.evt-drawer.is-entered {
  transform: translateX(0);
  opacity: 1;
}

/* Accent shine on the left inner edge — picks up the event's colour */
.evt-drawer::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--evt-color, var(--accent)) 45%, transparent),
    transparent
  );
  pointer-events: none;
}

.evt-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.evt-drawer-header-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.evt-drawer-eyebrow {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
}

.evt-drawer-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.evt-drawer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent);
}

.evt-drawer-title {
  font-family: var(--font-display, var(--font-ui));
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.evt-drawer-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text3);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.evt-drawer-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.evt-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
}

.evt-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.evt-drawer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  flex-shrink: 0;
}

.evt-drawer-delete {
  color: var(--red) !important;
  font-size: 0.82rem;
}

/* Create drawer reuses the .evt-drawer shell + .evt-drawer-footer chrome, but
   its actions (Cancel / Create) sit right-aligned rather than split. */
.evt-create-footer {
  justify-content: flex-end;
  gap: 8px;
}

.evt-demand-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.evt-field-input-demand {
  width: 96px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.evt-field-suffix {
  color: var(--text3);
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.evt-field-hint-inline {
  flex: 1 1 180px;
  margin: 0;
  min-width: 0;
  line-height: 1.4;
}

/* Portfolio picker header — checkbox left, count right. Global margin:auto
   on checkboxes centres the input when there's no flex:1 sibling; we need
   to reset it so the check aligns with the rows below. */
.evt-picker-header .evt-picker-check-label {
  justify-content: space-between;
}
.evt-picker-header input[type="checkbox"] {
  margin: 0;
}

/* google-adaptor-hardening §6C: read-only Google bidding seasonality
   adjustments card. Renders below EventStatusStrip when present. */
.evt-seasonality {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.evt-seasonality-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.evt-seasonality-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
}
.evt-seasonality-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.evt-seasonality-count {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.evt-seasonality-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
}
.evt-seasonality-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.evt-seasonality-row {
  padding: 9px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent2) 3%, var(--surface));
  border: 1px solid var(--border);
}
.evt-seasonality-row--active {
  border-color: color-mix(in srgb, var(--green) 30%, var(--border));
  background: color-mix(in srgb, var(--green) 4%, var(--surface));
}
.evt-seasonality-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.evt-seasonality-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evt-seasonality-status--active {
  background: var(--green-bg);
  color: var(--green);
}
.evt-seasonality-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evt-seasonality-modifier {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
  padding: 2px 8px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.evt-seasonality-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text3);
}
.evt-seasonality-row-meta span {
  display: inline-flex;
  align-items: center;
}
.evt-seasonality-dates {
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  font-weight: 600;
}
.evt-seasonality-desc {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--text2);
  line-height: 1.5;
}

/* ── Motion S9 sweep: reduced-motion guards for kept legacy motion ── */
@media (prefers-reduced-motion: reduce) {
  .evt-detail-narrative-dot, .evt-card-track-pulse { animation: none; }
  .evt-mini-cal-popover, .evt-cal-tooltip, .evt-tl-tooltip,
  .evt-tl-lane-drop, .evt-tl-link-stripe { animation: none; }
  .evt-detail, .evt-detail-progress-fill, .evt-drawer { transition: none; }
}
