/* TIL-Charts — Base styles */
.til-chart{
  font: 14px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color: var(--til-text, #111827);
  margin: 18px 0;
}

.til-align-left{ justify-content: flex-start; width: 100%; }
.til-align-center{ justify-content: center; width: 100%; }
.til-align-right{ justify-content: flex-end; width: 100%; }

/* Doughnut Chart (SVG-based) */
.til-donut-chart{
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 24px 0;
}

.til-donut-chart-title{
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
}

.til-donut-legend{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
  justify-content: center;
}

.til-donut-legend-item{
  display: flex;
  align-items: center;
  gap: 8px;
}

.til-donut-legend-swatch{
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.til-donut-legend-label{
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.til-donut-svg-container{
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  box-sizing: border-box;
}

.til-donut-svg-container svg{
  display: block;
  width: 100%;
  height: auto;
}


/* Bar chart styles */
.til-bar-wrap{ display:flex; gap:16px; align-items:flex-start; width:100%; }
.til-bar-text{ display:block; flex:0 0 30%; min-width:120px; box-sizing:border-box; padding-right:8px; }
.til-bar-title{ font-size:16px; font-weight:800; }
.til-bar-subtitle{ opacity:.75; }
.til-bar{ flex:1 1 70%; width:70%; display:flex; flex-direction:column; gap:8px; align-items:flex-start; box-sizing:border-box; }
/* Vertical Timeline */
.til-timeline{ 
  position: relative; 
  display: block; 
  padding-left: 48px; 
  margin: 24px 0;
  max-width: 100%;
  box-sizing: border-box;
}

.til-timeline-line{ 
  position: absolute; 
  left: 18px; 
  top: 8px; 
  bottom: 8px; 
  width: 3px; 
  background: linear-gradient(180deg, #e5e7eb 0%, #d1d5db 100%);
  border-radius: 3px;
}

.til-timeline-item{ 
  position: relative; 
  display: block; 
  margin-bottom: 32px;
  padding-bottom: 8px;
  max-width: 100%;
  box-sizing: border-box;
}

.til-timeline-item:last-child{
  margin-bottom: 0;
}

.til-timeline-marker{ 
  position: absolute;
  left: -33px;
  top: 4px;
  width: 15px; 
  height: 15px; 
  border-radius: 50%; 
  background: #ffffff;
  border: 3px solid #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  z-index: 2;
}

.til-timeline-body{ 
  display: block;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.til-timeline-body:hover{
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.til-timeline-title{ 
  margin: 0 0 8px 0; 
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.til-timeline-date{ 
  display: inline-block; 
  font-weight: 600; 
  font-size: 12px; 
  color: #3b82f6;
  background: #eff6ff;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.til-timeline-text{ 
  color: #4b5563; 
  line-height: 1.6;
  font-size: 14px;
  margin: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.til-bar-track{ width:100%; background:var(--til-bar-track, #e9eef9); height:var(--til-bar-height, 18px); border-radius:999px; overflow:hidden; }
.til-bar-fill{ height:100%; background:var(--til-bar-color, #3a86ff); border-radius:999px 0 0 999px; transition: width .4s ease; }
.til-bar-label{ font-weight:700; color:var(--til-bar-text, #111827); font-size:13px; }

/* Horizontal bar chart (multi-item) */
.til-bar-multi{ display:block; width:100%; }
.til-bar-header{ margin-bottom:16px; }
.til-bar-list{ display:block; width:100%; }
.til-bar-item{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.til-bar-item-label{ flex:0 0 25%; min-width:100px; box-sizing:border-box; padding-right:8px; font-weight:600; font-size:14px; }
.til-bar-item-track{ flex:1 1 auto; position:relative; }
.til-bar-item-track .til-bar-track{ width:100%; }
.til-bar-item-value{ flex:0 0 auto; font-weight:700; margin-left:8px; color:#111827; min-width:50px; text-align:right; font-size:14px; }

/* Error message */
.til-bar-error{ color:#7f1d1d; background:#fff1f2; border:1px solid #fecaca; padding:8px 10px; border-radius:6px; font-size:13px; }

/* Line Chart */
.til-line-chart{ 
  display: block; 
  width: 100%; 
  max-width: 100%;
  box-sizing: border-box;
  margin: 24px 0;
}

.til-line-title{ 
  font-size: 18px; 
  font-weight: 700; 
  color: #111827;
  margin-bottom: 16px;
}

.til-line-legend{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
}

.til-line-legend-item{
  display: flex;
  align-items: center;
  gap: 8px;
}

.til-line-legend-swatch{
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.til-line-legend-label{
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.til-line-svg-container{
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  box-sizing: border-box;
}

.til-line-svg-container svg{
  display: block;
  width: 100%;
  height: auto;
}
