﻿/* cards.css - Phase 5.18: Card Highlight & Sticky Hover Fixes */

.card { 
  touch-action: pan-y;
  position: absolute; 
  left: 12px; 
  right: 12px; 
  --card-top-size: 12px;
  --card-chip-size: 10px;
  --card-meta-size: 12px;
  --card-body-size: 12px;
  --card-body-line-height: 1.4;
  --card-emphasis-size: 13px;
  --card-cost-base-size: 11px;
  
  /* Geometry */
  border-radius: var(--radius-sm); 
  
  /* CRITICAL: Allow delete button to bleed out */
  overflow: visible; 
  
  /* Visuals: Category Color on the "Face" */
  background: linear-gradient(180deg, var(--c-top, #f8f9fa), var(--c-bottom, #e9ecef));
  
  /* Border: Subtle definition */
  border: 1px solid var(--c-border, rgba(0,0,0,0.1));
  
  /* The Spine: Standard Cards set to 2px (Thin) */
  border-left: 2px solid var(--c-border, #dee2e6); 
  
  /* Depth */
  box-shadow: var(--shadow-sm);
  
  color: var(--ink);
  user-select: none;
  
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), 
              box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), 
              opacity 0.2s ease-out,
              border-left-width 0.2s ease;
  
  isolation: isolate;
  
  /* STACKING STRATEGY: "Waterfall"
     Later cards (lower in DOM) sit ON TOP of earlier cards.
     Base z-index ensures a stacking context is created.
  */
  z-index: 1;
}

/* --- Interaction States --- */

/* Z-INDEX ELEVATION: Desktop Only.
   On Mobile, we prevent z-index changes on tap to preserve the "Waterfall" 
   stacking order. */
@media (hover: hover) {
  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    z-index: 5;
    filter: brightness(0.98);
  }
}

/* --- HIGHLIGHT ANIMATION (New) --- */
@keyframes cardPulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); border-color: var(--primary-bg); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); border-color: var(--primary-bg); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); border-color: var(--c-border); transform: scale(1); }
}

.card-highlight-pulse {
  animation: cardPulse 1.5s ease-out;
  z-index: 95 !important; /* Keep highlight below sticky day headers */
}

.card.dragging-active { 
  z-index: 95; 
  transform: scale(1.02) translateY(-4px); 
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
  opacity: 0.95;
}

/* Conflict State */
.card.conflicting {
  border-color: var(--warn-ink) !important; 
  border-left-color: var(--warn-ink) !important; 
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15), var(--shadow-md);
}

.card.conflict-focus-target {
  border-color: #991b1b !important;
  border-left-color: #dc2626 !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18), 0 22px 32px -24px rgba(220, 38, 38, 0.5), var(--shadow-md) !important;
  z-index: 95 !important;
}
.day.conflict-focus-day .dayHead {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.18), 0 16px 28px -22px rgba(220, 38, 38, 0.24);
}
.conflict-window-marker {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(254, 226, 226, 0.4), rgba(254, 242, 242, 0.18));
  border: 1px solid rgba(220, 38, 38, 0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 16px 32px -28px rgba(220, 38, 38, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: scaleY(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 95;
}
.conflict-window-marker.is-visible {
  opacity: 1;
  transform: scaleY(1);
}
.conflict-window-marker-label {
  position: sticky;
  top: 6px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 6px 0 0 10px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(220, 38, 38, 0.18);
  color: #b91c1c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 20px -18px rgba(220, 38, 38, 0.38);
}

body.is-dragging-card { 
  user-select: none; 
  -webkit-user-select: none; 
}

/* --- Internal Layout --- */

.card .inner { 
  padding: 0px 0px 0px 0px; 
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: var(--radius-sm); 
  overflow: visible; 
}

/* --- Drag Handle --- */
.card .drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 18px;
  cursor: grab;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; 
  transition: opacity 0.15s ease;
  touch-action: none;
}

/* Maintain opacity transition on desktop only */
@media (hover: hover) {
  .card:hover .drag-handle { opacity: 1; }
}
.card.dragging-active .drag-handle { opacity: 1; }
.card .drag-handle:active { cursor: grabbing; }

.card .drag-handle::before {
  content: '';
  width: 4px;
  height: 14px;
  background: radial-gradient(circle, rgba(0,0,0,0.3) 1.5px, transparent 1.5px) 0 0 / 4px 4px;
}

/* --- Resize Handles --- */
.card .hdl { 
  position: absolute; left: 0; right: 0; height: 10px; 
  cursor: ns-resize; z-index: 15; pointer-events: auto; 
}
.card .hdl.top { top: 0; }
.card .hdl.bot { bottom: 0; }
.cards-locked .card .drag-handle,
.cards-locked .card .hdl {
  pointer-events: none;
}

/* --- Content: Top Row --- */
.card .top { 
  position: relative; 
  display: flex; 
  gap: 6px;
  align-items: center; 
  
  padding-left: 12px;
  padding-right: 18px; 
  margin-left: -10px;  
  margin-top: -11px;  
  
  line-height: 1;
  min-height: 25px;
  font-family: var(--font-body);
  font-size: var(--card-top-size);
  color: rgba(0,0,0,0.6);
  max-width: 100%;
  overflow: visible; 
}


.card .top .when {
  display: inline-flex; 
  flex-direction: row; 
  white-space: nowrap; 
  align-items: center; 
  font-variant-numeric: tabular-nums; 
}

.card .top .when-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px;
  min-width: 0;
}

.card .top .when-range {
  color: rgba(0,0,0,0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card .top .when-dur {
  color: rgba(0,0,0,0.55);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.48);
  border: 1px solid rgba(0,0,0,0.05);
}


.card .chips { 
  display: flex; gap: 4px; flex-shrink: 0; align-items: center; 
}

.card .chip { 
  font-size: var(--card-chip-size);
  padding: 3px 6px 2px 6px; /* FIX: Added 1px top padding to prevent border clipping */
  line-height: 1.2; 
  border-radius: 6px; 
  background: rgba(255,255,255,0.6); 
  border: 1px solid rgba(0,0,0,0.05); 
  color: var(--ink);
  font-weight: 600;
  align-self: center;
  letter-spacing: 0.02em;
  margin-top: -4px;  
  margin-left: -6px;  
}

.card .desc .subtype-chip-relocated {
  display: inline-block; padding: 2px 6px; margin-right: 6px; 
  font-size: var(--card-chip-size); line-height: 1.2; border-radius: 6px; 
  background: rgba(255,255,255,0.6); color: var(--ink); 
  font-weight: 600; vertical-align: middle; border: 1px solid rgba(0,0,0,0.05);
}

.card .title { 
  font-family: var(--font-display); font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
  min-width: 0; flex: 1 1 auto; align-self: center; font-size: var(--card-emphasis-size);
}

/* FIX (DESIGN DECISION): Auto-margin forces right alignment regardless of sibling */
.card .meta { 
  white-space: nowrap; align-self: center; flex-shrink: 0; 
  font-size: var(--card-meta-size); font-variant-numeric: tabular-nums; 
  margin-left: auto; 
}

/* FIX (DESIGN DECISION): If .meta is missing, the first icon button pushes right */
.card .top .iconbtn:first-of-type {
  margin-left: auto;
}
/* ...but if .meta exists, reset that auto margin so they cluster */
.card .meta + .iconbtn {
  margin-left: 2px !important;
}

/* --- Delete Button (Corner Offset) --- */
.card .del { 
  position: absolute; 
  top: -9px; 
  right: -9px; 
  width: 18px; height: 18px; 
  border-radius: 50%; 
  background: rgba(255,255,255,0.95); 
  border: 1px solid rgba(0,0,0,0.15); 
  color: var(--warn-ink); 
  cursor: pointer; 
  display: flex; align-items: center; justify-content: center; 
  z-index: 30; 
  pointer-events: auto; 
  opacity: 0; 
  transition: all 0.15s ease; font-size: 14px; line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Show visible on hover (Desktop) or Active (Mobile) */
.card:hover .del { 
  opacity: 1; 
}

.card .del:hover {
  background: var(--warn-bg); color: var(--warn-ink); 
  transform: scale(1.2); border-color: var(--warn-ink);
  box-shadow: 0 3px 6px rgba(220, 38, 38, 0.2);
}

/* --- Description --- */
.card .desc { 
  position: relative; margin-top: 4px; padding-left: 12px; 
  font-family: var(--font-body); font-size: var(--card-body-size); 
  color: rgba(0,0,0,0.8); line-height: var(--card-body-line-height); 
  white-space: pre-wrap; overflow: hidden;
  padding-right: 20px;
}
.card .desc strong {
  font-family: var(--font-display); font-weight: 600; color: var(--ink);
}

/* --- Cost Styling --- */
.card .meta .cost-foreign { color: #0f766e; font-weight: 700; }
.card .cost .cost-base, .card .meta .cost-base {
  font-weight: 500; color: rgba(0,0,0,0.6); font-size: var(--card-cost-base-size); margin-left: 4px;
}

/* --- STATUS DOMINANCE ENGINE --- */
.card[data-stat="Booked"] { 
  border-left-width: 8px !important;
  border-left-color: #10B981 !important; 
}
.card[data-stat="Pending"] { 
  border-left-width: 8px !important;
  border-left-color: #F59E0B !important; 
}
.card[data-stat="Pending"][data-overdue="true"] { 
  border-left-width: 8px !important;
  border-left-color: #EF4444 !important; 
}

.card:not([data-stat]) { border-left-width: 2px; }
.card[data-stat="N/A"] { border-left-width: 2px; }

.card[data-stat]::before { display: none; }

/* --- Icons & Badges --- */
.card .top .iconbtn {
  -webkit-appearance: none; appearance: none; display: inline-flex; 
  align-items: center; justify-content: center; width: 20px; height: 20px; 
  padding: 0; margin: 0 2px; border-radius: 50%; 
  border: 1px solid rgba(0,0,0,0.1); background: rgba(255, 255, 255, 0.5); 
  color: var(--ink); cursor: pointer; flex-shrink: 0; 
  transition: all 0.15s ease; position: relative;
}
.card .top .iconbtn svg { pointer-events: none; width: 12px; height: 12px; }
.card .top .iconbtn:hover { 
  background: #fff; transform: scale(1.1); box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card .top .iconbtn.notes {
  color: rgba(71, 85, 105, 0.9);
  border-color: rgba(100, 116, 139, 0.18);
  background: rgba(248, 250, 252, 0.72);
}

.card .top .iconbtn.notes:hover {
  background: rgba(255,255,255,0.98);
  border-color: rgba(71, 85, 105, 0.28);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1);
}

.card .top .checklist-badge {
    position: absolute; top: -4px; right: -4px; min-width: 14px; height: 14px; 
    border-radius: 999px; background-color: #F97316; color: white; 
    font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; 
    padding: 0 3px; border: 2px solid #fff;
}

.card .top .when {
  display: inline-block; margin: 0 4px; color: rgba(0,0,0,0.7); 
  font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 600;
}
.card .top .sep { display: none; }

.card.is-cut {
  opacity: 0.5; border-style: dashed; border-color: var(--ink-dim); 
  background: rgba(255,255,255,0.5); pointer-events: none;
}
body.is-cutting-card .lanes:hover {
  cursor: copy; background: rgba(79, 70, 229, 0.05); 
}

/* --- Mobile Optimization --- */
@media (max-width: 480px) {
  .card {
    --card-top-size: 13px;
    --card-chip-size: 11px;
    --card-body-size: 13px;
  }
  .card .drag-handle { width: 24px; opacity: 0.5; }
  
  .card .del {
    width: 24px; height: 24px; 
    top: -12px; 
    right: -12px; 
    background: rgba(255,255,255,0.95); 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  }
}

@media (pointer: coarse) and (min-width: 380px) and (max-width: 460px) {
  .card {
    --card-top-size: 14px;
    --card-chip-size: 12px;
    --card-meta-size: 13px;
    --card-body-size: 14px;
    --card-body-line-height: 1.45;
    --card-emphasis-size: 14px;
    --card-cost-base-size: 12px;
  }
  .card .top .when { font-size: 12px; }
}

.card-resize-time-marker {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.94);
  color: #243043;
  border: 1px solid rgba(79, 70, 229, 0.16);
  box-shadow: 0 14px 28px -18px rgba(79, 70, 229, 0.26), 0 10px 20px -18px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}


.card[data-journey-group="true"] {
  border-left-width: 2px;
}

.card[data-journey-group="true"] .inner {
  gap: 0;
  padding-top: 0;
  padding-bottom: 10px;
}

.card[data-journey-group="true"] .top {
  margin-top: -11px;
}

.journey-group-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 6px;
  padding: 0 10px 0 10px;
  overflow: hidden;
}

.journey-group-summary {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.82);
  line-height: 1.4;
  overflow: hidden;
}

.journey-segment-scroll-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-right: 12px;
}

.journey-segment-scroll-shell[data-scrollable="false"] .journey-segment-scrollbar {
  display: none;
}

.journey-segment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 0 2px 4px 0;
  border-radius: 14px 0 0 14px;
  scroll-behavior: auto;
}

.journey-segment-scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 4px;
  width: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.62);
  touch-action: none;
  cursor: ns-resize;
}

.journey-segment-scrollbar-thumb {
  position: absolute;
  left: 1px;
  right: 1px;
  top: 0;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(120, 137, 158, 0.72);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 8px 18px -14px rgba(15, 23, 42, 0.24);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.journey-segment-scrollbar:hover .journey-segment-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.82);
  box-shadow: 0 10px 20px -14px rgba(15, 23, 42, 0.3);
}

.journey-segment-empty {
  padding: 12px;
}

.journey-segment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.journey-segment-row.is-live-now {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240, 249, 255, 0.92));
  border-color: rgba(14, 116, 144, 0.22);
  box-shadow: inset 4px 0 0 #0ea5e9, 0 10px 24px rgba(14, 116, 144, 0.12);
}

.journey-segment-row.is-segment-pending-drag {
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18);
}

.journey-segment-row[data-segment-status] {
  padding-left: 12px;
  box-shadow: inset 4px 0 0 rgba(15, 23, 42, 0.2);
}

.journey-segment-row[data-segment-status="Pending"] {
  box-shadow: inset 4px 0 0 #f59e0b;
}

.journey-segment-row[data-segment-status="Booked"] {
  box-shadow: inset 4px 0 0 #10b981;
}

.journey-segment-row[data-segment-status="Cancelled"],
.journey-segment-row[data-segment-status="Canceled"] {
  box-shadow: inset 4px 0 0 #ef4444;
}

.journey-segment-row.is-live-now[data-segment-status="Pending"] {
  box-shadow: inset 4px 0 0 #f59e0b, 0 10px 24px rgba(14, 116, 144, 0.12);
}

.journey-segment-row.is-live-now[data-segment-status="Booked"] {
  box-shadow: inset 4px 0 0 #10b981, 0 10px 24px rgba(14, 116, 144, 0.12);
}

.journey-segment-row.is-live-now[data-segment-status="Cancelled"],
.journey-segment-row.is-live-now[data-segment-status="Canceled"] {
  box-shadow: inset 4px 0 0 #ef4444, 0 10px 24px rgba(14, 116, 144, 0.12);
}

.journey-segment-row[data-transfer-risk="short"] .journey-segment-flag.is-duration,
.journey-segment-row[data-transfer-risk="short"] .journey-segment-flag.is-type {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.journey-segment-row.is-segment-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.is-dragging-journey-segment .journey-segment-row {
  cursor: grabbing;
}

.journey-segment-content {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.journey-segment-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.journey-segment-top-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.journey-segment-when {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.78);
  line-height: 1.1;
}

.journey-segment-cost {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.journey-segment-cost.journey-segment-cost-inline {
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  align-self: center;
}

.journey-segment-cost .cost-foreign {
  color: #0f766e;
  font-weight: 700;
}

.journey-segment-cost .cost-base {
  font-weight: 500;
  color: rgba(0,0,0,0.6);
  font-size: 11px;
  margin-left: 4px;
}

.journey-segment-title {
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: rgba(0,0,0,0.8);
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.journey-segment-title-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.86);
}

.journey-segment-route-inline {
  color: rgba(0,0,0,0.58);
}

.journey-segment-desc {
  color: rgba(0,0,0,0.64);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.journey-segment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.journey-segment-actions {
  cursor: default;
  touch-action: auto;
  -webkit-tap-highlight-color: transparent;
}

.journey-segment-actions button,
.journey-segment-action {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.journey-segment-action {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  color: rgba(0,0,0,0.72);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
}


.journey-drop-active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16), var(--shadow-md);
}

.journey-drop-before,
.journey-segment-drop-before,
.journey-segment-drop-after {
  position: relative;
}

.journey-drop-before::before,
.journey-segment-drop-before::before,
.journey-segment-drop-after::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 999px;
  background: #0f766e;
}

.journey-drop-before::before,
.journey-segment-drop-before::before {
  top: -4px;
}

.journey-segment-drop-after::after {
  bottom: -4px;
}

.journey-drop-end::after {
  content: '';
  display: block;
  height: 2px;
  margin: 2px 8px 0;
  border-radius: 999px;
  background: #0f766e;
}
.journey-group-summary,
.journey-segment-content,
.journey-segment-title,
.journey-segment-content {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.journey-segment-type-pill {
  min-width: 0;
}

.journey-segment-actions {
  align-self: start;
  flex-shrink: 0;
}

.journey-segment-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.journey-segment-flag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: rgba(0,0,0,0.7);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.journey-segment-flag.is-status {
  background: rgba(79, 70, 229, 0.08);
  color: rgba(67, 56, 202, 0.92);
}

.journey-segment-flag.is-cost {
  background: rgba(15, 118, 110, 0.08);
  color: rgba(15, 118, 110, 0.92);
}

.journey-segment-flag.is-checklist,
.journey-segment-flag.is-docs,
.journey-segment-flag.is-notes {
  background: rgba(15, 23, 42, 0.05);
}

.journey-segment-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.journey-segment-action svg {
  width: 12px;
  height: 12px;
}

.journey-segment-action:hover {
  background: rgba(255,255,255,1);
  border-color: rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}


.journey-segment-flag.is-duration {
  background: rgba(15, 23, 42, 0.05);
}

.journey-segment-flag.is-type {
  background: rgba(15, 23, 42, 0.07);
  color: rgba(15, 23, 42, 0.82);
}

.journey-segment-row.is-live-now .journey-segment-when,
.journey-segment-row.is-live-now .journey-segment-title-label {
  color: rgba(2, 8, 23, 0.96);
}

.journey-segment-row.is-live-now .journey-segment-action {
  background: rgba(255,255,255,0.94);
  border-color: rgba(14, 116, 144, 0.14);
}



.journey-segment-type-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 6px;
}

.journey-segment-title .journey-segment-type-pill {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 5px;
}

.journey-segment-action.iconbtn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0 2px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  position: relative;
}

.journey-segment-action.iconbtn svg {
  width: 12px;
  height: 12px;
}

.journey-segment-action.iconbtn:hover {
  background: #fff;
  transform: scale(1.1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.journey-segment-action.iconbtn.notes {
  color: rgba(71, 85, 105, 0.88);
  border-color: rgba(100, 116, 139, 0.18);
  background: rgba(248, 250, 252, 0.78);
}

.journey-segment-action.iconbtn.notes:hover {
  background: rgba(255,255,255,0.98);
  border-color: rgba(71, 85, 105, 0.28);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1);
}

.journey-segment-action.iconbtn.detach {
  color: rgba(180, 83, 9, 0.92);
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(255, 251, 235, 0.88);
}

.journey-segment-action.iconbtn.detach:hover {
  background: rgba(255, 247, 237, 0.98);
  border-color: rgba(217, 119, 6, 0.34);
  box-shadow: 0 2px 4px rgba(180, 83, 9, 0.14);
}

@media (max-width: 480px) {
  .journey-group-summary,
  .journey-segment-title,
  .journey-segment-title-label,
  .journey-segment-desc {
    font-size: 13px;
    line-height: 1.4;
  }
  .journey-segment-type-pill,
  .journey-segment-flag {
    font-size: 11px;
  }
}

@media (pointer: coarse) and (min-width: 380px) and (max-width: 460px) {
  .journey-group-summary,
  .journey-segment-title,
  .journey-segment-title-label,
  .journey-segment-desc {
    font-size: 14px;
    line-height: 1.45;
  }
  .journey-segment-type-pill,
  .journey-segment-flag {
    font-size: 12px;
  }
}

.journey-segment-actions .checklist-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  background-color: #F97316;
  color: white;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  padding: 0 3px;
  border: 2px solid #fff;
}


.card[data-journey-group="true"] .hdl {
  display: block;
  pointer-events: auto;
}

.card[data-journey-group="true"] .journey-segment-row {
  cursor: grab;
}

@media (hover: none), (pointer: coarse) {
  .card[data-journey-group="true"] .journey-segment-row {
    cursor: default;
  }

  .journey-segment-scrollbar {
    width: 12px;
  }
}

.card[data-journey-group="true"] .journey-segment-row::before,
.card[data-journey-group="true"] .journey-segment-row::after {
  background-image: none;
}
